Re: drivers: clk: stm32h7: Endless loop of dead in driver probe function
Hi Patrice! On 09.03.22 08:43, Patrice CHOTARD wrote: > Hi johannes > > On 3/9/22 08:24, Johannes (krjdev) Krottmayer wrote: >> Hi Patrick! >> >> Sorry, for my late response. :( >> >> On 08.03.22 10:00, Patrick DELAUNAY wrote:> Yes, the current clock >> driver for STM32 MCU is not perfect,> > as the all U-Boot and the >> Linux support on STM32 MCU.> >>> >>> For information, in the other driver based on a other version of RCC for >>> STM32 MPU >>> >>> STM32MP1 = clk_stm32mp1.c, it is correctly managed in >>> >>> stm32mp1_osc_wait(1, rcc, RCC_OCRDYR, RCC_OCRDYR_HSERDY); >>> >>> by using readl_poll_timeout() function. >>> >>> My possible fixes: At a timeout when reading the register and if the timeout is elapsed, print an error message and return with ETIMEDOUT, so the dm manger can call the hang() function. >>> >>> I agree, it is a correct management: at least indicate this hardware issue >>> >>> even if the rdy bit can't be stay at 0 in normal use case when HSE is >>> >>> present.> >>> => replace all while() in the RCC clock driver with readl_poll_timeout >>> >>> >>> but to call readl_poll_timeout(), the arch timer need to ready >>> >>> (timer_init() already called) when RCC clokc driver probe is executed. >>> >>> >>> An issue the I encounters on STM32MP need to be checked in MCU driver: >>> >>> the timer can't dependant of RCC probe when polling function is used. >>> >>> >>> This issue was solved in STM32MP by using the generic armv7 timer >>> >>> (only dependant of Cortex core) and call the initialization in >>> >>> arch/arm/mach-stm32mp/cpu.c: >>> >>> int arch_cpu_init(void) >>> { >>> >>> >>> /* early armv7 timer init: needed for polling */ >>> timer_init(); >>> >>> return 0; >>> } >> >> Is there any reason why not use the ARMv7-M SysTick Timer? There >> exists an initialization routine in the U-Boot source tree: > > Simply because when i introduced stm32h7 board, i didn't need it ;-) > >> >> arch/arm/cpu/armv4m/systick-timer.c >> >> The routines should work for Cortex-M3/M4/M7. >> >> timer_init() and all required functions for mdelay() which are will >> be called by the polling functions are implemented. >> >> Don't looked into other TRM's, other than for STM32H745/STM32H747 and >> STM32H755/STM32H757 yet, but according the TRM, the SysTick timer for >> the core Cortex-M7 should run at 8MHz, after reset: >> >> - HSI should be selected as system clock (sys_ck), running at 64MHz >> - Domain 1 prescaler (D1CPRE) with scale 1 >> - SysTick timer at default configuration (external source) which >> has a fixed prescale from 8, according the block schematic in >> TRM. >> >> Correct me please, if I'm wrong. >> >>> The timer management on MCU need to be check before any patch. >> >> Yes, but I can currently only test the correct behavior on a >> STM32H747I-DISCO board. Currently creating the device-tree for >> the SoC. >> >>> Can you propose something ? >> >> I would use the SysTick Timer on the other devices from the STM32H7 >> series too, so I would change the current code. >> >> Before I release a patch series here in the official mailing list, >> I would suggest, if some other developers or users can verify my >> modification on their real hardware. >> >> My GitHub repo: >> https://github.com/krjdev/stm32_u-boot >> (branch stm32h747_disco) >> >> That I can offer. :) > > I have a stm21h7xxi-disco (MB1248) i can give it a try this week. > I will keep you in touch. Please can you give me some additional time for this? The device-tree needs some fixes. Missing clocks and resets for the required driver. I will create a git tag, when I'm ready and I have tested to run U-Boot on my board. :) Working since sunday on the device-trees...Maybe tommorrow. :) > Thanks > Patrice > >> >> Kind regards, >> >> Johannes Kind regards Johannes
Re: drivers: clk: stm32h7: Endless loop of dead in driver probe function
On 3/9/22 09:02, Johannes (krjdev) Krottmayer wrote: > Hi Patrice! > > On 09.03.22 08:43, Patrice CHOTARD wrote: >> Hi johannes >> >> On 3/9/22 08:24, Johannes (krjdev) Krottmayer wrote: >>> Hi Patrick! >>> >>> Sorry, for my late response. :( >>> >>> On 08.03.22 10:00, Patrick DELAUNAY wrote:> Yes, the current clock >>> driver for STM32 MCU is not perfect,> > as the all U-Boot and the >>> Linux support on STM32 MCU.> For information, in the other driver based on a other version of RCC for STM32 MPU STM32MP1 = clk_stm32mp1.c, it is correctly managed in stm32mp1_osc_wait(1, rcc, RCC_OCRDYR, RCC_OCRDYR_HSERDY); by using readl_poll_timeout() function. > My possible fixes: > At a timeout when reading the register and if the timeout is > elapsed, print an error message and return with ETIMEDOUT, so > the dm manger can call the hang() function. I agree, it is a correct management: at least indicate this hardware issue even if the rdy bit can't be stay at 0 in normal use case when HSE is present.> => replace all while() in the RCC clock driver with readl_poll_timeout but to call readl_poll_timeout(), the arch timer need to ready (timer_init() already called) when RCC clokc driver probe is executed. An issue the I encounters on STM32MP need to be checked in MCU driver: the timer can't dependant of RCC probe when polling function is used. This issue was solved in STM32MP by using the generic armv7 timer (only dependant of Cortex core) and call the initialization in arch/arm/mach-stm32mp/cpu.c: int arch_cpu_init(void) { /* early armv7 timer init: needed for polling */ timer_init(); return 0; } >>> >>> Is there any reason why not use the ARMv7-M SysTick Timer? There >>> exists an initialization routine in the U-Boot source tree: >> >> Simply because when i introduced stm32h7 board, i didn't need it ;-) >> >>> >>> arch/arm/cpu/armv4m/systick-timer.c >>> >>> The routines should work for Cortex-M3/M4/M7. >>> >>> timer_init() and all required functions for mdelay() which are will >>> be called by the polling functions are implemented. >>> >>> Don't looked into other TRM's, other than for STM32H745/STM32H747 and >>> STM32H755/STM32H757 yet, but according the TRM, the SysTick timer for >>> the core Cortex-M7 should run at 8MHz, after reset: >>> >>> - HSI should be selected as system clock (sys_ck), running at 64MHz >>> - Domain 1 prescaler (D1CPRE) with scale 1 >>> - SysTick timer at default configuration (external source) which >>> has a fixed prescale from 8, according the block schematic in >>> TRM. >>> >>> Correct me please, if I'm wrong. >>> The timer management on MCU need to be check before any patch. >>> >>> Yes, but I can currently only test the correct behavior on a >>> STM32H747I-DISCO board. Currently creating the device-tree for >>> the SoC. >>> Can you propose something ? >>> >>> I would use the SysTick Timer on the other devices from the STM32H7 >>> series too, so I would change the current code. >>> >>> Before I release a patch series here in the official mailing list, >>> I would suggest, if some other developers or users can verify my >>> modification on their real hardware. >>> >>> My GitHub repo: >>> https://github.com/krjdev/stm32_u-boot >>> (branch stm32h747_disco) >>> >>> That I can offer. :) >> >> I have a stm21h7xxi-disco (MB1248) i can give it a try this week. >> I will keep you in touch. > > Please can you give me some additional time for this? The device-tree > needs some fixes. Missing clocks and resets for the required driver. > > I will create a git tag, when I'm ready and I have tested to run > U-Boot on my board. :) > > Working since sunday on the device-trees...Maybe tommorrow. :) No problem, i will wait your green light :-D Patrice > >> Thanks >> Patrice >> >>> >>> Kind regards, >>> >>> Johannes > > Kind regards > > Johannes
Re: [PATCH v4 05/11] EFI: FMP: Add provision to update image's ImageTypeId in image descriptor
Akashi-san [...] > > > I think that users should know how "dfu_alt_info" is defined > > > (in other words, where the firmware be located on the target > > > system) > > > when capsule files are created. > > > >>> > > > >>> That is true for a non A/B scenario. And that is how it works in > > > >>> the > > > >>> non A/B updates case. But for A/B updates, since the > > > >>> determination of > > > >>> the "location" where the firmware image has to be written will be > > > >>> done > > > >>> only at runtime, we cannot use the --index to differentiate. > > > >> > > > >> Yes, we can :) > > > > > > > > You know what I mean -- if we could use the same logic, I would not > > > > have added all that code :) > > > > > > > >> > > > >> First of all, my essential assumption in either FIT or RAW FMP > > > >> driver > > > >> is that U-Boot has (somehow conceptually) single firmware blob > > > >> represented > > > >> by DFU or dfu_alt_info. As I said, each object or location in > > > >> dfu_alt_info can be further identified by index or > > > >> "UpdateImageIndex". > > > >> > > > >> Let's assume that we have two locations of firmware, fw1 and fw2, > > > >> and > > > >> that we have two bank A and B. > > > >> Then we will define dfu_alt_info as follows: > > > >>;;; > > >> of fw2 for B>; > > > >>|<--- 1st set --->|<--- 2nd set > > > >>--->| > > > >> > > > >> When you want to update bank A, we can use the first set of > > > >> dfu_alt_info, > > > >> and use the second set of dfu_alt_info for bank B. > > > >> At runtime, you should know which bank you're working on, and > > > >> therefore > > > >> you should know the exact physical location from dfu_alt_info. > > > >> > > > >> Please note that you don't have to change the syntax of > > > >> dfu_alt_info > > > >> at all. Simply offset the location with 0 for bank A and with 2 > > > >> for bank B. > > > > > > I'll try digging a bit more, but I think the current approach is not > > > working as it was intended wrt to the EFI spec. My reading of the > > > spec > > > and specifically section 23.3.2 is that a Capsule consists of an > > > EFI capsule header and a payload. The payload now has an > > > EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER which in it's turn can host > > > multiple > > > firmware images of different type described in > > > EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER. > > > > > > An FMP implementation should read the UpdateImageTypeId's used to > > > identify > > > the image you are updating and from that derive the UpdateImageIndex > > > which SetImage will use. That would give you the ability to update > > > the > > > all the firmware components with a single capsule. > > > > > > Sughosh what about the ESRT table generation? If you use different > > > UpdateImageTypeId > > > those should be reflected on the ESRT tables from the OS > > > >>> > > > >>> That would depend on the values populated in the > > > >>> EFI_FIRMWARE_IMAGE_DESCRIPTOR array by the GetImageInfo function. The > > > >>> image descriptor structure has an ImageTypeId field. The value of > > > >>> ImageTypeId is what will be reflected in the ESRT table. > > > >>> > > > >>> In the current implementation, all the images in the ESRT table will > > > >>> show the same ImageTypeId value, either > > > >>> EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID or > > > >>> EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID. > > > > > > This is wrong. According to the the UEFI 2.9 specification the > > > UpdateImageTypeId is used to "identify (the) device firmware targeted by > > > this update". It does not identify the format in which the firmware is > > > delivered. > > > > > > So this needs to be fixed in the next revision of this patch series. > > > > This patch series is actually adding that platform function which > > populates the image descriptor array with the image GUID's -- patch 6 > > of this series[1] actually does that for the ST DK2 platform. This > > discussion was because Takahiro wanted to use the same image > > GUID(u-boot raw/FIT) for all the images, and use the image index for > > identifying where the image is to be written. > > The discussion depends on what the *firmware* means. > With my FMP drivers (either FIT or raw), I intended a *set of firmware* > managed with a *single* "dfu_alt_info", which may include various *images* > for different target *components* as the original DFU framework does. I still think we should fix that. The current code is working, but it's not what the EFI spec describes. I think we should do it the other way around. IOW the board defines the UUID's for the firmware partitions it needs to update. The FM
[PATCH v3 1/2] generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/
Allow to disable PHY driver in SPL because it checks the CONFIG_SPL_PHY variable for SPL builds. The same change was done for usb by commit fd09c205fc57 ("usb: s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/"). Signed-off-by: Michal Simek --- (no changes since v2) Changes in v2: - based on bug reported by Marek https://lore.kernel.org/all/d7adc9a4-f505-eaab-8cd9-45f778bc3...@denx.de/ include/generic-phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/generic-phy.h b/include/generic-phy.h index ff48b3708195..d40ce589b645 100644 --- a/include/generic-phy.h +++ b/include/generic-phy.h @@ -155,7 +155,7 @@ struct phy_bulk { unsigned int count; }; -#ifdef CONFIG_PHY +#if CONFIG_IS_ENABLED(PHY) /** * generic_phy_init() - initialize the PHY port -- 2.35.1
[PATCH v3 0/2] usb: dwc3: Enable PHY support
Hi, I am sending two patches for adding PHY support for DWC3 driver. For getting this work one header patch is required to fix issue with am57xx_hs_evm_usb_defconfig which enabled CONFIG_PHY and DWC3 drivers for U-Boot proper but doesn't enable CONFIG_SPL_PHY support. That's why there is a need to use CONFIG_IS_ENABLED macro to also properly handle SPL builds. Marek: Please take both of these patches via your usb tree. Thanks, Michal Changes in v3: - Add cover letter Changes in v2: - based on bug reported by Marek https://lore.kernel.org/all/d7adc9a4-f505-eaab-8cd9-45f778bc3...@denx.de/ - Add missing header Michal Simek (2): generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/ usb: dwc3: Add support for usb3-phy PHY configuration drivers/usb/dwc3/dwc3-generic.c | 18 ++ include/generic-phy.h | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) -- 2.35.1
[PATCH v3 2/2] usb: dwc3: Add support for usb3-phy PHY configuration
When usb3-phy label is found, PHY driver is called and serdes line is initialized. This is preparation for serdes/psgtr driver to configure GT lines based on description in DT. Signed-off-by: Michal Simek --- Changes in v3: - Add cover letter Changes in v2: - Add missing header drivers/usb/dwc3/dwc3-generic.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 01bd0ca190e3..2c5205df62cd 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -409,6 +410,17 @@ static int dwc3_glue_probe(struct udevice *dev) struct udevice *child = NULL; int index = 0; int ret; + struct phy phy; + + ret = generic_phy_get_by_name(dev, "usb3-phy", &phy); + if (!ret) { + ret = generic_phy_init(&phy); + if (ret) + return ret; + } else if (ret != -ENOENT) { + debug("could not get phy (err %d)\n", ret); + return ret; + } glue->regs = dev_read_addr(dev); @@ -420,6 +432,12 @@ static int dwc3_glue_probe(struct udevice *dev) if (ret) return ret; + if (phy.dev) { + ret = generic_phy_power_on(&phy); + if (ret) + return ret; + } + ret = device_find_first_child(dev, &child); if (ret) return ret; -- 2.35.1
[PATCH v6 0/4] 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 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 (4): timer: atmel_tcb_timer: add atmel_tcb driver ARM: dts: at91: sama5d2: add AIC node ARM: dts: at91: sama5d2: add TCB node configs: sama5d2: enable option CONFIG_ATMEL_TCB_TIMER MAINTAINERS | 1 + arch/arm/dts/sama5d2.dtsi| 26 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 | 154 +++ 13 files changed, 199 insertions(+), 7 deletions(-) create mode 100644 drivers/timer/atmel_tcb_timer.c -- 2.34.1
[PATCH v6 2/4] 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 | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/dts/sama5d2.dtsi b/arch/arm/dts/sama5d2.dtsi index 038cd73c03..1904f16eb6 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,15 @@ status = "disabled"; }; + aic: interrupt-controller@fc02 { + compatible = "atmel,sama5d2-aic"; + reg = <0xfc02 0x200>; + #interrupt-cells = <3>; + interrupt-controller; + atmel,external-irqs = <49>; + status = "disabled"; + }; + i2c1: i2c@fc028000 { compatible = "atmel,sama5d2-i2c"; reg = <0xfc028000 0x100>; -- 2.34.1
[PATCH v6 3/4] 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 1904f16eb6..ffbb171644 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 v6 4/4] 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. 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 v6 1/4] 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. 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 | 154 ++ 5 files changed, 166 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..1251746bd2 --- /dev/null +++ b/drivers/timer/atmel_tcb_timer.c @@ -0,0 +1,154 @@ +// 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 0x1 + +#define TCB_CMR(chan) (0x4 + TCB_CHAN(chan)) +#define TCB_CMR_WAVE (1 << 15) +#define TCB_CMR_TIMER_CLOCK1 0 +#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 0x1 + +#define TCB_BMR0xc4 +#define TCB_BMR_TC1XC1S_TIOA0 (2 << 2) + +#define TCB_WPMR 0xe4 +#define TCB_WPMR_WAKEY0x54494d + +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 is cleared +* when reaching 0x8000 and set when reaching 0. +*
[PATCH v3] arm: kirkwood: nas220: Add DM Ethernet, SATA, GPIO
Bring the NAS220 board up to current standards. This is basically an adaptation of the changes Tony Dinh implemented for the Dockstar board. - Implement the changes to v2 as suggested by Stefan Roese - Add CONFIG_SUPPORT_PASSING_ATAGS et al, otherwise standard Debian flash-kernel pkg is unable to start kernel - Add CONFIG_SYS_64BIT_LBA, basic read tests with a 4TB hdd succeed with my NAS220 hardware - Thanks to Stefan and Tony Signed-off-by: Hajo Noerenberg --- board/Seagate/nas220/MAINTAINERS | 1 + board/Seagate/nas220/nas220.c| 68 +++- configs/nas220_defconfig | 16 +++- include/configs/nas220.h | 35 ++-- 4 files changed, 49 insertions(+), 71 deletions(-) diff --git a/board/Seagate/nas220/MAINTAINERS b/board/Seagate/nas220/MAINTAINERS index f2df7ea64f..6033f93cf4 100644 --- a/board/Seagate/nas220/MAINTAINERS +++ b/board/Seagate/nas220/MAINTAINERS @@ -4,3 +4,4 @@ S: Maintained F: board/Seagate/nas220/ F: include/configs/nas220.h F: configs/nas220_defconfig +F: arch/arm/dts/kirkwood-blackarmor-nas220.dts diff --git a/board/Seagate/nas220/nas220.c b/board/Seagate/nas220/nas220.c index cd2bbdad1c..fdbf321ff9 100644 --- a/board/Seagate/nas220/nas220.c +++ b/board/Seagate/nas220/nas220.c @@ -10,17 +10,22 @@ #include #include -#include -#include -#include -#include +#include +#include #include #include -#include -#include +#include +#include +#include DECLARE_GLOBAL_DATA_PTR; +/* blue power led, board power, sata0, sata1 */ +#define NAS220_GE_OE_LOW (~(BIT(12) | BIT(14) | BIT(24) | BIT(28))) +#define NAS220_GE_OE_HIGH (~(0)) +#define NAS220_GE_OE_VAL_LOW (BIT(12) | BIT(14) | BIT(24) | BIT(28)) +#define NAS220_GE_OE_VAL_HIGH (0) + int board_early_init_f(void) { /* @@ -43,9 +48,9 @@ int board_early_init_f(void) MPP9_TW_SCK, MPP10_UART0_TXD, MPP11_UART0_RXD, - MPP12_GPO, + MPP12_GPO, /* blue power led */ MPP13_GPIO, - MPP14_GPIO, + MPP14_GPIO, /* board power */ MPP15_SATA0_ACTn, MPP16_SATA1_ACTn, MPP17_SATA0_PRESENTn, @@ -55,12 +60,12 @@ int board_early_init_f(void) MPP21_GPIO, MPP22_GPIO, MPP23_GPIO, - MPP24_GPIO, + MPP24_GPIO, /* sata0 power */ MPP25_GPIO, - MPP26_GPIO, + MPP26_GPIO, /* power button */ MPP27_GPIO, - MPP28_GPIO, - MPP29_GPIO, + MPP28_GPIO, /* sata1 power */ + MPP29_GPIO, /* reset button */ MPP30_GPIO, MPP31_GPIO, MPP32_GPIO, @@ -73,6 +78,11 @@ int board_early_init_f(void) return 0; } +int board_eth_init(struct bd_info *bis) +{ + return cpu_eth_init(bis); +} + int board_init(void) { /* @@ -85,37 +95,3 @@ int board_init(void) return 0; } - -#ifdef CONFIG_RESET_PHY_R -/* Configure and enable MV88E1116 PHY */ -void reset_phy(void) -{ - u16 reg; - u16 devadr; - char *name = "egiga0"; - - if (miiphy_set_current_dev(name)) - return; - - /* command to read PHY dev address */ - if (miiphy_read(name, 0xEE, 0xEE, (u16 *)&devadr)) { - printf("Err..%s could not read PHY dev address\n", __func__); - return; - } - - /* -* Enable RGMII delay on Tx and Rx for CPU port -* Ref: sec 4.7.2 of chip datasheet -*/ - miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2); - miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, ®); - reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL); - miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg); - miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0); - - /* reset the phy */ - miiphy_reset(name, devadr); - - printf("88E1116 Initialized on %s\n", name); -} -#endif /* CONFIG_RESET_PHY_R */ diff --git a/configs/nas220_defconfig b/configs/nas220_defconfig index f6a1dcbee0..5bf1233273 100644 --- a/configs/nas220_defconfig +++ b/configs/nas220_defconfig @@ -3,6 +3,9 @@ CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_SYS_DCACHE_OFF=y CONFIG_ARCH_CPU_INIT=y CONFIG_ARCH_KIRKWOOD=y +CONFIG_SUPPORT_PASSING_ATAGS=y +CONFIG_CMDLINE_TAG=y +CONFIG_INITRD_TAG=y CONFIG_SYS_KWD_CONFIG="board/Seagate/nas220/kwbimage.cfg" CONFIG_SYS_TEXT_BASE=0x60 CONFIG_NR_DRAM_BANKS=2 @@ -20,7 +23,7 @@ CONFIG_USE_PREBOOT=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="nas220> " # CONFIG_CMD_FLASH is not set -CONFIG_CMD_IDE=y +CONFIG_CMD_SATA=y CONFIG_CMD_NAND=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set @@ -32,6 +35,7 @@ CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y CONFIG_CMD_JFFS2=y CONFIG_CMD_MTDPARTS=y +CO
Re: [PATCH v6 2/4] ARM: dts: at91: sama5d2: add AIC node
Le Wed, 9 Mar 2022 09:45:01 +, a écrit : > On 3/9/22 11:22 AM, Clément Léger wrote: > > 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 | 10 ++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/arch/arm/dts/sama5d2.dtsi b/arch/arm/dts/sama5d2.dtsi > > index 038cd73c03..1904f16eb6 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,15 @@ > > status = "disabled"; > > }; > > > > + aic: interrupt-controller@fc02 { > > + compatible = "atmel,sama5d2-aic"; > > + reg = <0xfc02 0x200>; > > + #interrupt-cells = <3>; > > + interrupt-controller; > > + atmel,external-irqs = <49>; > > + status = "disabled"; > > + }; > > Hello Clement, > > Any reason to not use the exact node from Linux ? I wanted it to match all the existing nodes that are already in this file (ie compatible, then regs and so on), it seems more coherent. > > aic: interrupt-controller@fc02 { > #interrupt-cells = <3>; > > compatible = "atmel,sama5d2-aic"; > > interrupt-controller; > > reg = <0xfc02 0x200>; > > atmel,external-irqs = <49>; > > }; > > I would like to avoid any difference between Uboot and Linux, unless > really required. If you want, I can reuse the exact same definition used by Linux of course. > > Don't worry if the node is enabled, it's no problem with that. It won't > be probed due to several reasons: no driver and no need for it, since > Uboot is based on lazy probing. Ok. > > Eugen > > > + > > i2c1: i2c@fc028000 { > > compatible = "atmel,sama5d2-i2c"; > > reg = <0xfc028000 0x100>; > > -- > > 2.34.1 > > > -- Clément Léger, Embedded Linux and Kernel engineer at Bootlin https://bootlin.com
Re: iMX8MM USB support?
Hi Adding Tommaso On Fri, Apr 10, 2020 at 8:37 PM Tim Harvey wrote: > > On Thu, Apr 9, 2020 at 2:45 PM Tim Harvey wrote: > > > > On Thu, Apr 9, 2020 at 3:02 AM Schrempf Frieder > > wrote: > > > > > > On 08.04.20 17:31, Tim Harvey wrote: > > > [...] > > > >> > > > >> In my case I'm loading a FIT image, so things are a bit different. > > > >> Where are you loading the image to? > > > >> > > > >> I have the following line in mx8mm_usb_sdp_spl.conf to load my FIT > > > >> image > > > >> to DDR and jump to it: > > > >> > > > >> /path/to/image/u-boot.itb:load 0x4020, jump_direct 0x4020 > > > >> > > > > > > > > Frieder, > > > > > > > > I was trying to load u-boot.img > > > > > > > > The SPL boots fine: > > > > U-Boot SPL 2020.01-00029-g5ad7797 (Apr 08 2020 - 08:16:53 -0700) > > > > read error from device: 9310b8 register: x!Normal Boot > > > > Trying to boot from USB SDP > > > > SDP: initialize... > > > > SDP: handle requests.. > > > > > > > > But when I 'imx_usb u-boot.img' it complains there is no header on > > > > u-boot.img. I enabled FIT generation and attempted to 'imx_usb > > > > u-boot.itb' but imx_usb still complains about no header found. > > > > > > > > My mx8mm_usb_sdp_spl.conf loooks like this: > > > > mx8mm_spl_sdp > > > > #hid/bulk,[old_header,]max packet size, {ram start, ram size}(repeat > > > > valid ram areas) > > > > #In SPL, we typically load u-boot.img which has a U-boot header... > > > > hid,1024,0x91,0x4000,1G,0x0090,0x4 > > > > > > > > #0x6 - 0x8400 = 0x57c00, +0x3000=5ac00 (FIT image) > > > > ../u-boot-imx6/u-boot.bin:load 0x4020 > > > > ../u-boot-imx6/bl31-iMX8MM.bin:load 0x0092,jump 0x92 > > > > > > > > What does your mx8mm_usb_sdp_spl.conf look like? I must admit I don't > > > > really understand how these are configured. > > > > > > It looks just like yours except that I have a single instruction as > > > already stated above: > > > > > > /path/to/image/u-boot.itb:load 0x4020, jump_direct 0x4020 > > > > > > and I'm loading the FIT image by running './imx_usb' without arguments. > > > > > > As imx_usb_loader can't parse FIT image headers, I use 'jump_direct' to > > > jump to the raw image entry point and let SPL parse the FIT. I think in > > > that case imx_usb_loader shouldn't complain about a missing header. > > > > Frieder, > > > > Ok, I finally understand. Using 'imx_usb ' which is what I was > > doing is not the same as loading it via the conf file and was why it > > was looking for a header. > > > > So now that I'm using the imx_usb.conf files fully instead It's > > loading u-boot.itb and jumping but unfortunately I'm still not quite > > there. > > > > Here's what I'm seeing: > > > > U-Boot SPL 2020.01-00029-g6529a03-dirty (Apr 09 2020 - 13:02:21 -0700) > > Normal Boot > > Trying to boot from USB SDP > > SDP: initialize... > > SDP: handle requests... > > Downloading file of size 584020 to 0x4020... done > > Jumping to header at 0x4020 > > Header Tag is not an IMX image > > > > Is the 'Header Tag' message normal? From adding some debugging it > > appears to matching the dts name in my board_fit_config_name_match and > > parsing the FIT image, loading the ATF and jumping but then I get > > nothing. What would I expect at this point and do you have any > > troubleshooting tips? > > > > Frieder, > > My issue was that I forgot to set ATF_LOAD_ADDR=0x92! > > So I'm running now, booting imx8mm-evk via SDP using your USB patches > and imx_usb configuration. > > Thank you for your help! > > Tim Michael -- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 mich...@amarulasolutions.com __ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 i...@amarulasolutions.com www.amarulasolutions.com
Re: iMX8MM USB support?
Hi All, In these days I'm working on SDP_SPL support on iMX8MM, thanks to Tim that guide me over the following patches: https://patchwork.ozlabs.org/project/uboot/list/?series=251796&state=* I'm able to reach the goal to boot U-Boot 2022.04-rc3 over SDP from SPL. I would like to suggest that at the current state of the project you need to add also the following configs: CONFIG_SPL_USB_HOST=y CONFIG_SDP_LOADADDR=0x4040 Using that I'm able to boot the U-Boot 2022.04-rc3 with the following .lst file: sudo uuu file.lst file.lst uuu_version 1.2.39 # This command will be run when i.MX6/7 i.MX8MM, i.MX8MQ SDP: boot -f flash.bin # These commands will be run when use SPL and will be skipped if no spl # if (SPL support SDPV) # { SDPV: delay 1000 SDPV: write -f flash.bin -skipspl -offset 0x0 SDPV: jump # } FB: done I hope this can help some other person. Regards, Tommaso On Wed, Mar 09, 2022 at 11:52:47AM +0100, Michael Nazzareno Trimarchi wrote: > Hi > > Adding Tommaso > > On Fri, Apr 10, 2020 at 8:37 PM Tim Harvey wrote: > > > > On Thu, Apr 9, 2020 at 2:45 PM Tim Harvey wrote: > > > > > > On Thu, Apr 9, 2020 at 3:02 AM Schrempf Frieder > > > wrote: > > > > > > > > On 08.04.20 17:31, Tim Harvey wrote: > > > > [...] > > > > >> > > > > >> In my case I'm loading a FIT image, so things are a bit different. > > > > >> Where are you loading the image to? > > > > >> > > > > >> I have the following line in mx8mm_usb_sdp_spl.conf to load my FIT > > > > >> image > > > > >> to DDR and jump to it: > > > > >> > > > > >> /path/to/image/u-boot.itb:load 0x4020, jump_direct 0x4020 > > > > >> > > > > > > > > > > Frieder, > > > > > > > > > > I was trying to load u-boot.img > > > > > > > > > > The SPL boots fine: > > > > > U-Boot SPL 2020.01-00029-g5ad7797 (Apr 08 2020 - 08:16:53 -0700) > > > > > read error from device: 9310b8 register: x!Normal Boot > > > > > Trying to boot from USB SDP > > > > > SDP: initialize... > > > > > SDP: handle requests.. > > > > > > > > > > But when I 'imx_usb u-boot.img' it complains there is no header on > > > > > u-boot.img. I enabled FIT generation and attempted to 'imx_usb > > > > > u-boot.itb' but imx_usb still complains about no header found. > > > > > > > > > > My mx8mm_usb_sdp_spl.conf loooks like this: > > > > > mx8mm_spl_sdp > > > > > #hid/bulk,[old_header,]max packet size, {ram start, ram size}(repeat > > > > > valid ram areas) > > > > > #In SPL, we typically load u-boot.img which has a U-boot header... > > > > > hid,1024,0x91,0x4000,1G,0x0090,0x4 > > > > > > > > > > #0x6 - 0x8400 = 0x57c00, +0x3000=5ac00 (FIT image) > > > > > ../u-boot-imx6/u-boot.bin:load 0x4020 > > > > > ../u-boot-imx6/bl31-iMX8MM.bin:load 0x0092,jump 0x92 > > > > > > > > > > What does your mx8mm_usb_sdp_spl.conf look like? I must admit I don't > > > > > really understand how these are configured. > > > > > > > > It looks just like yours except that I have a single instruction as > > > > already stated above: > > > > > > > > /path/to/image/u-boot.itb:load 0x4020, jump_direct 0x4020 > > > > > > > > and I'm loading the FIT image by running './imx_usb' without arguments. > > > > > > > > As imx_usb_loader can't parse FIT image headers, I use 'jump_direct' to > > > > jump to the raw image entry point and let SPL parse the FIT. I think in > > > > that case imx_usb_loader shouldn't complain about a missing header. > > > > > > Frieder, > > > > > > Ok, I finally understand. Using 'imx_usb ' which is what I was > > > doing is not the same as loading it via the conf file and was why it > > > was looking for a header. > > > > > > So now that I'm using the imx_usb.conf files fully instead It's > > > loading u-boot.itb and jumping but unfortunately I'm still not quite > > > there. > > > > > > Here's what I'm seeing: > > > > > > U-Boot SPL 2020.01-00029-g6529a03-dirty (Apr 09 2020 - 13:02:21 -0700) > > > Normal Boot > > > Trying to boot from USB SDP > > > SDP: initialize... > > > SDP: handle requests... > > > Downloading file of size 584020 to 0x4020... done > > > Jumping to header at 0x4020 > > > Header Tag is not an IMX image > > > > > > Is the 'Header Tag' message normal? From adding some debugging it > > > appears to matching the dts name in my board_fit_config_name_match and > > > parsing the FIT image, loading the ATF and jumping but then I get > > > nothing. What would I expect at this point and do you have any > > > troubleshooting tips? > > > > > > > Frieder, > > > > My issue was that I forgot to set ATF_LOAD_ADDR=0x92! > > > > So I'm running now, booting imx8mm-evk via SDP using your USB patches > > and imx_usb configuration. > > > > Thank you for your help! > > > > Tim > > > Michael > > -- > Michael Nazzareno Trimarchi > Co-Founder & Chief Executive Officer > M. +39 347 913 2170 > mich...@amarulasolut
Re: [PATCH v2] armv8: layerscape: fix the function mismatch issue
On Wed, 9 Mar 2022 15:37:22 +0800 andy.t...@nxp.com wrote: Hi Andy, > From: Yuantian Tang > > Signed-off-by: Yuantian Tang > --- > v2: update copyright year > > arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S > b/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S > index d8803738f1..a40175cb3f 100644 > --- a/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S > +++ b/arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S > @@ -1,7 +1,7 @@ > /* SPDX-License-Identifier: GPL-2.0+ */ > /* > * (C) Copyright 2014-2015 Freescale Semiconductor > - * Copyright 2019 NXP > + * Copyright 2019-2022 NXP That would not be needed. The common opinion out there(TM) seems to be that the *end* of the copyright period is mostly irrelevant. One rationale is that it would only apply 75 years after the death of the author, whatever that means for "NXP". But also the copyright statement should only be updated when *significant* changes are made to the file (which are "copyright worthy"). Fixing a bug with a single line is definitely not in that category. If nothing else, this is just churn and tends to create pointless and annoying merge conflicts. I know that some projects like TF-A have a different opinion on that. I am trying to teach them for years now ;-) > * > * Extracted from armv8/start.S > */ > @@ -353,7 +353,7 @@ ENTRY(fsl_ocram_clear_ecc_err) > ldr x0, =DCSR_DCFG_MBEESR2 > str w1, [x0] > ret > -ENDPROC(fsl_ocram_init) > +ENDPROC(fsl_ocram_clear_ecc_err) That looks correct, so with the copyright change removed: Reviewed-by: Andre Przywara Cheers, Andre > #endif > > #ifdef CONFIG_FSL_LSCH3
Re: [PATCH v3 3/8] tpm: rng: Add driver model interface for TPM RNG device
hi Simon, On Wed, 9 Mar 2022 at 11:30, Sughosh Ganu wrote: > > hi Simon, > > Thanks for looking into this. I now have a fair idea of the structure > that you are looking for this interface. > > On Wed, 9 Mar 2022 at 08:05, Simon Glass wrote: > > > > Hi Sugosh, > > > > On Fri, 4 Mar 2022 at 06:35, Sughosh Ganu wrote: > > > > > > The TPM device has a builtin random number generator(RNG) > > > functionality. Expose the RNG functions of the TPM device to the > > > driver model so that they can be used by the EFI_RNG_PROTOCOL if the > > > protocol is installed. > > > > > > Also change the function arguments and return type of the random > > > number functions to comply with the driver model api. > > > > > > Signed-off-by: Sughosh Ganu > > > --- > > > > > > Changes since V2: > > > > > > * Export the existing tpm*_get_random functions to the driver model > > > instead of moving them to the drivers/rng/ directory. > > > diff --git a/lib/tpm_api.c b/lib/tpm_api.c > > > index da48058abe..3584fda98c 100644 > > > --- a/lib/tpm_api.c > > > +++ b/lib/tpm_api.c > > > @@ -6,6 +6,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -265,12 +266,26 @@ u32 tpm_get_permissions(struct udevice *dev, u32 > > > index, u32 *perm) > > > return -ENOSYS; > > > } > > > > > > +#if CONFIG_IS_ENABLED(DM_RNG) > > > int tpm_get_random(struct udevice *dev, void *data, u32 count) > > > { > > > + int ret = -ENOSYS; > > > + struct udevice *rng_dev; > > > + > > > if (tpm_is_v1(dev)) > > > - return tpm1_get_random(dev, data, count); > > > + ret = uclass_get_device_by_driver(UCLASS_RNG, > > > + DM_DRIVER_GET(tpm1_rng), > > > + &rng_dev); > > > > Er, tpm_get_random() should take a tpm device. The random device > > should be handled by the caller, which should call > > tpm_get_random(rand_dev->parent... > > Okay. I will make the changes as per your suggestion. Thanks for the > review of the patch. Having had a relook at this, the tpm_get_random is indeed getting the TPM device. Which is why the call to tpm_is_v1 is being called with the same 'dev' argument. So I believe this function is currently as per what you are looking for. Getting the TPM device as the first argument. -sughosh
Re: [PATCH v3] arm: kirkwood: nas220: Add DM Ethernet, SATA, GPIO
Hi Hajo, On Wed, Mar 9, 2022 at 1:27 AM Hajo Noerenberg wrote: > > Bring the NAS220 board up to current standards. This is basically an > adaptation of the changes Tony Dinh implemented for the Dockstar board. > > - Implement the changes to v2 as suggested by Stefan Roese > - Add CONFIG_SUPPORT_PASSING_ATAGS et al, otherwise standard Debian > flash-kernel pkg is unable to start kernel I believe CONFIG_SUPPORT_PASSING_ATAGS should no longer be needed. Debian mainline kernels have been device-tree based for quite some time. Perhaps it is the flash-kernel package that needs to be looked at (maybe it failed to include the NAS220 DTB?). FWIW, I have been running a custom Debian Kirkwood kernel (with other Kirkwood boards) for many years with u-boots that don't have the ATAGS option enabled. Thanks, Tony > - Add CONFIG_SYS_64BIT_LBA, basic read tests with a 4TB hdd succeed with my > NAS220 hardware > > - Thanks to Stefan and Tony > > > Signed-off-by: Hajo Noerenberg > --- > board/Seagate/nas220/MAINTAINERS | 1 + > board/Seagate/nas220/nas220.c| 68 +++- > configs/nas220_defconfig | 16 +++- > include/configs/nas220.h | 35 ++-- > 4 files changed, 49 insertions(+), 71 deletions(-) > > diff --git a/board/Seagate/nas220/MAINTAINERS > b/board/Seagate/nas220/MAINTAINERS > index f2df7ea64f..6033f93cf4 100644 > --- a/board/Seagate/nas220/MAINTAINERS > +++ b/board/Seagate/nas220/MAINTAINERS > @@ -4,3 +4,4 @@ S: Maintained > F: board/Seagate/nas220/ > F: include/configs/nas220.h > F: configs/nas220_defconfig > +F: arch/arm/dts/kirkwood-blackarmor-nas220.dts > diff --git a/board/Seagate/nas220/nas220.c b/board/Seagate/nas220/nas220.c > index cd2bbdad1c..fdbf321ff9 100644 > --- a/board/Seagate/nas220/nas220.c > +++ b/board/Seagate/nas220/nas220.c > @@ -10,17 +10,22 @@ > > #include > #include > -#include > -#include > -#include > -#include > +#include > +#include > #include > #include > -#include > -#include > +#include > +#include > +#include > > DECLARE_GLOBAL_DATA_PTR; > > +/* blue power led, board power, sata0, sata1 */ > +#define NAS220_GE_OE_LOW (~(BIT(12) | BIT(14) | BIT(24) | BIT(28))) > +#define NAS220_GE_OE_HIGH (~(0)) > +#define NAS220_GE_OE_VAL_LOW (BIT(12) | BIT(14) | BIT(24) | BIT(28)) > +#define NAS220_GE_OE_VAL_HIGH (0) > + > int board_early_init_f(void) > { > /* > @@ -43,9 +48,9 @@ int board_early_init_f(void) > MPP9_TW_SCK, > MPP10_UART0_TXD, > MPP11_UART0_RXD, > - MPP12_GPO, > + MPP12_GPO, /* blue power led */ > MPP13_GPIO, > - MPP14_GPIO, > + MPP14_GPIO, /* board power */ > MPP15_SATA0_ACTn, > MPP16_SATA1_ACTn, > MPP17_SATA0_PRESENTn, > @@ -55,12 +60,12 @@ int board_early_init_f(void) > MPP21_GPIO, > MPP22_GPIO, > MPP23_GPIO, > - MPP24_GPIO, > + MPP24_GPIO, /* sata0 power */ > MPP25_GPIO, > - MPP26_GPIO, > + MPP26_GPIO, /* power button */ > MPP27_GPIO, > - MPP28_GPIO, > - MPP29_GPIO, > + MPP28_GPIO, /* sata1 power */ > + MPP29_GPIO, /* reset button */ > MPP30_GPIO, > MPP31_GPIO, > MPP32_GPIO, > @@ -73,6 +78,11 @@ int board_early_init_f(void) > return 0; > } > > +int board_eth_init(struct bd_info *bis) > +{ > + return cpu_eth_init(bis); > +} > + > int board_init(void) > { > /* > @@ -85,37 +95,3 @@ int board_init(void) > > return 0; > } > - > -#ifdef CONFIG_RESET_PHY_R > -/* Configure and enable MV88E1116 PHY */ > -void reset_phy(void) > -{ > - u16 reg; > - u16 devadr; > - char *name = "egiga0"; > - > - if (miiphy_set_current_dev(name)) > - return; > - > - /* command to read PHY dev address */ > - if (miiphy_read(name, 0xEE, 0xEE, (u16 *)&devadr)) { > - printf("Err..%s could not read PHY dev address\n", __func__); > - return; > - } > - > - /* > -* Enable RGMII delay on Tx and Rx for CPU port > -* Ref: sec 4.7.2 of chip datasheet > -*/ > - miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2); > - miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, ®); > - reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL); > - miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg); > - miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0); > - > - /* reset the phy */ > - miiphy_reset(name, devadr); > - > - printf("88E1116 Initialized on %s\n", name); > -} > -#endif /* CONFIG_RESET_PHY_R */ > diff --git a/configs/nas220_defcon
Re: [PATCH 0/4] mmc: zynq_sdhci: Add support for dynamic IP configuration
st 23. 2. 2022 v 15:36 odesílatel Michal Simek napsal: > > Hi, > > with SOM boards low level sdhci setting is not fully done. There are > additional registers which are normally programmed via psu_init() but in > this case they are not initialized. Information can be taken from DT and > via firmware interface that values can be setup and that's exactly what > this series is doing. > > Thanks, > Michal > > > Ashok Reddy Soma (4): > firmware: zynqmp: Add and update firmware enums > firmware: zynqmp: Add support for set sd config and is function > supported > lib: div64: Add support for round up of div64_u64 > mmc: zynq_sdhci: Add support for dynamic configuration > > drivers/firmware/firmware-zynqmp.c | 51 +++ > drivers/mmc/zynq_sdhci.c | 101 - > include/linux/math64.h | 3 + > include/zynqmp_firmware.h | 29 + > 4 files changed, 182 insertions(+), 2 deletions(-) > > -- > 2.35.1 > Applied. M -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
Re: [PATCH 0/2] xilinx: video: add skeleton drivers for zynqmp DP
st 23. 2. 2022 v 15:52 odesílatel Michal Simek napsal: > > Hi, > > add skeleton drivers for display port and display port DMA. The purpose of > having sketon drivers is to use the whole power domain infrastructure is > used. Without driver power domain driver is not asking for enabling power > for these devices. That's why having simple driver is necessary because OS > doesn't need to have a way to ask for enabling power for these devices. > > Thanks, > Michal > > > Michal Simek (2): > video: Add skeleton driver for ZynqMP Display port driver > dma: xilinx: Add Display Port DMA driver > > drivers/dma/Kconfig | 7 > drivers/dma/Makefile | 1 + > drivers/dma/xilinx_dpdma.c | 43 +++ > drivers/video/Kconfig| 8 + > drivers/video/Makefile | 1 + > drivers/video/zynqmp_dpsub.c | 66 > 6 files changed, 126 insertions(+) > create mode 100644 drivers/dma/xilinx_dpdma.c > create mode 100644 drivers/video/zynqmp_dpsub.c > > -- > 2.35.1 > applied. M -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
Re: [PATCH 0/3] i2c: i2c-cdns: Driver fixes
út 1. 3. 2022 v 9:16 odesílatel Michal Simek napsal: > > Hi, > > these 3 patches came from checking functionality on QEMU in connection to > SOM program. > > Thanks, > Michal > > > Sai Pavan Boddu (3): > i2c: i2c-cdns: Start read transaction after write to transfer_size reg > i2c: i2c-cdns: Fix write transaction state > i2c: i2c-cdns: Prevent early termination of write > > drivers/i2c/i2c-cdns.c | 18 +- > 1 file changed, 13 insertions(+), 5 deletions(-) > > -- > 2.35.1 > applied. M -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
Re: drivers: clk: stm32h7: Endless loop of dead in driver probe function
Hi Patrice! I have bricked my board. LOL. Hope I can recover it, when soldering BOOT0 to VDD. Solder Bridge 192 (SB192). Don't verified the power settings first in the clock driver. The current power configuration clears SCUEN. But on STM32H747, this disables the SMPS converter. Same bit position (SDEN) in PWR_CR3... On 09.03.22 09:08, Patrice CHOTARD wrote: > > > On 3/9/22 09:02, Johannes (krjdev) Krottmayer wrote: >> Hi Patrice! >> >> On 09.03.22 08:43, Patrice CHOTARD wrote: >>> Hi johannes >>> >>> On 3/9/22 08:24, Johannes (krjdev) Krottmayer wrote: Hi Patrick! Sorry, for my late response. :( On 08.03.22 10:00, Patrick DELAUNAY wrote:> Yes, the current clock driver for STM32 MCU is not perfect,> > as the all U-Boot and the Linux support on STM32 MCU.> > > For information, in the other driver based on a other version of RCC for > STM32 MPU > > STM32MP1 = clk_stm32mp1.c, it is correctly managed in > > stm32mp1_osc_wait(1, rcc, RCC_OCRDYR, RCC_OCRDYR_HSERDY); > > by using readl_poll_timeout() function. > > >> My possible fixes: >> At a timeout when reading the register and if the timeout is >> elapsed, print an error message and return with ETIMEDOUT, so >> the dm manger can call the hang() function. > > I agree, it is a correct management: at least indicate this hardware issue > > even if the rdy bit can't be stay at 0 in normal use case when HSE is > > present.> > => replace all while() in the RCC clock driver with readl_poll_timeout > > > but to call readl_poll_timeout(), the arch timer need to ready > > (timer_init() already called) when RCC clokc driver probe is executed. > > > An issue the I encounters on STM32MP need to be checked in MCU driver: > > the timer can't dependant of RCC probe when polling function is used. > > > This issue was solved in STM32MP by using the generic armv7 timer > > (only dependant of Cortex core) and call the initialization in > > arch/arm/mach-stm32mp/cpu.c: > > int arch_cpu_init(void) > { > > > /* early armv7 timer init: needed for polling */ > timer_init(); > > return 0; > } Is there any reason why not use the ARMv7-M SysTick Timer? There exists an initialization routine in the U-Boot source tree: >>> >>> Simply because when i introduced stm32h7 board, i didn't need it ;-) >>> arch/arm/cpu/armv4m/systick-timer.c The routines should work for Cortex-M3/M4/M7. timer_init() and all required functions for mdelay() which are will be called by the polling functions are implemented. Don't looked into other TRM's, other than for STM32H745/STM32H747 and STM32H755/STM32H757 yet, but according the TRM, the SysTick timer for the core Cortex-M7 should run at 8MHz, after reset: - HSI should be selected as system clock (sys_ck), running at 64MHz - Domain 1 prescaler (D1CPRE) with scale 1 - SysTick timer at default configuration (external source) which has a fixed prescale from 8, according the block schematic in TRM. Correct me please, if I'm wrong. > The timer management on MCU need to be check before any patch. Yes, but I can currently only test the correct behavior on a STM32H747I-DISCO board. Currently creating the device-tree for the SoC. > Can you propose something ? I would use the SysTick Timer on the other devices from the STM32H7 series too, so I would change the current code. Before I release a patch series here in the official mailing list, I would suggest, if some other developers or users can verify my modification on their real hardware. My GitHub repo: https://github.com/krjdev/stm32_u-boot (branch stm32h747_disco) That I can offer. :) >>> >>> I have a stm21h7xxi-disco (MB1248) i can give it a try this week. >>> I will keep you in touch. >> >> Please can you give me some additional time for this? The device-tree >> needs some fixes. Missing clocks and resets for the required driver. >> >> I will create a git tag, when I'm ready and I have tested to run >> U-Boot on my board. :) >> >> Working since sunday on the device-trees...Maybe tommorrow. :) > > No problem, i will wait your green light :-D > > Patrice > >> >>> Thanks >>> Patrice >>> Kind regards, Johannes >> >> Kind regards >> >> Johannes
Re: [PATCH] tools: zynqmp: add support for PM_CONFIG_OBJECT_TYPE_BASE define
On 3/7/22 17:27, Adrian Fiergolski wrote: The new define has been added in Vivado 2021.2. Signed-off-by: Adrian Fiergolski --- tools/zynqmp_pm_cfg_obj_convert.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/zynqmp_pm_cfg_obj_convert.py b/tools/zynqmp_pm_cfg_obj_convert.py index 0a44710e1e..239991a526 100755 --- a/tools/zynqmp_pm_cfg_obj_convert.py +++ b/tools/zynqmp_pm_cfg_obj_convert.py @@ -244,6 +244,8 @@ pm_define = { 'SUSPEND_TIMEOUT': 0x, +'PM_CONFIG_OBJECT_TYPE_BASE' : 0x1, + 'PM_CONFIG_IPI_PSU_CORTEXA53_0_MASK' : 0x0001, 'PM_CONFIG_IPI_PSU_CORTEXR5_0_MASK' : 0x0100, 'PM_CONFIG_IPI_PSU_CORTEXR5_1_MASK' : 0x0200, The same patch was sent by Luca already. https://lore.kernel.org/r/20220212125121.3398547-1-l...@lucaceresoli.net Thanks, Michal
Re: [PATCH] arm64: zynqmp: add support for zcu106 rev1.0
st 2. 3. 2022 v 15:12 odesílatel Michal Simek napsal: > > From: Neal Frager > > This patch adds psu_init for Xilinx ZCU106 rev1.0. Xilinx ZCU106 rev1.0 has > newer x16 DDR4 memories and it is SW compatible with revA. > > Signed-off-by: Neal Frager > Signed-off-by: Michal Simek > --- > > arch/arm/dts/Makefile | 1 + > arch/arm/dts/zynqmp-zcu106-rev1.0.dts | 16 + > .../zynqmp-zcu106-rev1.0/psu_init_gpl.c | 842 ++ > configs/xilinx_zynqmp_virt_defconfig | 2 +- > 4 files changed, 860 insertions(+), 1 deletion(-) > create mode 100644 arch/arm/dts/zynqmp-zcu106-rev1.0.dts > create mode 100644 board/xilinx/zynqmp/zynqmp-zcu106-rev1.0/psu_init_gpl.c > > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile > index 960f1a9fd4db..2edcb26d7c5b 100644 > --- a/arch/arm/dts/Makefile > +++ b/arch/arm/dts/Makefile > @@ -349,6 +349,7 @@ dtb-$(CONFIG_ARCH_ZYNQMP) += \ > zynqmp-zcu104-revA.dtb \ > zynqmp-zcu104-revC.dtb \ > zynqmp-zcu106-revA.dtb \ > + zynqmp-zcu106-rev1.0.dtb\ > zynqmp-zcu111-revA.dtb \ > zynqmp-zcu1275-revA.dtb \ > zynqmp-zcu1275-revB.dtb \ > diff --git a/arch/arm/dts/zynqmp-zcu106-rev1.0.dts > b/arch/arm/dts/zynqmp-zcu106-rev1.0.dts > new file mode 100644 > index ..f43c477a17fb > --- /dev/null > +++ b/arch/arm/dts/zynqmp-zcu106-rev1.0.dts > @@ -0,0 +1,16 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * dts file for Xilinx ZynqMP ZCU106 Rev1.0 > + * > + * (C) Copyright 2016 - 2022, Xilinx, Inc. > + * > + * Michal Simek > + */ > + > +#include "zynqmp-zcu106-revA.dts" > + > +/ { > + model = "ZynqMP ZCU106 Rev1.0"; > + compatible = "xlnx,zynqmp-zcu106-rev1.0", "xlnx,zynqmp-zcu106-revA", > +"xlnx,zynqmp-zcu106", "xlnx,zynqmp"; > +}; > diff --git a/board/xilinx/zynqmp/zynqmp-zcu106-rev1.0/psu_init_gpl.c > b/board/xilinx/zynqmp/zynqmp-zcu106-rev1.0/psu_init_gpl.c > new file mode 100644 > index ..2ac4e035d887 > --- /dev/null > +++ b/board/xilinx/zynqmp/zynqmp-zcu106-rev1.0/psu_init_gpl.c > @@ -0,0 +1,842 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * (c) Copyright 2015 Xilinx, Inc. All rights reserved. > + */ > + > +#include > +#include > + > +static unsigned long psu_pll_init_data(void) > +{ > + psu_mask_write(0xFF5E0034, 0xFE7FEDEFU, 0x7E4E2C62U); > + psu_mask_write(0xFF5E0030, 0x00717F00U, 0x00014600U); > + psu_mask_write(0xFF5E0030, 0x0008U, 0x0008U); > + psu_mask_write(0xFF5E0030, 0x0001U, 0x0001U); > + psu_mask_write(0xFF5E0030, 0x0001U, 0xU); > + mask_poll(0xFF5E0040, 0x0002U); > + psu_mask_write(0xFF5E0030, 0x0008U, 0xU); > + psu_mask_write(0xFF5E0048, 0x3F00U, 0x0200U); > + psu_mask_write(0xFF5E0024, 0xFE7FEDEFU, 0x7E4B0C82U); > + psu_mask_write(0xFF5E0020, 0x00717F00U, 0x00015A00U); > + psu_mask_write(0xFF5E0020, 0x0008U, 0x0008U); > + psu_mask_write(0xFF5E0020, 0x0001U, 0x0001U); > + psu_mask_write(0xFF5E0020, 0x0001U, 0xU); > + mask_poll(0xFF5E0040, 0x0001U); > + psu_mask_write(0xFF5E0020, 0x0008U, 0xU); > + psu_mask_write(0xFF5E0044, 0x3F00U, 0x0300U); > + psu_mask_write(0xFD1A0024, 0xFE7FEDEFU, 0x7E4B0C62U); > + psu_mask_write(0xFD1A0020, 0x00717F00U, 0x00014800U); > + psu_mask_write(0xFD1A0020, 0x0008U, 0x0008U); > + psu_mask_write(0xFD1A0020, 0x0001U, 0x0001U); > + psu_mask_write(0xFD1A0020, 0x0001U, 0xU); > + mask_poll(0xFD1A0044, 0x0001U); > + psu_mask_write(0xFD1A0020, 0x0008U, 0xU); > + psu_mask_write(0xFD1A0048, 0x3F00U, 0x0300U); > + psu_mask_write(0xFD1A0030, 0xFE7FEDEFU, 0x7E4B0C62U); > + psu_mask_write(0xFD1A002C, 0x00717F00U, 0x00014000U); > + psu_mask_write(0xFD1A002C, 0x0008U, 0x0008U); > + psu_mask_write(0xFD1A002C, 0x0001U, 0x0001U); > + psu_mask_write(0xFD1A002C, 0x0001U, 0xU); > + mask_poll(0xFD1A0044, 0x0002U); > + psu_mask_write(0xFD1A002C, 0x0008U, 0xU); > + psu_mask_write(0xFD1A004C, 0x3F00U, 0x0200U); > + psu_mask_write(0xFD1A003C, 0xFE7FEDEFU, 0x7E4B0C82U); > + psu_mask_write(0xFD1A0038, 0x00717F00U, 0x00015900U); > + psu_mask_write(0xFD1A0038, 0x0008U, 0x0008U); > + psu_mask_write(0xFD1A0038, 0x0001U, 0x0001U); > + psu_mask_write(0xFD1A0038, 0x0001U, 0xU); > + mask_poll(0xFD1A0044, 0x0004U); > + psu_mask_write(0xFD1A0038, 0x0008U, 0xU); > + psu_mask_write(0xFD1A0050, 0x3F00U, 0x0300U); > + psu_mask_write(0xFD1A0040, 0x8000U, 0x80008E69U); > + > + r
Re: [PATCH v3 08/19] dm: add tag support
Hi Akashi-san, > Signed-off-by: AKASHI Takahiro > Reviewed-by: Simon Glass > --- > drivers/core/Makefile | 2 +- > drivers/core/root.c | 2 + > drivers/core/tag.c| 139 ++ > include/asm-generic/global_data.h | 4 + > include/dm/tag.h | 110 +++ > 5 files changed, 256 insertions(+), 1 deletion(-) > create mode 100644 drivers/core/tag.c > create mode 100644 include/dm/tag.h > > diff --git a/drivers/core/Makefile b/drivers/core/Makefile > index 5edd4e413576..3742e7574525 100644 > --- a/drivers/core/Makefile > +++ b/drivers/core/Makefile > @@ -2,7 +2,7 @@ > # > # Copyright (c) 2013 Google, Inc > > -obj-y+= device.o fdtaddr.o lists.o root.o uclass.o util.o > +obj-y+= device.o fdtaddr.o lists.o root.o uclass.o util.o tag.o > obj-$(CONFIG_$(SPL_TPL_)ACPIGEN) += acpi.o > obj-$(CONFIG_DEVRES) += devres.o > obj-$(CONFIG_$(SPL_)DM_DEVICE_REMOVE)+= device-remove.o > diff --git a/drivers/core/root.c b/drivers/core/root.c > index 8efb4256b27e..86b3884fc674 100644 > --- a/drivers/core/root.c > +++ b/drivers/core/root.c > @@ -199,6 +199,8 @@ int dm_init(bool of_live) > return ret; > } > > + INIT_LIST_HEAD((struct list_head *)&gd->dmtag_list); > + > return 0; > } > > diff --git a/drivers/core/tag.c b/drivers/core/tag.c > new file mode 100644 > index ..6829bcd8806c > --- /dev/null > +++ b/drivers/core/tag.c > @@ -0,0 +1,139 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * Copyright (c) 2021 Linaro Limited > + * Author: AKASHI Takahiro > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +struct udevice; > + > +DECLARE_GLOBAL_DATA_PTR; > + > +int dev_tag_set_ptr(struct udevice *dev, enum dm_tag_t tag, void *ptr) > +{ > + struct dmtag_node *node; > + > + if (!dev || tag >= DM_TAG_COUNT) > + return -EINVAL; > + > + list_for_each_entry(node, &gd->dmtag_list, sibling) { > + if (node->dev == dev && node->tag == tag) > + return -EEXIST; > + } > + > + node = calloc(sizeof(*node), 1); > + if (!node) > + return -ENOSPC; Isn't -ENOMEM better here? > + > + node->dev = dev; > + node->tag = tag; > + node->ptr = ptr; > + list_add_tail(&node->sibling, (struct list_head *)&gd->dmtag_list); > + > + return 0; > +} > + > +int dev_tag_set_val(struct udevice *dev, enum dm_tag_t tag, ulong val) Is this used anywhere else apart from selftests? > +{ > + struct dmtag_node *node; Thanks /Ilias
Re: [PATCH] MAINTAINERS: Remove duplicated entry for ehci-zynq.c
po 7. 3. 2022 v 8:43 odesílatel Michal Simek napsal: > > ehci-zynq.c is assigned to Zynq and ZynqMP that's why remove one. > > Signed-off-by: Michal Simek > --- > > MAINTAINERS | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/MAINTAINERS b/MAINTAINERS > index bfddb66abc73..915316a86e95 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -658,7 +658,6 @@ F: drivers/soc/soc_xilinx_zynqmp.c > F: drivers/spi/zynq_qspi.c > F: drivers/spi/zynq_spi.c > F: drivers/timer/cadence-ttc.c > -F: drivers/usb/host/ehci-zynq.c > F: drivers/video/seps525.c > F: drivers/watchdog/cdns_wdt.c > F: include/zynqmppl.h > -- > 2.35.1 > Applied. M -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
Re: [PATCH 0/3] net: phy: Add support for ethernet-phy-id
st 23. 2. 2022 v 15:45 odesílatel Michal Simek napsal: > > Hi, > > this series is adding support for ethernet-phy-id with reset gpio support. > There is another series related to DM_ETH_PHY but it is missing creating > phy devices based on decoded phy IDs from compatible string. > We would like to adopt DM_ETH_PHY in our driver but still this series can > be useful for other drivers which are not DM_ETH_PHY ready. > At the end this same file should be used also for DM_ETH_PHY driver. > > The reason for complete separatation from phy.c is that there is > requirement for gpio headers which is not done by all arch. That's why new > symbol and separate file is the way to go. > > Thanks, > Michal > > > Michal Simek (3): > net: phy: Add new read ethernet phy id function > net: phy: Remove static return type for phy_device_create() > net: phy: Add support for ethernet-phy-id with gpio reset > > MAINTAINERS | 1 + > drivers/core/ofnode.c | 36 ++ > drivers/net/phy/Kconfig | 8 > drivers/net/phy/Makefile | 1 + > drivers/net/phy/ethernet_id.c | 69 +++ > drivers/net/phy/phy.c | 11 -- > include/dm/ofnode.h | 13 +++ > include/phy.h | 26 + > 8 files changed, 162 insertions(+), 3 deletions(-) > create mode 100644 drivers/net/phy/ethernet_id.c > > -- > 2.35.1 > Applied. M -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
Re: [PATCH v3 00/19] efi_loader: more tightly integrate UEFI disks to driver model
On 3/9/22 06:07, AKASHI Takahiro wrote: On Tue, Mar 08, 2022 at 08:10:01PM -0700, Simon Glass wrote: Hi Takahiro, On Tue, 8 Mar 2022 at 19:48, AKASHI Takahiro wrote: Hi Simon, On Tue, Mar 08, 2022 at 07:34:15PM -0700, Simon Glass wrote: Hi Takahiro, On Tue, 8 Mar 2022 at 19:10, AKASHI Takahiro wrote: Heinrich, Simon, On Tue, Mar 08, 2022 at 05:49:13PM +0100, Heinrich Schuchardt wrote: On 3/8/22 12:36, AKASHI Takahiro wrote: With this patch set[1] applied, UEFI subsystem maintains a list of its disk objects dynamically at runtime based on block device's probing. (See "issues" below.) [1]https://github.com/t-akashi/u-boot/tree/efi/dm_disk This series together with Simon's series breaks multiple boards due to size constraints: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/11197 Please, investigate how to work around this issue. I have already mentioned this size issue in my cover-letter in order to let reviewers aware of it and discuss a possible solution: ===8<=== Issues: === * The image size of U-Boot may increase. CI build test complains, for instance, rcar3_salvator-x: "u-boot.img exceeds file size limit: ... excess: 0x79c bytes" phycore-rk3288: "SPL image is too large (size 0x8800 than 0x8000)" See [2]. [2] https://dev.azure.com/u-boot/u-boot/_build/results?buildId=3770&view=results ===>8=== I have dug into rcar3_salvator-x case; I removed *all* the commits in this series and yet enabled CONFIG_EVENT, CONFIG_EVENT_DYNAMIC and CONFIG_DM_EVENT, which are all required for enabling my patch, with Simon's patch applied on top of v2022.04-rc3. Then I still see this size problem: ===8<=== ... MKIMAGE u-boot.img u-boot.img exceeds file size limit: limit: 0x10 bytes actual: 0x100036 bytes excess: 0x36 bytes ===>8=== So I have no way to deal with it. FYI, the combination of EVENT, EVENT_DYNAMIC and DM_EVENT will increase the binary size by up to 0x1b2 for rcar3_salvator-x and it seems the binary has almost already reached its maximum size even now. So you do need EVENT_DYNAMIC? Unfortunately, yes. When I rebased my patch set to your v2, I tried to use *static* bindings, but some of ut tests, including dm_test_blk_base and dm_test_blk_usb, failed. OK. Well maybe there is a filesystem in there that is not needed? 1MB is a huge size! Can we disable EFI_LOADER on that board? Well, EFI_LOADER is by default 'y' for arm64. Basically, I doubt that this default is reasonable. All major distros support booting via UEFI. Fedora and Suse have specifically opted to make this the preferred way to boot on ARM. Same is true for BSD. So why do you have doubts? Best regards Heinrich This can happen because, with static bindings, efi's callback function (efi_disk_probe) is unconditionally called even when UEFI subsystem has not been initialized yet. Yes, I have seen things like that too. -Takahiro Akashi Does it make sense to make enabling the partition support an option, instead of mandatory? What about this one? ^^ First of all, according to my rough attempt, the patches for adding efi_disk callback functions may increase the binary size by 0x31c, while the patches for adding UCLASS_PARTITION adds another 0x3ba. This means that "enabling the partition support an option" can help a bit but doesn't help well enough overall. FYI, adding dev_read/write(udev) interfaces costs another 0x1df. -Takahiro Akashi Regards, Simon
[PATCH v4 0/8] tpm: rng: Move TPM RNG functionality to driver model
The TPM device provides the random number generator(RNG) functionality, whereby sending a command to the TPM device results in the TPM device responding with random bytes. There was a discussion on the mailing list earlier[1], where it was explained that platforms with a TPM device can install the EFI_RNG_PROTOCOL for getting the random bytes instead of populating the dtb with the kaslr-seed property. That would make it possible to measure the dtb. This patchset moves the already existing functions for getting random bytes from the TPM device to drivers complying with the RNG uclass. This is done since the EFI_RNG_PROTOCOL's get_rng routine uses the RNG uclass's dm_rng_read api to get the random bytes. The TPM uclass driver adds the RNG child device as part of it's post_probe function. The TPM uclass driver's child_pre_probe function initialises the TPM parent device for use -- this enables the RNG child device to be used subsequently. Some additional changes have also been made to facilitate the use of the RNG devices, including extending the 'rng' command to take the RNG device as one of the command-line parameters. This series depends on a patch[2] from Simon Glass for moving the TPM device version detection functions to the tpm_api.h header as static inline functions. [1] - https://lore.kernel.org/u-boot/20220103120738.47835-1-ilias.apalodi...@linaro.org/ [2] - https://lore.kernel.org/u-boot/20220301001125.1554442-2-...@chromium.org/T/#u Changes since V3: * Move back the driver model interface for the TPM RNG devices under drivers/rng/ directory. * Add a rng read function for the tpm devices which calls the tpm*_get_random API's. * Pass the TPM device pointer to the tpm*_get_random API's from the TPM RNG drivers as suggested by Simon. * Build the RNG child addition only for the u-boot proper stage using the CONFIG_{SPL,TPL}_BUILD guards instead of CONFIG_TPM config which gets included in all stages. * Remove the child_pre_probe callback which was starting the TPM device based on review from Simon. Sughosh Ganu (8): tpm: rng: Change tpm_get_random to return an int tpm: Fix the return type of tpm_startup tpm: rng: Add driver model interface for TPM RNG device tpm: Add the RNG child device qemu: arm: Remove platform specific function to get RNG device cmd: rng: Add support for selecting RNG device doc: rng: Add documentation for the rng command test: rng: Add a UT testcase for the rng command board/emulation/qemu-arm/qemu-arm.c | 42 - cmd/Kconfig | 1 + cmd/rng.c | 31 +++-- doc/usage/index.rst | 1 + doc/usage/rng.rst | 25 + drivers/rng/Makefile| 2 ++ drivers/rng/tpm1_rng.c | 24 + drivers/rng/tpm2_rng.c | 23 drivers/tpm/tpm-uclass.c| 40 --- include/tpm-v1.h| 4 +-- include/tpm-v2.h| 4 +-- include/tpm_api.h | 6 ++--- lib/Kconfig | 1 + lib/tpm-v1.c| 16 ++- lib/tpm-v2.c| 9 --- lib/tpm_api.c | 28 ++- test/dm/rng.c | 29 17 files changed, 208 insertions(+), 78 deletions(-) create mode 100644 doc/usage/rng.rst create mode 100644 drivers/rng/tpm1_rng.c create mode 100644 drivers/rng/tpm2_rng.c -- 2.25.1
[PATCH v4 1/8] tpm: rng: Change tpm_get_random to return an int
The tpm random number generation functionality will be moved to the driver model. With that, the tpm_get_random function will call the common driver model api instead of separate functions for tpmv1 and tpmv2. Return an int instead of a u32 to comply with the return value of the driver model function. Signed-off-by: Sughosh Ganu Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since V3: None include/tpm_api.h | 4 ++-- lib/tpm_api.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/tpm_api.h b/include/tpm_api.h index 11aa14eb79..249a966942 100644 --- a/include/tpm_api.h +++ b/include/tpm_api.h @@ -274,9 +274,9 @@ u32 tpm_find_key_sha1(struct udevice *dev, const u8 auth[20], * @param dev TPM device * @param data output buffer for the random bytes * @param countsize of output buffer - * Return: return code of the operation + * Return: 0 if OK, -ve on error */ -u32 tpm_get_random(struct udevice *dev, void *data, u32 count); +int tpm_get_random(struct udevice *dev, void *data, u32 count); /** * tpm_finalise_physical_presence() - Finalise physical presence diff --git a/lib/tpm_api.c b/lib/tpm_api.c index 4ac4612c81..7d26ea2c3a 100644 --- a/lib/tpm_api.c +++ b/lib/tpm_api.c @@ -264,7 +264,7 @@ u32 tpm_get_permissions(struct udevice *dev, u32 index, u32 *perm) return -ENOSYS; } -u32 tpm_get_random(struct udevice *dev, void *data, u32 count) +int tpm_get_random(struct udevice *dev, void *data, u32 count) { if (tpm_is_v1(dev)) return tpm1_get_random(dev, data, count); -- 2.25.1
[PATCH v4 2/8] tpm: Fix the return type of tpm_startup
The tpm_startup function returns negative values for error conditions. Fix the return type of the function to a signed int instead of a u32. Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since V3: None include/tpm_api.h | 2 +- lib/tpm_api.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/tpm_api.h b/include/tpm_api.h index 249a966942..4d77a49719 100644 --- a/include/tpm_api.h +++ b/include/tpm_api.h @@ -18,7 +18,7 @@ * @param mode TPM startup mode * Return: return code of the operation */ -u32 tpm_startup(struct udevice *dev, enum tpm_startup_type mode); +int tpm_startup(struct udevice *dev, enum tpm_startup_type mode); /** * Issue a TPM_SelfTestFull command. diff --git a/lib/tpm_api.c b/lib/tpm_api.c index 7d26ea2c3a..da48058abe 100644 --- a/lib/tpm_api.c +++ b/lib/tpm_api.c @@ -11,7 +11,8 @@ #include #include -u32 tpm_startup(struct udevice *dev, enum tpm_startup_type mode) + +int tpm_startup(struct udevice *dev, enum tpm_startup_type mode) { if (tpm_is_v1(dev)) { return tpm1_startup(dev, mode); -- 2.25.1
[PATCH v4 4/8] tpm: Add the RNG child device
The TPM device comes with the random number generator(RNG) functionality which is built into the TPM device. Add logic to add the RNG child device in the TPM uclass post probe callback. The RNG device can then be used to pass a set of random bytes to the linux kernel, need for address space randomisation through the EFI_RNG_PROTOCOL interface. Signed-off-by: Sughosh Ganu --- Changes since V3: * Build the RNG child addition only for the u-boot proper stage using the CONFIG_{SPL,TPL}_BUILD guards instead of CONFIG_TPM config which gets included in all stages. * Remove the child_pre_probe callback which was starting the TPM device based on review from Simon. drivers/tpm/tpm-uclass.c | 40 lib/Kconfig | 1 + 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/drivers/tpm/tpm-uclass.c b/drivers/tpm/tpm-uclass.c index f67fe1019b..241ed01e68 100644 --- a/drivers/tpm/tpm-uclass.c +++ b/drivers/tpm/tpm-uclass.c @@ -11,10 +11,16 @@ #include #include #include +#include #include #include #include "tpm_internal.h" +#include + +#define TPM_RNG1_DRV_NAME "tpm1-rng" +#define TPM_RNG2_DRV_NAME "tpm2-rng" + int tpm_open(struct udevice *dev) { struct tpm_ops *ops = tpm_get_ops(dev); @@ -136,12 +142,38 @@ int tpm_xfer(struct udevice *dev, const uint8_t *sendbuf, size_t send_size, return 0; } +#if !IS_ENABLED(CONFIG_SPL_BUILD) && !IS_ENABLED(CONFIG_TPL_BUILD) +static int tpm_uclass_post_probe(struct udevice *dev) +{ + int ret; + const char *drv = tpm_is_v1(dev) ? + TPM_RNG1_DRV_NAME : TPM_RNG2_DRV_NAME; + struct udevice *child; + + ret = device_bind_driver(dev, drv, "tpm-rng0", &child); + if (ret == -ENOENT) { + log_err("No driver configured for tpm-rng device\n"); + return 0; + } + + if (ret) { + log_err("Unable to bind rng driver with the tpm-rng device\n"); + return ret; + } + + return 0; +} +#endif /* !CONFIG_SPL_BUILD && !CONFIG_TPL_BUILD */ + UCLASS_DRIVER(tpm) = { - .id = UCLASS_TPM, - .name = "tpm", - .flags = DM_UC_FLAG_SEQ_ALIAS, + .id = UCLASS_TPM, + .name = "tpm", + .flags = DM_UC_FLAG_SEQ_ALIAS, #if CONFIG_IS_ENABLED(OF_REAL) - .post_bind = dm_scan_fdt_dev, + .post_bind = dm_scan_fdt_dev, +#endif +#if !IS_ENABLED(CONFIG_SPL_BUILD) && !IS_ENABLED(CONFIG_TPL_BUILD) + .post_probe = tpm_uclass_post_probe, #endif .per_device_auto= sizeof(struct tpm_chip_priv), }; diff --git a/lib/Kconfig b/lib/Kconfig index 3c6fa99b1a..0f05c97afc 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -341,6 +341,7 @@ source lib/crypt/Kconfig config TPM bool "Trusted Platform Module (TPM) Support" depends on DM + select DM_RNG help This enables support for TPMs which can be used to provide security features for your board. The TPM can be connected via LPC or I2C -- 2.25.1
[PATCH v4 3/8] tpm: rng: Add driver model interface for TPM RNG device
The TPM device has a builtin random number generator(RNG) functionality. Expose the RNG functions of the TPM device to the driver model so that they can be used by the EFI_RNG_PROTOCOL if the protocol is installed. Also change the function arguments and return type of the random number functions to comply with the driver model api. Signed-off-by: Sughosh Ganu --- Changes since V3: * Move back the driver model interface for the TPM RNG devices under drivers/rng/ directory. * Add a rng read function for the tpm devices which calls the tpm*_get_random API's. * Pass the TPM device pointer to the tpm*_get_random API's from the TPM RNG drivers as suggested by Simon. drivers/rng/Makefile | 2 ++ drivers/rng/tpm1_rng.c | 24 drivers/rng/tpm2_rng.c | 23 +++ include/tpm-v1.h | 4 ++-- include/tpm-v2.h | 4 ++-- lib/tpm-v1.c | 16 +--- lib/tpm-v2.c | 9 + lib/tpm_api.c | 23 +++ 8 files changed, 86 insertions(+), 19 deletions(-) create mode 100644 drivers/rng/tpm1_rng.c create mode 100644 drivers/rng/tpm2_rng.c diff --git a/drivers/rng/Makefile b/drivers/rng/Makefile index 39f7ee3f03..c91e4e1701 100644 --- a/drivers/rng/Makefile +++ b/drivers/rng/Makefile @@ -10,3 +10,5 @@ obj-$(CONFIG_RNG_MSM) += msm_rng.o obj-$(CONFIG_RNG_STM32MP1) += stm32mp1_rng.o obj-$(CONFIG_RNG_ROCKCHIP) += rockchip_rng.o obj-$(CONFIG_RNG_IPROC200) += iproc_rng200.o +obj-$(CONFIG_TPM_V1) += tpm1_rng.o +obj-$(CONFIG_TPM_V2) += tpm2_rng.o diff --git a/drivers/rng/tpm1_rng.c b/drivers/rng/tpm1_rng.c new file mode 100644 index 00..b827e2d1c1 --- /dev/null +++ b/drivers/rng/tpm1_rng.c @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2022, Linaro Limited + */ + +#include +#include +#include + +static int rng_tpm1_random_read(struct udevice *dev, void *data, size_t count) +{ + return tpm1_get_random(dev->parent, data, count); +} + +static const struct dm_rng_ops tpm1_rng_ops = { + .read = rng_tpm1_random_read, +}; + +U_BOOT_DRIVER(tpm1_rng) = { + .name = "tpm1-rng", + .id = UCLASS_RNG, + .ops= &tpm1_rng_ops, +}; + diff --git a/drivers/rng/tpm2_rng.c b/drivers/rng/tpm2_rng.c new file mode 100644 index 00..bd1fd539f0 --- /dev/null +++ b/drivers/rng/tpm2_rng.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2022, Linaro Limited + */ + +#include +#include +#include + +static int rng_tpm2_random_read(struct udevice *dev, void *data, size_t count) +{ + return tpm2_get_random(dev->parent, data, count); +} + +static const struct dm_rng_ops tpm2_rng_ops = { + .read = rng_tpm2_random_read, +}; + +U_BOOT_DRIVER(tpm2_rng) = { + .name = "tpm2-rng", + .id = UCLASS_RNG, + .ops= &tpm2_rng_ops, +}; diff --git a/include/tpm-v1.h b/include/tpm-v1.h index 33d53fb695..d2ff8b446d 100644 --- a/include/tpm-v1.h +++ b/include/tpm-v1.h @@ -555,9 +555,9 @@ u32 tpm1_find_key_sha1(struct udevice *dev, const u8 auth[20], * @param dev TPM device * @param data output buffer for the random bytes * @param countsize of output buffer - * Return: return code of the operation + * Return: 0 if OK, -ve on error */ -u32 tpm1_get_random(struct udevice *dev, void *data, u32 count); +int tpm1_get_random(struct udevice *dev, void *data, size_t count); /** * tpm_finalise_physical_presence() - Finalise physical presence diff --git a/include/tpm-v2.h b/include/tpm-v2.h index e79c90b939..4fb1e7a948 100644 --- a/include/tpm-v2.h +++ b/include/tpm-v2.h @@ -619,9 +619,9 @@ u32 tpm2_pcr_setauthvalue(struct udevice *dev, const char *pw, * @param data output buffer for the random bytes * @param countsize of output buffer * - * Return: return code of the operation + * Return: 0 if OK, -ve on error */ -u32 tpm2_get_random(struct udevice *dev, void *data, u32 count); +int tpm2_get_random(struct udevice *dev, void *data, size_t count); /** * Lock data in the TPM diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c index 22a769c587..4c6bc31a64 100644 --- a/lib/tpm-v1.c +++ b/lib/tpm-v1.c @@ -9,12 +9,14 @@ #include #include #include -#include -#include +#include #include #include #include "tpm-utils.h" +#include +#include + #ifdef CONFIG_TPM_AUTH_SESSIONS #ifndef CONFIG_SHA1 @@ -869,7 +871,7 @@ u32 tpm1_find_key_sha1(struct udevice *dev, const u8 auth[20], #endif /* CONFIG_TPM_AUTH_SESSIONS */ -u32 tpm1_get_random(struct udevice *dev, void *data, u32 count) +int tpm1_get_random(struct udevice *dev, void *data, size_t count) { const u8 command[14] = { 0x0, 0xc1, /* TPM_TAG */ @@ -892,19 +894,19 @@ u32 tpm1_get_random(struct udevice *dev, void *data, u32 count) if (pack_byte_string(buf, sizeof(buf), "sd",
[PATCH v4 6/8] cmd: rng: Add support for selecting RNG device
The 'rng' u-boot command is used for printing a select number of random bytes on the console. Currently, the RNG device from which the random bytes are read is fixed. However, a platform can have multiple RNG devices, one example being qemu, which has a virtio RNG device and the RNG pseudo device through the TPM chip. Extend the 'rng' command so that the user can provide the RNG device number from which the random bytes are to be read. This will be the device index under the RNG uclass. Signed-off-by: Sughosh Ganu Tested-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- Changes since V3: None cmd/rng.c | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/cmd/rng.c b/cmd/rng.c index 1ad5a096c0..bb89cfa784 100644 --- a/cmd/rng.c +++ b/cmd/rng.c @@ -13,19 +13,34 @@ static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - size_t n = 0x40; + size_t n; struct udevice *dev; void *buf; + int devnum; int ret = CMD_RET_SUCCESS; - if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) { + switch (argc) { + case 1: + devnum = 0; + n = 0x40; + break; + case 2: + devnum = hextoul(argv[1], NULL); + n = 0x40; + break; + case 3: + devnum = hextoul(argv[1], NULL); + n = hextoul(argv[2], NULL); + break; + default: + return CMD_RET_USAGE; + } + + if (uclass_get_device(UCLASS_RNG, devnum, &dev) || !dev) { printf("No RNG device\n"); return CMD_RET_FAILURE; } - if (argc >= 2) - n = hextoul(argv[1], NULL); - buf = malloc(n); if (!buf) { printf("Out of memory\n"); @@ -46,12 +61,12 @@ static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #ifdef CONFIG_SYS_LONGHELP static char rng_help_text[] = - "[n]\n" - " - print n random bytes\n"; + "[dev [n]]\n" + " - print n random bytes read from dev\n"; #endif U_BOOT_CMD( - rng, 2, 0, do_rng, + rng, 3, 0, do_rng, "print bytes from the hardware random number generator", rng_help_text ); -- 2.25.1
[PATCH v4 5/8] qemu: arm: Remove platform specific function to get RNG device
The Qemu platform has a function defined to get the random number generator(RNG) device. However, the RNG device can be obtained simply by searching for a device belonging to the RNG uclass. Remove the superfluous platform function defined for the Qemu platform for getting the RNG device. Signed-off-by: Sughosh Ganu Tested-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since V3: None board/emulation/qemu-arm/qemu-arm.c | 42 - 1 file changed, 42 deletions(-) diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c index 16d5a97167..c9e886e44a 100644 --- a/board/emulation/qemu-arm/qemu-arm.c +++ b/board/emulation/qemu-arm/qemu-arm.c @@ -107,48 +107,6 @@ void enable_caches(void) dcache_enable(); } -#if defined(CONFIG_EFI_RNG_PROTOCOL) -#include -#include - -#include - -efi_status_t platform_get_rng_device(struct udevice **dev) -{ - int ret; - efi_status_t status = EFI_DEVICE_ERROR; - struct udevice *bus, *devp; - - for (uclass_first_device(UCLASS_VIRTIO, &bus); bus; -uclass_next_device(&bus)) { - for (device_find_first_child(bus, &devp); devp; -device_find_next_child(&devp)) { - if (device_get_uclass_id(devp) == UCLASS_RNG) { - *dev = devp; - status = EFI_SUCCESS; - break; - } - } - } - - if (status != EFI_SUCCESS) { - debug("No rng device found\n"); - return EFI_DEVICE_ERROR; - } - - if (*dev) { - ret = device_probe(*dev); - if (ret) - return EFI_DEVICE_ERROR; - } else { - debug("Couldn't get child device\n"); - return EFI_DEVICE_ERROR; - } - - return EFI_SUCCESS; -} -#endif /* CONFIG_EFI_RNG_PROTOCOL */ - #ifdef CONFIG_ARM64 #define __W"w" #else -- 2.25.1
[PATCH v4 8/8] test: rng: Add a UT testcase for the rng command
The 'rng' command dumps a number of random bytes on the console. Add a set of tests for the 'rng' command. The test function performs basic sanity testing of the command. Since a unit test is being added for the command, enable it by default in the sandbox platforms. Signed-off-by: Sughosh Ganu Reviewed-by: Simon Glass --- Changes since V3: None cmd/Kconfig | 1 + test/dm/rng.c | 29 + 2 files changed, 30 insertions(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index 5e25e45fd2..47f1e23ef0 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1810,6 +1810,7 @@ config CMD_GETTIME config CMD_RNG bool "rng command" depends on DM_RNG + default y if SANDBOX select HEXDUMP help Print bytes from the hardware random number generator. diff --git a/test/dm/rng.c b/test/dm/rng.c index 5b34c93ed6..6d1f68848d 100644 --- a/test/dm/rng.c +++ b/test/dm/rng.c @@ -25,3 +25,32 @@ static int dm_test_rng_read(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_rng_read, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + +/* Test the rng command */ +static int dm_test_rng_cmd(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_get_device(UCLASS_RNG, 0, &dev)); + ut_assertnonnull(dev); + + ut_assertok(console_record_reset_enable()); + + run_command("rng", 0); + ut_assert_nextlinen(":"); + ut_assert_nextlinen("0010:"); + ut_assert_nextlinen("0020:"); + ut_assert_nextlinen("0030:"); + ut_assert_console_end(); + + run_command("rng 0 10", 0); + ut_assert_nextlinen(":"); + ut_assert_console_end(); + + run_command("rng 20", 0); + ut_assert_nextlinen("No RNG device"); + ut_assert_console_end(); + + return 0; +} +DM_TEST(dm_test_rng_cmd, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); -- 2.25.1
[PATCH v4 7/8] doc: rng: Add documentation for the rng command
Add a usage document for the 'rng' u-boot command. Signed-off-by: Sughosh Ganu Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since V3: None doc/usage/index.rst | 1 + doc/usage/rng.rst | 25 + 2 files changed, 26 insertions(+) create mode 100644 doc/usage/rng.rst diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 0aacf531b2..5712a924ae 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -45,6 +45,7 @@ Shell commands pstore qfw reset + rng sbi sf scp03 diff --git a/doc/usage/rng.rst b/doc/usage/rng.rst new file mode 100644 index 00..87758f7d66 --- /dev/null +++ b/doc/usage/rng.rst @@ -0,0 +1,25 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +rng command +=== + +Synopsis + + +:: + +rng [devnum [n]] + +Description +--- + +The *rng* command reads the random number generator(RNG) device and +prints the random bytes read on the console. + +devnum +The RNG device from which the random bytes are to be +read. Defaults to 0. + +n +Number of random bytes to be read and displayed on the +console. Default value is 0x40. -- 2.25.1
Re: [PATCH v3] arm: kirkwood: nas220: Add DM Ethernet, SATA, GPIO
On 09.03.2022 at 12:26 Tony Dinh wrote: > Hi Hajo, > Hi Tony, > On Wed, Mar 9, 2022 at 1:27 AM Hajo Noerenberg > wrote: >> >> Bring the NAS220 board up to current standards. This is basically an >> adaptation of the changes Tony Dinh implemented for the Dockstar board. >> >> - Implement the changes to v2 as suggested by Stefan Roese >> - Add CONFIG_SUPPORT_PASSING_ATAGS et al, otherwise standard Debian >> flash-kernel pkg is unable to start kernel > > I believe CONFIG_SUPPORT_PASSING_ATAGS should no longer be needed. > Debian mainline kernels have been device-tree based for quite some > time. Perhaps it is the flash-kernel package that needs to be looked > at (maybe it failed to include the NAS220 DTB?). FWIW, I have been > running a custom Debian Kirkwood kernel (with other Kirkwood boards) > for many years with u-boots that don't have the ATAGS option enabled. > I personally am a big friend of distributions running without changes, i.e. no modified kernel or similar, and full update support for everything. So I vote to keep ATAGS support and change this later in line with the distribution. Note: My knowledge of ATAGS and so on is quite limited, so if in doubt I would follow your thoughts, but would like to consider the above. For reference, this is the relevant part from the flash-kernel database, other Kirkwood devices (e.g. Dockstar) seem to have different settings: Machine: Seagate Blackarmor NAS220 Kernel-Flavors: kirkwood marvell DTB-Id: kirkwood-blackarmor-nas220.dtb DTB-Append: yes Mtd-Kernel: uimage Mtd-Initrd: rootfs U-Boot-Kernel-Address: 0x0004 U-Boot-Initrd-Address: 0x0080 Required-Packages: u-boot-tools Machine: Seagate FreeAgent Dockstar Machine: Seagate FreeAgent DockStar Kernel-Flavors: kirkwood marvell DTB-Id: kirkwood-dockstar.dtb DTB-Append: yes U-Boot-Kernel-Address: 0x8000 U-Boot-Initrd-Address: 0x0 Boot-Kernel-Path: /boot/uImage Boot-Initrd-Path: /boot/uInitrd Boot-DTB-Path: /boot/dtb Required-Packages: u-boot-tools Kind regards, Hajo >> - Add CONFIG_SYS_64BIT_LBA, basic read tests with a 4TB hdd succeed with my >> NAS220 hardware >> >> - Thanks to Stefan and Tony >> >> >> Signed-off-by: Hajo Noerenberg >> --- >> board/Seagate/nas220/MAINTAINERS | 1 + >> board/Seagate/nas220/nas220.c| 68 +++- >> configs/nas220_defconfig | 16 +++- >> include/configs/nas220.h | 35 ++-- >> 4 files changed, 49 insertions(+), 71 deletions(-) >> >> diff --git a/board/Seagate/nas220/MAINTAINERS >> b/board/Seagate/nas220/MAINTAINERS >> index f2df7ea64f..6033f93cf4 100644 >> --- a/board/Seagate/nas220/MAINTAINERS >> +++ b/board/Seagate/nas220/MAINTAINERS >> @@ -4,3 +4,4 @@ S: Maintained >> F: board/Seagate/nas220/ >> F: include/configs/nas220.h >> F: configs/nas220_defconfig >> +F: arch/arm/dts/kirkwood-blackarmor-nas220.dts >> diff --git a/board/Seagate/nas220/nas220.c b/board/Seagate/nas220/nas220.c >> index cd2bbdad1c..fdbf321ff9 100644 >> --- a/board/Seagate/nas220/nas220.c >> +++ b/board/Seagate/nas220/nas220.c >> @@ -10,17 +10,22 @@ >> >> #include >> #include >> -#include >> -#include >> -#include >> -#include >> +#include >> +#include >> #include >> #include >> -#include >> -#include >> +#include >> +#include >> +#include >> >> DECLARE_GLOBAL_DATA_PTR; >> >> +/* blue power led, board power, sata0, sata1 */ >> +#define NAS220_GE_OE_LOW (~(BIT(12) | BIT(14) | BIT(24) | BIT(28))) >> +#define NAS220_GE_OE_HIGH (~(0)) >> +#define NAS220_GE_OE_VAL_LOW (BIT(12) | BIT(14) | BIT(24) | BIT(28)) >> +#define NAS220_GE_OE_VAL_HIGH (0) >> + >> int board_early_init_f(void) >> { >> /* >> @@ -43,9 +48,9 @@ int board_early_init_f(void) >> MPP9_TW_SCK, >> MPP10_UART0_TXD, >> MPP11_UART0_RXD, >> - MPP12_GPO, >> + MPP12_GPO, /* blue power led */ >> MPP13_GPIO, >> - MPP14_GPIO, >> + MPP14_GPIO, /* board power */ >> MPP15_SATA0_ACTn, >> MPP16_SATA1_ACTn, >> MPP17_SATA0_PRESENTn, >> @@ -55,12 +60,12 @@ int board_early_init_f(void) >> MPP21_GPIO, >> MPP22_GPIO, >> MPP23_GPIO, >> - MPP24_GPIO, >> + MPP24_GPIO, /* sata0 power */ >> MPP25_GPIO, >> - MPP26_GPIO, >> + MPP26_GPIO, /* power button */ >> MPP27_GPIO, >> - MPP28_GPIO, >> - MPP29_GPIO, >> + MPP28_GPIO, /* sata1 power */ >> + MPP29_GPIO, /* reset button */ >> MPP30_GPIO, >> MPP31_GPIO, >> MPP32_GPIO, >> @@ -73,6 +78,11 @@ int board_early_init_f(void) >> return 0; >> } >> >> +int board_eth_init(struct bd_info *bis) >> +{ >> +
Re: [PATCH V3] dt-bindings: nvmem: add U-Boot environment variables binding
On 2/28/22 14:12, Rafał Miłecki wrote: From: Rafał Miłecki U-Boot uses environment variables for storing device setup data. It usually needs to be accessed by a bootloader, kernel and often user-space. This binding allows describing environment data located in a raw flash partition. It's treated as NVMEM device and can be reused later for other storage devices. Using DT should be cleaner than hardcoding & duplicating such info in multiple places. Bootloader & kernel can share DTS and user-space can try reading it too or just have correct data exposed by a kernel. A custom "compatible" string allows system to automatically load relevant NVMEM driver but phandle can be also used for reading raw location. Signed-off-by: Rafał Miłecki --- V2: Update descriptions to don't make this binding MTD (flash partition) specific. Mention multiple possible storage ways. V3: Drop allOf: - $ref: nvmem.yaml# as we don't use anything rom the nvmem.yaml. Thanks Rob. --- .../devicetree/bindings/nvmem/u-boot,env.yaml | 62 +++ MAINTAINERS | 5 ++ 2 files changed, 67 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/u-boot,env.yaml diff --git a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml new file mode 100644 index ..e70b2a60cb9a --- /dev/null +++ b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml @@ -0,0 +1,62 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/u-boot,env.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: U-Boot environment variables + +description: | + U-Boot uses environment variables to store device parameters and + configuration. They may be used for booting process, setup or keeping end user + info. + + Data is stored using U-Boot specific formats (variant specific header and NUL + separated key-value pairs). + + Environment data can be stored on various storage entities, e.g.: + 1. Raw flash partition + 2. UBI volume + + This binding allows marking storage device (as containing env data) and + specifying used format. + + Right now only flash partition case is covered but it may be extended to e.g. + UBI volumes in the future. + +maintainers: + - Rafał Miłecki + +properties: + compatible: +oneOf: + - description: A standalone env data block +const: u-boot,env + - description: Two redundant blocks with active one flagged +const: u-boot,env-redundant-bool + - description: Two redundant blocks with active having higher counter +const: u-boot,env-redundant-count + + reg: +maxItems: 1 + +additionalProperties: false + +examples: + - | +partitions { +compatible = "fixed-partitions"; +#address-cells = <1>; +#size-cells = <1>; + +partition@0 { +reg = <0x0 0x4>; +label = "u-boot"; +read-only; +}; + +env: partition@4 { +compatible = "u-boot,env"; +reg = <0x4 0x1>; +}; +}; diff --git a/MAINTAINERS b/MAINTAINERS index db8052bc1d26..24fc181a7e6c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19958,6 +19958,11 @@ W: http://linuxtv.org T:git git://linuxtv.org/media_tree.git F:drivers/media/pci/tw686x/ +U-BOOT ENVIRONMENT VARIABLES +M: Rafał Miłecki +S: Maintained +F: Documentation/devicetree/bindings/nvmem/u-boot,env.yaml + UACCE ACCELERATOR FRAMEWORK M:Zhangfei Gao M:Zhou Wang I think that parsing these partitions is quite sw intensive process and I can't still see the value to have compatible string here. I would prefer to have just any link from u-boot node to partition instead. But up to Simon or Tom to decide. Thanks, Michal
Re: [RFC PATCH v3 1/2] efi_loader: introduce "bootefi bootindex" command
Hi Kojima-san On Wed, Mar 09, 2022 at 11:35:57AM +0900, Takahiro Akashi wrote: > On Wed, Mar 09, 2022 at 09:47:25AM +0900, Masahisa Kojima wrote: > > On Tue, 8 Mar 2022 at 23:17, Takahiro Akashi > > wrote: > > > > > > On Tue, Mar 08, 2022 at 11:07:44PM +0900, Masahisa Kojima wrote: > > > > This commit introduces the new command "bootefi bootindex". > > > > With this command, user can select which "Boot" option > > > > to load and execute. > > > > > > You can do the same thing with: > > > $ efidebug boot next 1 (for BOOT0001) > > > $ bootefi bootmgr > > > > Thank you for the information, it is good to know. > > My only concern is that user needs to enable "efidebug" command > > for this case, since efidebug implies that it is for debug purpose. > > Yeah, that is the point where I and ex-maintainer have never agreed. > So we have no standard UI for UEFI subsystem on U-Boot until now. > > Just FYI, we can do the same thing in yet another way :) > => env set -e -nv -bs -rt BootNext =0x0001 > > Similarly, BootOrder as well. > > -Takahiro Akashi I also think it's safe to drop this patch. It's indeed an easier way to load a specific boot index, however the use of bootnext is clearly defined in the spec. I don't think we need to increase the EFI code more as long as it's clear to anyone that setting bootnext (note here it has to be set on each reboot) would have the same result. Cheers /Ilias > > > Thanks, > > Masahisa Kojima > > > > > > > > -Takahiro Akashi > > > > > > > > > > Signed-off-by: Masahisa Kojima > > > > --- > > > > Changes in v3: > > > > - newly created > > > > > > > > cmd/bootefi.c| 42 > > > > include/efi_loader.h | 1 + > > > > lib/efi_loader/efi_bootmgr.c | 7 +++--- > > > > 3 files changed, 46 insertions(+), 4 deletions(-) > > > > > > > > diff --git a/cmd/bootefi.c b/cmd/bootefi.c > > > > index 46eebd5ee2..df86438fec 100644 > > > > --- a/cmd/bootefi.c > > > > +++ b/cmd/bootefi.c > > > > @@ -416,6 +416,30 @@ static int do_efibootmgr(void) > > > > return CMD_RET_SUCCESS; > > > > } > > > > > > > > +/** > > > > + * do_efibootindex() - load and execute the specified Boot option > > > > + * > > > > + * Return: status code > > > > + */ > > > > +static int do_efibootindex(u16 boot_index) > > > > +{ > > > > + efi_handle_t handle; > > > > + efi_status_t ret; > > > > + void *load_options; > > > > + > > > > + ret = efi_try_load_entry(boot_index, &handle, &load_options); > > > > + if (ret != EFI_SUCCESS) { > > > > + log_notice("EFI boot manager: failed to load Boot%04X\n", > > > > boot_index); > > > > + return CMD_RET_FAILURE; > > > > + } > > > > + > > > > + ret = do_bootefi_exec(handle, load_options); > > > > + > > > > + if (ret != EFI_SUCCESS) > > > > + return CMD_RET_FAILURE; > > > > + > > > > + return CMD_RET_SUCCESS; > > > > +} > > > > /** > > > > * do_bootefi_image() - execute EFI binary > > > > * > > > > @@ -654,6 +678,22 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int > > > > flag, int argc, > > > > return CMD_RET_FAILURE; > > > > } > > > > > > > > + if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) { > > > > + if (!strcmp(argv[1], "bootindex")) { > > > > + char *endp; > > > > + int boot_index; > > > > + > > > > + if (argc < 3) > > > > + return CMD_RET_USAGE; > > > > + > > > > + boot_index = (int)hextoul(argv[2], &endp); > > > > + if (*endp != '\0' || boot_index > 0x) > > > > + return CMD_RET_USAGE; > > > > + > > > > + return do_efibootindex((u16)boot_index); > > > > + } > > > > + } > > > > + > > > > if (argc > 2) { > > > > uintptr_t fdt_addr; > > > > > > > > @@ -702,6 +742,8 @@ static char bootefi_help_text[] = > > > > "\n" > > > > "If specified, the device tree located at > > > > gets\n" > > > > "exposed as EFI configuration table.\n" > > > > + "bootefi bootindex \n" > > > > + " - load and boot EFI payload based on the specified Boot > > > > variable.\n" > > > > #endif > > > > ; > > > > #endif > > > > diff --git a/include/efi_loader.h b/include/efi_loader.h > > > > index 80a5f1ec01..e5972f5fee 100644 > > > > --- a/include/efi_loader.h > > > > +++ b/include/efi_loader.h > > > > @@ -861,6 +861,7 @@ efi_status_t efi_set_load_options(efi_handle_t > > > > handle, > > > > efi_uintn_t load_options_size, > > > > void *load_options); > > > > efi_status_t efi_bootmgr_load(efi_handle_t *handle, void > > > > **load_options); > > > > +efi_status_t efi_try_load_entry(u16 n, efi_handle_t *handle, void > > > > **load_options); > > > > > > > > /** > > > > * struct efi_image_regi
[PATCH] doc: device-tree-bindings: watchdog: document common properties
Adds simple documentation about common properties for watchdog in the device tree. Signed-off-by: Philippe Reynes --- doc/device-tree-bindings/watchdog/common.txt | 12 1 file changed, 12 insertions(+) create mode 100644 doc/device-tree-bindings/watchdog/common.txt diff --git a/doc/device-tree-bindings/watchdog/common.txt b/doc/device-tree-bindings/watchdog/common.txt new file mode 100644 index 00..9db6dd6146 --- /dev/null +++ b/doc/device-tree-bindings/watchdog/common.txt @@ -0,0 +1,12 @@ +Common watchdog properties. + +Optional properties: +- timeout-sec : Timeout of the watchdog in seconds +If this timeout is not defined, the value of WATCHDOG_TIMEOUT_MSECS will +be used instead. +- hw_margin_ms : Period used to reset the watchdog in ms + If this period is not defined, the default value is 1000. +- u-boot,noautostart : Specify that this watchdog should not autostart + When the config option WATCHDOG_AUTOSTART is set, all enabled + watchdogs are started. This property allows specifying that this + watchdog should NOT be started. -- 2.17.1
[PATCH 0/3] Support any-salt for padding pss verification
This patchset does add support for any salt length in function padding_pss_verify which currently supports only max salt-length option. The fix is preceded by two changes to enhance memory consumption and const-correctness in the area of the patch. - Hermann Gioja - SESA644425 (3): lib: rsa: Fix const-correctness of rsassa_pss functions lib: rsa: Leverage existing data buffer instead of systematic copy lib: rsa: Update function padding_pss_verify (any-salt) include/image.h | 2 +- include/u-boot/rsa.h | 4 +-- lib/rsa/rsa-verify.c | 64 +++- 3 files changed, 36 insertions(+), 34 deletions(-) base-commit: 6d3c46ed0e230d999c3f20f7fd4f3a88c03b14ca -- 2.25.1
[PATCH 1/3] lib: rsa: Fix const-correctness of rsassa_pss functions
Prior to introduction of modifications in rsassa_pss functions related to padding verification, doing a pass to update const-correctness in targeted functions to comply with coding-rules and avoid const-cast Signed-off-by: SESA644425 --- Despite checkpath.pl recommendation, it is not possible to use u8 instead of uint8_t. Proceeding with u8 breaks build with error: unknown type name u8 include/image.h | 2 +- include/u-boot/rsa.h | 4 ++-- lib/rsa/rsa-verify.c | 14 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/image.h b/include/image.h index 97e5f2eb24..bea93118f8 100644 --- a/include/image.h +++ b/include/image.h @@ -1291,7 +1291,7 @@ ll_entry_declare(struct crypto_algo, __name, cryptos) struct padding_algo { const char *name; int (*verify)(struct image_sign_info *info, - uint8_t *pad, int pad_len, + const uint8_t *pad, int pad_len, const uint8_t *hash, int hash_len); }; diff --git a/include/u-boot/rsa.h b/include/u-boot/rsa.h index b9634e38d9..085363eb1e 100644 --- a/include/u-boot/rsa.h +++ b/include/u-boot/rsa.h @@ -101,11 +101,11 @@ int rsa_verify_with_pkey(struct image_sign_info *info, const void *hash, uint8_t *sig, uint sig_len); int padding_pkcs_15_verify(struct image_sign_info *info, - uint8_t *msg, int msg_len, + const uint8_t *msg, int msg_len, const uint8_t *hash, int hash_len); int padding_pss_verify(struct image_sign_info *info, - uint8_t *msg, int msg_len, + const uint8_t *msg, int msg_len, const uint8_t *hash, int hash_len); #define RSA_DEFAULT_PADDING_NAME "pkcs-1.5" diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c index 112664059c..c2c7248f90 100644 --- a/lib/rsa/rsa-verify.c +++ b/lib/rsa/rsa-verify.c @@ -73,7 +73,7 @@ static int rsa_verify_padding(const uint8_t *msg, const int pad_len, } int padding_pkcs_15_verify(struct image_sign_info *info, - uint8_t *msg, int msg_len, + const uint8_t *msg, int msg_len, const uint8_t *hash, int hash_len) { struct checksum_algo *checksum = info->checksum; @@ -125,7 +125,7 @@ static void u32_i2osp(uint32_t val, uint8_t *buf) * Return: 0 if the octet string was correctly generated, others on error */ static int mask_generation_function1(struct checksum_algo *checksum, -uint8_t *seed, int seed_len, +const uint8_t *seed, int seed_len, uint8_t *output, int output_len) { struct image_region region[2]; @@ -176,9 +176,9 @@ out: } static int compute_hash_prime(struct checksum_algo *checksum, - uint8_t *pad, int pad_len, - uint8_t *hash, int hash_len, - uint8_t *salt, int salt_len, + const uint8_t *pad, int pad_len, + const uint8_t *hash, int hash_len, + const uint8_t *salt, int salt_len, uint8_t *hprime) { struct image_region region[3]; @@ -215,7 +215,7 @@ out: * @hash_len: Length of the hash */ int padding_pss_verify(struct image_sign_info *info, - uint8_t *msg, int msg_len, + const uint8_t *msg, int msg_len, const uint8_t *hash, int hash_len) { uint8_t *masked_db = NULL; @@ -287,7 +287,7 @@ int padding_pss_verify(struct image_sign_info *info, /* step 12 & 13 */ compute_hash_prime(checksum, pad_zero, 8, - (uint8_t *)hash, hash_len, + hash, hash_len, salt, salt_len, hprime); /* step 14 */ -- 2.25.1
[PATCH 2/3] lib: rsa: Leverage existing data buffer instead of systematic copy
Prior to introduction of modifications in rsassa_pss functions related to padding verification, doing a pass to reduce memory consumption of function by replacing memory copies of parts of const buffer by pointers to the original buffer (masked_db and h are subparts of msg buffer which is declared const, salt is a subpart of db which is a working buffer, unmodified after being filled). New pointers scope is limited to the function where they are declared (not returned to caller by any mean), zeroing risk of memory fault related to the change. Signed-off-by: SESA644425 --- Despite checkpath.pl recommendation, it is not possible to use u8 instead of uint8_t. Proceeding with u8 breaks build with error: unknown type name u8 lib/rsa/rsa-verify.c | 37 ++--- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c index c2c7248f90..de71234cfb 100644 --- a/lib/rsa/rsa-verify.c +++ b/lib/rsa/rsa-verify.c @@ -208,6 +208,10 @@ out: * saltlen:-1 "set the salt length to the digest length" is currently * not supported. * + * msg is a concatenation of : masked_db + h + 0xbc + * Once unmasked, db is a concatenation of : [0x00]* + 0x01 + salt + * Length of 0-padding at begin of db depends on salt length. + * * @info: Specifies key and FIT information * @msg: byte array of message, len equal to msg_len * @msg_len: Message length @@ -218,27 +222,25 @@ int padding_pss_verify(struct image_sign_info *info, const uint8_t *msg, int msg_len, const uint8_t *hash, int hash_len) { - uint8_t *masked_db = NULL; - int masked_db_len = msg_len - hash_len - 1; - uint8_t *h = NULL, *hprime = NULL; - int h_len = hash_len; + const uint8_t *masked_db = NULL; uint8_t *db_mask = NULL; - int db_mask_len = masked_db_len; - uint8_t *db = NULL, *salt = NULL; - int db_len = masked_db_len, salt_len = msg_len - hash_len - 2; + uint8_t *db = NULL; + int db_len = msg_len - hash_len - 1; + const uint8_t *h = NULL; + uint8_t *hprime = NULL; + int h_len = hash_len; + uint8_t *salt = NULL; + int salt_len = msg_len - hash_len - 2; uint8_t pad_zero[8] = { 0 }; int ret, i, leftmost_bits = 1; uint8_t leftmost_mask; struct checksum_algo *checksum = info->checksum; /* first, allocate everything */ - masked_db = malloc(masked_db_len); - h = malloc(h_len); - db_mask = malloc(db_mask_len); + db_mask = malloc(db_len); db = malloc(db_len); - salt = malloc(salt_len); hprime = malloc(hash_len); - if (!masked_db || !h || !db_mask || !db || !salt || !hprime) { + if (!db_mask || !db || !hprime) { printf("%s: can't allocate some buffer\n", __func__); ret = -ENOMEM; goto out; @@ -252,8 +254,8 @@ int padding_pss_verify(struct image_sign_info *info, } /* step 5 */ - memcpy(masked_db, msg, masked_db_len); - memcpy(h, msg + masked_db_len, h_len); + masked_db = &msg[0]; + h = &msg[db_len]; /* step 6 */ leftmost_mask = (0xff >> (8 - leftmost_bits)) << (8 - leftmost_bits); @@ -265,7 +267,7 @@ int padding_pss_verify(struct image_sign_info *info, } /* step 7 */ - mask_generation_function1(checksum, h, h_len, db_mask, db_mask_len); + mask_generation_function1(checksum, h, h_len, db_mask, db_len); /* step 8 */ for (i = 0; i < db_len; i++) @@ -283,7 +285,7 @@ int padding_pss_verify(struct image_sign_info *info, } /* step 11 */ - memcpy(salt, &db[1], salt_len); + salt = &db[1]; /* step 12 & 13 */ compute_hash_prime(checksum, pad_zero, 8, @@ -295,11 +297,8 @@ int padding_pss_verify(struct image_sign_info *info, out: free(hprime); - free(salt); free(db); free(db_mask); - free(h); - free(masked_db); return ret; } -- 2.25.1
[PATCH 3/3] lib: rsa: Update function padding_pss_verify (any-salt)
Modify function to support any salt length instead of max length only. Function now detects salt length by parsing the content of db buffer. Note that it works with (but is not limited to) zero-length, digest-length and max-length Signed-off-by: SESA644425 --- Despite checkpath.pl recommendation, it is not possible to use u8 instead of uint8_t. Proceeding with u8 breaks build with error: unknown type name u8 lib/rsa/rsa-verify.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c index de71234cfb..1d95cfbdee 100644 --- a/lib/rsa/rsa-verify.c +++ b/lib/rsa/rsa-verify.c @@ -204,9 +204,7 @@ out: /* * padding_pss_verify() - verify the pss padding of a signature * - * Only works with a rsa_pss_saltlen:-2 (default value) right now - * saltlen:-1 "set the salt length to the digest length" is currently - * not supported. + * Works with any salt length * * msg is a concatenation of : masked_db + h + 0xbc * Once unmasked, db is a concatenation of : [0x00]* + 0x01 + salt @@ -229,8 +227,8 @@ int padding_pss_verify(struct image_sign_info *info, const uint8_t *h = NULL; uint8_t *hprime = NULL; int h_len = hash_len; - uint8_t *salt = NULL; - int salt_len = msg_len - hash_len - 2; + uint8_t *db_nopad = NULL, *salt = NULL; + int db_padlen, salt_len; uint8_t pad_zero[8] = { 0 }; int ret, i, leftmost_bits = 1; uint8_t leftmost_mask; @@ -277,15 +275,20 @@ int padding_pss_verify(struct image_sign_info *info, db[0] &= 0xff >> leftmost_bits; /* step 10 */ - if (db[0] != 0x01) { + db_padlen = 0; + while (db[db_padlen] == 0x00 && db_padlen < (db_len - 1)) + db_padlen++; + db_nopad = &db[db_padlen]; + if (db_nopad[0] != 0x01) { printf("%s: invalid pss padding ", __func__); - printf("(leftmost byte of db isn't 0x01)\n"); + printf("(leftmost byte of db after 0-padding isn't 0x01)\n"); ret = EINVAL; goto out; } /* step 11 */ - salt = &db[1]; + salt_len = db_len - db_padlen - 1; + salt = &db_nopad[1]; /* step 12 & 13 */ compute_hash_prime(checksum, pad_zero, 8, -- 2.25.1
Re: [PATCH V3] dt-bindings: nvmem: add U-Boot environment variables binding
On 9.03.2022 14:42, Michal Simek wrote: On 2/28/22 14:12, Rafał Miłecki wrote: From: Rafał Miłecki U-Boot uses environment variables for storing device setup data. It usually needs to be accessed by a bootloader, kernel and often user-space. This binding allows describing environment data located in a raw flash partition. It's treated as NVMEM device and can be reused later for other storage devices. Using DT should be cleaner than hardcoding & duplicating such info in multiple places. Bootloader & kernel can share DTS and user-space can try reading it too or just have correct data exposed by a kernel. A custom "compatible" string allows system to automatically load relevant NVMEM driver but phandle can be also used for reading raw location. Signed-off-by: Rafał Miłecki --- V2: Update descriptions to don't make this binding MTD (flash partition) specific. Mention multiple possible storage ways. V3: Drop allOf: - $ref: nvmem.yaml# as we don't use anything rom the nvmem.yaml. Thanks Rob. --- .../devicetree/bindings/nvmem/u-boot,env.yaml | 62 +++ MAINTAINERS | 5 ++ 2 files changed, 67 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/u-boot,env.yaml diff --git a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml new file mode 100644 index ..e70b2a60cb9a --- /dev/null +++ b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml @@ -0,0 +1,62 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/u-boot,env.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: U-Boot environment variables + +description: | + U-Boot uses environment variables to store device parameters and + configuration. They may be used for booting process, setup or keeping end user + info. + + Data is stored using U-Boot specific formats (variant specific header and NUL + separated key-value pairs). + + Environment data can be stored on various storage entities, e.g.: + 1. Raw flash partition + 2. UBI volume + + This binding allows marking storage device (as containing env data) and + specifying used format. + + Right now only flash partition case is covered but it may be extended to e.g. + UBI volumes in the future. + +maintainers: + - Rafał Miłecki + +properties: + compatible: + oneOf: + - description: A standalone env data block + const: u-boot,env + - description: Two redundant blocks with active one flagged + const: u-boot,env-redundant-bool + - description: Two redundant blocks with active having higher counter + const: u-boot,env-redundant-count + + reg: + maxItems: 1 + +additionalProperties: false + +examples: + - | + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x4>; + label = "u-boot"; + read-only; + }; + + env: partition@4 { + compatible = "u-boot,env"; + reg = <0x4 0x1>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index db8052bc1d26..24fc181a7e6c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19958,6 +19958,11 @@ W: http://linuxtv.org T: git git://linuxtv.org/media_tree.git F: drivers/media/pci/tw686x/ +U-BOOT ENVIRONMENT VARIABLES +M: Rafał Miłecki +S: Maintained +F: Documentation/devicetree/bindings/nvmem/u-boot,env.yaml + UACCE ACCELERATOR FRAMEWORK M: Zhangfei Gao M: Zhou Wang I think that parsing these partitions is quite sw intensive process and I can't still see the value to have compatible string here. I would prefer to have just any link from u-boot node to partition instead. But up to Simon or Tom to decide. In the first place DT should describe hardware / platform / device as it is. Without taking shortcuts. If environment data can be stored in flash device partition it should be described exactly as that. Systems like Linux can benefit from that. If some systems (e.g. a bootloader - U-Boot or any other one) can't afford parsing / covering whole DT structure due to some limitations - then we can come with helpers. I've no objections here. In dt-schema [1] we have place for U-Boot specific options. Please see 0986f729eff0 ("dt-bindings: u-boot: Add an initial binding for config"). We can add support e.g. for u-boot { (...) u-boot,env = <&env>; }; [1] https://github.com/devicetree-org/dt-schema [2] https://github.com/devicetree-org/dt-schema/commit/0986f729eff0f40a66e85ab9dfb37681bf025ac4
Re: [PATCH v3 00/19] efi_loader: more tightly integrate UEFI disks to driver model
On Tue, Mar 08, 2022 at 08:10:38PM -0700, Simon Glass wrote: > Hi Tom, > > On Tue, 8 Mar 2022 at 20:00, Tom Rini wrote: > > > > On Tue, Mar 08, 2022 at 07:32:59PM -0700, Simon Glass wrote: > > > Hi Tom, > > > > > > On Tue, 8 Mar 2022 at 17:13, Tom Rini wrote: > > > > > > > > On Tue, Mar 08, 2022 at 02:20:15PM -0700, Simon Glass wrote: > > > > > Hi Soeren, > > > > > > > > > > On Tue, 8 Mar 2022 at 12:15, Soeren Moch wrote: > > > > > > > > > > > > > > > > > > > > > > > > On 08.03.22 17:56, Simon Glass wrote: > > > > > > > Hi, > > > > > > > > > > > > > > On Tue, 8 Mar 2022 at 09:49, Heinrich Schuchardt > > > > > > > wrote: > > > > > > >> > > > > > > >> On 3/8/22 12:36, AKASHI Takahiro wrote: > > > > > > >>> With this patch set[1] applied, UEFI subsystem maintains a list > > > > > > >>> of its > > > > > > >>> disk objects dynamically at runtime based on block device's > > > > > > >>> probing. > > > > > > >>> (See "issues" below.) > > > > > > >>> > > > > > > >>> [1]https://github.com/t-akashi/u-boot/tree/efi/dm_disk > > > > > > >> > > > > > > >> This series together with Simon's series breaks multiple boards > > > > > > >> due to > > > > > > >> size constraints: > > > > > > >> > > > > > > >> https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/11197 > > > > > > >> > > > > > > >> Please, investigate how to work around this issue. > > > > > > > > > > > > > > tbs2910 - perhaps we should just drop this board? It doesn't use > > > > > > > DM_SERIAL and still uses OF_EMBED > > > > > > > > > > > > Are we again at the same point? You are breaking working boards with > > > > > > (for these boards) useless additions, and all you come up with is > > > > > > "remove this board". Of course without adding the board maintainer. > > > > > > > > > > I'm just expressing reasonable frustration that this board uses > > > > > OF_EMBED and does not use DM_SERIAL, after all of this time. Why > > > > > should the rest of the U-Boot developers care more about this board > > > > > than the maintainer? > > > > > > > > Please keep in mind Simon that we've had zero releases with the > > > > DM_SERIAL migration warning being posted, v2022.04 will be the first > > > > one. > > > > > > Yes, understood :-) For OF_EMBED though...? > > > > No deadline and 50 boards. > > Er, there has been a build message about that since the beginning, so > people ignored it. Do we really need to make the build fail for these > sorts of things? Perhaps so, but it is a sad situation. Yes, in hind-sight, "don't do that" wasn't the right path. It would be a good idea to start a different thread and see what / how the platforms can be migrated away. > > > It was actually quite hard to add a migration message until we added > > > the CONFIG_SERIAL base thing and that was a pain to do. > > > > > > For those of us who take on larger refactors etc., we end up spending > > > a lot of our time on these few platforms. I'm not picking on tbs2910in > > > in particular. > > > > Well, the flip side of the problem here is that there's a number of > > platforms with real constraints to them and it keeps being "can we drop > > this yet?" without CC'ing the board maintainer on the series that once > > again pushes a given platform to the limit. I would expect no size > > growth to tbs2910 for the topic of this series since it disables > > EFI_LOADER entirely, so why is it a problem? > > The partition changes are going to add some size anyway, I expect. I > have not actually analysed it though. Perhaps we can just disable a > filesystem? I was a bit too absolutist there, sorry. Yes, a few hundreds of bytes here-and-there is probably a non issue. But it shouldn't be kilobytes. It really shouldn't push things over the line. And on the tbs2910 side, Soeren, can you look at enabling LTO for this platform? That would likely buy a good bit of space savings. That might well be needed to do further DM migrations/etc. -- Tom signature.asc Description: PGP signature
Re: [RFC PATCH v3 2/2] bootmenu: add UEFI and disto_boot entries
Hi Kojima-san On Tue, Mar 08, 2022 at 11:07:45PM +0900, Masahisa Kojima wrote: > This commit adds the UEFI related menu entries and > distro_boot entries into the bootmenu. > > For UEFI, user can select which UEFI "Boot" option > to execute, call UEFI bootmgr and UEFI boot variable > maintenance menu. UEFI bootmgr entry is required to > correctly handle "BootNext" variable. Hmm why? (some more info further down) > > For distro_boot, user can select the boot device > included in "boot_targets" u-boot environment variable. > > The menu example is as follows. > > *** U-Boot Boot Menu *** > > Boot 1. kernel (bootmenu_0) > Boot 2. kernel (bootmenu_1) > Reset board (bootmenu_2) > debian (BOOT) > ubuntu (BOOT0001) > UEFI Boot Manager > usb0 > scsi0 > virtio0 > dhcp > UEFI Boot Manager Maintenance > U-Boot console > > Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit > > Signed-off-by: Masahisa Kojima > --- > Changes in v3: > - newly created > > cmd/bootmenu.c | 268 +++-- > 1 file changed, 259 insertions(+), 9 deletions(-) > > diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c > index 409ef9a848..a8dc50dcaa 100644 > --- a/cmd/bootmenu.c > +++ b/cmd/bootmenu.c > @@ -3,9 +3,12 @@ > * (C) Copyright 2011-2013 Pali Rohár > */ > > +#include > #include > #include > #include > +#include > +#include > #include > #include > #include > @@ -24,11 +27,20 @@ > */ > #define MAX_ENV_SIZE (9 + 2 + 1) > > +enum boot_type { > + BOOT_TYPE_NONE = 0, > + BOOT_TYPE_BOOTMENU, > + BOOT_TYPE_UEFI, > + BOOT_TYPE_DISTRO_BOOT, > +}; > + > struct bootmenu_entry { > unsigned short int num; /* unique number 0 .. MAX_COUNT */ > char key[3];/* key identifier of number */ > - char *title;/* title of entry */ > + u16 *title; /* title of entry */ > char *command; /* hush command of entry */ > + enum boot_type type; > + u16 bootorder; > struct bootmenu_data *menu; /* this bootmenu */ > struct bootmenu_entry *next;/* next menu entry (num+1) */ > }; > @@ -75,7 +87,12 @@ static void bootmenu_print_entry(void *data) > if (reverse) > puts(ANSI_COLOR_REVERSE); > > - puts(entry->title); > + if (entry->type == BOOT_TYPE_BOOTMENU) > + printf("%ls (bootmenu_%d)", entry->title, entry->bootorder); > + else if (entry->type == BOOT_TYPE_UEFI) > + printf("%ls (BOOT%04X)", entry->title, entry->bootorder); > + else > + printf("%ls", entry->title); > > if (reverse) > puts(ANSI_COLOR_RESET); > @@ -87,6 +104,10 @@ static void bootmenu_autoboot_loop(struct bootmenu_data > *menu, > int i, c; > > if (menu->delay > 0) { > + /* flush input */ > + while (tstc()) > + getchar(); > + > printf(ANSI_CURSOR_POSITION, menu->count + 5, 1); > printf(" Hit any key to stop autoboot: %2d ", menu->delay); > } > @@ -300,6 +321,8 @@ static struct bootmenu_data *bootmenu_create(int delay) > menu->active = (int)simple_strtol(default_str, NULL, 10); > > while ((option = bootmenu_getoption(i))) { > + u16 *buf; > + > sep = strchr(option, '='); > if (!sep) { > printf("Invalid bootmenu entry: %s\n", option); > @@ -311,13 +334,13 @@ static struct bootmenu_data *bootmenu_create(int delay) > goto cleanup; > > len = sep-option; > - entry->title = malloc(len + 1); > + buf = calloc(1, (len + 1) * sizeof(u16)); > + entry->title = buf; > if (!entry->title) { > free(entry); > goto cleanup; > } > - memcpy(entry->title, option, len); > - entry->title[len] = 0; > + utf8_utf16_strncpy(&buf, option, len); > > len = strlen(sep + 1); > entry->command = malloc(len + 1); > @@ -333,6 +356,190 @@ static struct bootmenu_data *bootmenu_create(int delay) > > entry->num = i; > entry->menu = menu; > + entry->type = BOOT_TYPE_BOOTMENU; > + entry->bootorder = i; > + entry->next = NULL; > + > + if (!iter) > + menu->first = entry; > + else > + iter->next = entry; > + > + iter = entry; > + ++i; > + > + if (i == MAX_COUNT - 1) > + break; > + } > + > +{ > + u16 *bootorder; > + efi_status_t ret; > + unsigned short j; > + efi_uintn_t num, size; > + void *load_option; > + struct efi_load_option lo; > + u16 varname[] = u"Boot";
Re: [PATCH v3 6/8] cmd: rng: Add support for selecting RNG device
Hi Sugosh, On Fri, 4 Mar 2022 at 06:35, Sughosh Ganu wrote: > > The 'rng' u-boot command is used for printing a select number of > random bytes on the console. Currently, the RNG device from which the > random bytes are read is fixed. However, a platform can have multiple > RNG devices, one example being qemu, which has a virtio RNG device and > the RNG pseudo device through the TPM chip. > > Extend the 'rng' command so that the user can provide the RNG device > number from which the random bytes are to be read. This will be the > device index under the RNG uclass. > > Signed-off-by: Sughosh Ganu > Tested-by: Heinrich Schuchardt > --- > > Changes since V2: None > > cmd/rng.c | 31 +++ > 1 file changed, 23 insertions(+), 8 deletions(-) > > diff --git a/cmd/rng.c b/cmd/rng.c > index 1ad5a096c0..bb89cfa784 100644 > --- a/cmd/rng.c > +++ b/cmd/rng.c > @@ -13,19 +13,34 @@ > > static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const > argv[]) > { > - size_t n = 0x40; > + size_t n; > struct udevice *dev; > void *buf; > + int devnum; > int ret = CMD_RET_SUCCESS; > > - if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) { > + switch (argc) { > + case 1: > + devnum = 0; > + n = 0x40; > + break; > + case 2: > + devnum = hextoul(argv[1], NULL); > + n = 0x40; > + break; > + case 3: > + devnum = hextoul(argv[1], NULL); > + n = hextoul(argv[2], NULL); > + break; > + default: > + return CMD_RET_USAGE; > + } > + > + if (uclass_get_device(UCLASS_RNG, devnum, &dev) || !dev) { Devices are numbered by aliases, so you should use uclass_get_device_by_seq() here. > printf("No RNG device\n"); > return CMD_RET_FAILURE; > } > > - if (argc >= 2) > - n = hextoul(argv[1], NULL); > - > buf = malloc(n); No need to malloc(), just set a limit for (say 64) bytes. See how cmd_mem.c does it. > if (!buf) { > printf("Out of memory\n"); > @@ -46,12 +61,12 @@ static int do_rng(struct cmd_tbl *cmdtp, int flag, int > argc, char *const argv[]) > > #ifdef CONFIG_SYS_LONGHELP > static char rng_help_text[] = > - "[n]\n" > - " - print n random bytes\n"; > + "[dev [n]]\n" > + " - print n random bytes read from dev\n"; > #endif > > U_BOOT_CMD( > - rng, 2, 0, do_rng, > + rng, 3, 0, do_rng, > "print bytes from the hardware random number generator", > rng_help_text > ); > -- > 2.25.1 > Regards, Simon
Re: [PATCH v3 00/19] efi_loader: more tightly integrate UEFI disks to driver model
Hi Tom, On Wed, 9 Mar 2022 at 07:25, Tom Rini wrote: > > On Tue, Mar 08, 2022 at 08:10:38PM -0700, Simon Glass wrote: > > Hi Tom, > > > > On Tue, 8 Mar 2022 at 20:00, Tom Rini wrote: > > > > > > On Tue, Mar 08, 2022 at 07:32:59PM -0700, Simon Glass wrote: > > > > Hi Tom, > > > > > > > > On Tue, 8 Mar 2022 at 17:13, Tom Rini wrote: > > > > > > > > > > On Tue, Mar 08, 2022 at 02:20:15PM -0700, Simon Glass wrote: > > > > > > Hi Soeren, > > > > > > > > > > > > On Tue, 8 Mar 2022 at 12:15, Soeren Moch wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 08.03.22 17:56, Simon Glass wrote: > > > > > > > > Hi, > > > > > > > > > > > > > > > > On Tue, 8 Mar 2022 at 09:49, Heinrich Schuchardt > > > > > > > > wrote: > > > > > > > >> > > > > > > > >> On 3/8/22 12:36, AKASHI Takahiro wrote: > > > > > > > >>> With this patch set[1] applied, UEFI subsystem maintains a > > > > > > > >>> list of its > > > > > > > >>> disk objects dynamically at runtime based on block device's > > > > > > > >>> probing. > > > > > > > >>> (See "issues" below.) > > > > > > > >>> > > > > > > > >>> [1]https://github.com/t-akashi/u-boot/tree/efi/dm_disk > > > > > > > >> > > > > > > > >> This series together with Simon's series breaks multiple > > > > > > > >> boards due to > > > > > > > >> size constraints: > > > > > > > >> > > > > > > > >> https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/11197 > > > > > > > >> > > > > > > > >> Please, investigate how to work around this issue. > > > > > > > > > > > > > > > > tbs2910 - perhaps we should just drop this board? It doesn't use > > > > > > > > DM_SERIAL and still uses OF_EMBED > > > > > > > > > > > > > > Are we again at the same point? You are breaking working boards > > > > > > > with > > > > > > > (for these boards) useless additions, and all you come up with is > > > > > > > "remove this board". Of course without adding the board > > > > > > > maintainer. > > > > > > > > > > > > I'm just expressing reasonable frustration that this board uses > > > > > > OF_EMBED and does not use DM_SERIAL, after all of this time. Why > > > > > > should the rest of the U-Boot developers care more about this board > > > > > > than the maintainer? > > > > > > > > > > Please keep in mind Simon that we've had zero releases with the > > > > > DM_SERIAL migration warning being posted, v2022.04 will be the first > > > > > one. > > > > > > > > Yes, understood :-) For OF_EMBED though...? > > > > > > No deadline and 50 boards. > > > > Er, there has been a build message about that since the beginning, so > > people ignored it. Do we really need to make the build fail for these > > sorts of things? Perhaps so, but it is a sad situation. > > Yes, in hind-sight, "don't do that" wasn't the right path. It would be > a good idea to start a different thread and see what / how the platforms > can be migrated away. I think there is a use case for it now - e.g. booting Apple M1 which uses a separate bootloader. IMO a .img or .fit file would be better in some cases but people seem to be allergic to implementing U-Boot things in their code bases. We have the same requirement for the EFI app since UEFI does not implement the U-Boot .img file. So if we are going to support this, perhaps we should create a new option for it. But honestly I am just too weary to consider yet another migration. We need to finish some, e.g. Kconfig. > > > > > It was actually quite hard to add a migration message until we added > > > > the CONFIG_SERIAL base thing and that was a pain to do. > > > > > > > > For those of us who take on larger refactors etc., we end up spending > > > > a lot of our time on these few platforms. I'm not picking on tbs2910in > > > > in particular. > > > > > > Well, the flip side of the problem here is that there's a number of > > > platforms with real constraints to them and it keeps being "can we drop > > > this yet?" without CC'ing the board maintainer on the series that once > > > again pushes a given platform to the limit. I would expect no size > > > growth to tbs2910 for the topic of this series since it disables > > > EFI_LOADER entirely, so why is it a problem? > > > > The partition changes are going to add some size anyway, I expect. I > > have not actually analysed it though. Perhaps we can just disable a > > filesystem? > > I was a bit too absolutist there, sorry. Yes, a few hundreds of bytes > here-and-there is probably a non issue. But it shouldn't be kilobytes. > It really shouldn't push things over the line. > > And on the tbs2910 side, Soeren, can you look at enabling LTO for this > platform? That would likely buy a good bit of space savings. That > might well be needed to do further DM migrations/etc. Regards, Simon
Re: [PATCH V3] dt-bindings: nvmem: add U-Boot environment variables binding
On Wed, Mar 09, 2022 at 02:42:43PM +0100, Michal Simek wrote: > > > On 2/28/22 14:12, Rafał Miłecki wrote: > > From: Rafał Miłecki > > > > U-Boot uses environment variables for storing device setup data. It > > usually needs to be accessed by a bootloader, kernel and often > > user-space. > > > > This binding allows describing environment data located in a raw flash > > partition. It's treated as NVMEM device and can be reused later for > > other storage devices. > > > > Using DT should be cleaner than hardcoding & duplicating such info in > > multiple places. Bootloader & kernel can share DTS and user-space can > > try reading it too or just have correct data exposed by a kernel. > > > > A custom "compatible" string allows system to automatically load > > relevant NVMEM driver but phandle can be also used for reading raw > > location. > > > > Signed-off-by: Rafał Miłecki > > --- > > V2: Update descriptions to don't make this binding MTD (flash partition) > > specific. Mention multiple possible storage ways. > > V3: Drop > > allOf: > >- $ref: nvmem.yaml# > > as we don't use anything rom the nvmem.yaml. Thanks Rob. > > --- > > .../devicetree/bindings/nvmem/u-boot,env.yaml | 62 +++ > > MAINTAINERS | 5 ++ > > 2 files changed, 67 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/nvmem/u-boot,env.yaml > > > > diff --git a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml > > b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml > > new file mode 100644 > > index ..e70b2a60cb9a > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml > > @@ -0,0 +1,62 @@ > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/nvmem/u-boot,env.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: U-Boot environment variables > > + > > +description: | > > + U-Boot uses environment variables to store device parameters and > > + configuration. They may be used for booting process, setup or keeping > > end user > > + info. > > + > > + Data is stored using U-Boot specific formats (variant specific header > > and NUL > > + separated key-value pairs). > > + > > + Environment data can be stored on various storage entities, e.g.: > > + 1. Raw flash partition > > + 2. UBI volume > > + > > + This binding allows marking storage device (as containing env data) and > > + specifying used format. > > + > > + Right now only flash partition case is covered but it may be extended to > > e.g. > > + UBI volumes in the future. > > + > > +maintainers: > > + - Rafał Miłecki > > + > > +properties: > > + compatible: > > +oneOf: > > + - description: A standalone env data block > > +const: u-boot,env > > + - description: Two redundant blocks with active one flagged > > +const: u-boot,env-redundant-bool > > + - description: Two redundant blocks with active having higher counter > > +const: u-boot,env-redundant-count > > + > > + reg: > > +maxItems: 1 > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > +partitions { > > +compatible = "fixed-partitions"; > > +#address-cells = <1>; > > +#size-cells = <1>; > > + > > +partition@0 { > > +reg = <0x0 0x4>; > > +label = "u-boot"; > > +read-only; > > +}; > > + > > +env: partition@4 { > > +compatible = "u-boot,env"; > > +reg = <0x4 0x1>; > > +}; > > +}; > > diff --git a/MAINTAINERS b/MAINTAINERS > > index db8052bc1d26..24fc181a7e6c 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -19958,6 +19958,11 @@ W: http://linuxtv.org > > T:git git://linuxtv.org/media_tree.git > > F:drivers/media/pci/tw686x/ > > +U-BOOT ENVIRONMENT VARIABLES > > +M: Rafał Miłecki > > +S: Maintained > > +F: Documentation/devicetree/bindings/nvmem/u-boot,env.yaml > > + > > UACCE ACCELERATOR FRAMEWORK > > M:Zhangfei Gao > > M:Zhou Wang > > I think that parsing these partitions is quite sw intensive process and I > can't still see the value to have compatible string here. It's always good to know what a node represents. > I would prefer to have just any link from u-boot node to partition instead. That's a separate issue and having 'compatible' in no way disallows that. Rob
[PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset
The FlexSPI NOR boot offset does not require any special handling, the image_offset is correct in either case (0x1000 for FlexSPI NOR and 0x8000 for SD/eMMC) and the offset of u-boot.itb from the start of flash.bin is always 0x58000 on MX8MN/MX8MP, which matches the CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000 in case CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x300, which is always the case on MX8MN/MX8MP. The CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is really overloaded in case of the MX8MN/MX8MP, but fixing that needs additional plumbing. Signed-off-by: Marek Vasut Cc: Fabio Estevam Cc: Peng Fan Cc: Stefano Babic --- arch/arm/mach-imx/spl_imx_romapi.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c index d827de375a6..c47f5a6bdb4 100644 --- a/arch/arm/mach-imx/spl_imx_romapi.c +++ b/arch/arm/mach-imx/spl_imx_romapi.c @@ -38,14 +38,8 @@ ulong spl_romapi_raw_seekable_read(u32 offset, u32 size, void *buf) ulong __weak spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev) { - u32 offset; - - if (((rom_bt_dev >> 16) & 0xff) == BT_DEV_TYPE_FLEXSPINOR) - offset = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512; - else - offset = image_offset + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000; - - return offset; + return image_offset + + (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000); } static int is_boot_from_stream_device(u32 boot) -- 2.34.1
Re: [PATCH v2] mmc: fsl_esdhc_imx: use VENDORSPEC_FRC_SDCLK_ON when necessary
On Tue, Feb 22, 2022 at 11:28:18AM +0800, haibo.c...@nxp.com wrote: > From: Haibo Chen > > After commit f132aab40327 ("Revert "mmc: fsl_esdhc_imx: use > VENDORSPEC_FRC_SDCLK_ON to control card clock output""), it > involve issue in mmc_switch_voltage(), because of the special > design of usdhc. > > For FSL_USDHC, it do not implement VENDORSPEC_CKEN/PEREN/HCKEN/IPGEN, > these are reserved bits(Though RM contain the definition of these bits, > but actually internal IC logic do not implement, already confirm with > IC team). Instead, use VENDORSPEC_FRC_SDCLK_ON to gate on/off the card > clock output. Here is the definition of this bit in RM: > > [8] FRC_SDCLK_ON > Force CLK output active > Do not set this bit to 1 unless it is necessary. Also, make sure that > this bit is cleared when uSDHC’s clock is about to be changed (frequency > change, clock source change, or delay chain tuning). > 0b - CLK active or inactive is fully controlled by the hardware. > 1b - Force CLK active > > In default, the FRC_SDCLK_ON is 0. This means, when there is no command > or data transfer on bus, hardware will gate off the card clock. But in > some case, we need the card clock keep on. Take IO voltage 1.8v switch > as example, after IO voltage change to 1.8v, spec require gate off the > card clock for 5ms, and gate on the clock back, once detect the card > clock on, then the card will draw the dat0 to high immediately. If there > is not clock gate off/on behavior, some card will keep the dat0 to low > level. This is the reason we fail in mmc_switch_voltage(). > > To fix this issue, and concern that this is only the fsl usdhc hardware > design limitation, set the bit FRC_SDCLK_ON in the beginning of the > wait_dat0() and clear it in the end. To make sure the 1.8v IO voltage > switch process align with SD specification. > > For standard tuning process, usdhc specification also require the card > clock keep on, so also add these behavior in fsl_esdhc_execute_tuning(). > > Reviewed-by: Marek Vasut > Tested-by: Fabio Estevam > Signed-off-by: Haibo Chen > Reviewed-by: Peng Fan > Reviewed-by: Jaehoon Chung > --- > drivers/mmc/fsl_esdhc_imx.c | 25 ++--- > include/fsl_esdhc_imx.h | 2 ++ > 2 files changed, 24 insertions(+), 3 deletions(-) Is this going to get picked up in the imx or mmc trees soon, or should I take this directly? Thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH] Nokia RX-51: Convert to CONFIG_DM_VIDEO
On Sunday 06 March 2022 11:43:21 Simon Glass wrote: > On Sun, 6 Mar 2022 at 08:09, Pali Rohár wrote: > > -/* > > - * Routine: video_hw_init > > - * Description: Set up the GraphicDevice depending on sys_boot. > > - */ > > -void *video_hw_init(void) > > +static int rx51_video_probe(struct udevice *dev) > > { > > - /* fill in Graphic Device */ > > - gdev.frameAdrs = 0x8f9c; > > - gdev.winSizeX = 800; > > - gdev.winSizeY = 480; > > - gdev.gdfBytesPP = 2; > > - gdev.gdfIndex = GDF_16BIT_565RGB; > > - memset((void *)gdev.frameAdrs, 0, 0xbb800); > > - return (void *) &gdev; > > + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); > > + struct video_priv *uc_priv = dev_get_uclass_priv(dev); > > + > > + uc_plat->base = 0x8f9c; > > How is this calculated? I do not remember. This seems to be fixed address set by the code which loads U-Boot. I do not have any notes about this stuff. > > + uc_plat->size = 800 * 480 * sizeof(u16); > > More correctly this should be in the bind() method, but in fact I > don't think it matters. We can always adjust it later if needed. Ok. I let it in probe, so all initialization is done at one place. If something is needed to adjust, it can be done later.
Re: [PATCH] WIP: Nokia RX-51: Convert to CONFIG_DM_VIDEO
On Sunday 06 March 2022 11:44:22 Simon Glass wrote: > Hi Pali, > > On Sun, 6 Mar 2022 at 08:25, Pali Rohár wrote: > > > > On Sunday 06 March 2022 07:42:03 Simon Glass wrote: > > > Yes let's go with that. > > > > Done, I sent final version of the patch. > > > > > > > > > > > Second thing is that CONFIG_VIDEO_LOGO is broken and does not > > > > > > > > > work even it > > > > > > > > > is enabled in config file. I do not know why too. > > > > > > > > > > > > > > > > > > Any idea? > > > > > > > > > > > > > > > > Not yet. There were some logo related changes recently, but if I > > > > > > > > remember correctly, I tested them on wandboard and nitrogen6q > > > > > > > > targets and with sandbox, and logo drawing worked there. > > > > > > > > > > Can you be more specific than 'broken'? What is broken about it? > > > > > > > > Does not work, logo is not drown on the screen. > > > > > > See video_bmp_display() - I wonder if the particular depth you are > > > using is not supported? > > > > Depth is 16bit which should be supported. > > But apparently isn't , at least in this case :-) Yea, something is broken there. > > > > > Anyway you should be able to debug it there or > > > using the bmp command. The file is drivers/video/u_boot_logo.bmp > > > > CONFIG_CMD_BMP=y is broken too. When I enable it then U-Boot freeze > > after the line 'Loading Environment from ... OK'. > > OK I'm not sure why, but please investigate if you have time. I have looked at it and do not know. But probably it is because I somehow have not caught how this new video code works... Anyway, I sent documentation update how to run u-boot for n900 in qemu: https://patchwork.ozlabs.org/project/uboot/patch/20220308175956.4522-1-p...@kernel.org/ So it could help other people to look at issues which do not work correctly in n900's u-boot without need to have n900 hardware.
[PATCH v2 1/2] video: Allow drivers to allocate the frame buffer themselves
When plat->base is set by driver then skip frame buffer reservation and allocation. Signed-off-by: Pali Rohár --- drivers/video/video-uclass.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 7d499bcec51d..88797d4a21c2 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -33,7 +33,8 @@ * information represents the requires size and alignment of the frame buffer * for the device. The values can be an over-estimate but cannot be too * small. The actual values will be suppled (in the same manner) by the bind() - * method after relocation. + * method after relocation. Additionally driver can allocate frame buffer + * itself by setting plat->base. * * This information is then picked up by video_reserve() which works out how * much memory is needed for all devices. This is allocated between @@ -78,6 +79,10 @@ static ulong alloc_fb(struct udevice *dev, ulong *addrp) if (!plat->size) return 0; + /* Allow drivers to allocate the frame buffer themselves */ + if (plat->base) + return 0; + align = plat->align ? plat->align : 1 << 20; base = *addrp - plat->size; base &= ~(align - 1); -- 2.20.1
[PATCH v2 2/2] Nokia RX-51: Convert to CONFIG_DM_VIDEO
Mechanically convert video_hw_init() function to UCLASS_VIDEO probe callback and replace CONFIG_CFB_CONSOLE by CONFIG_DM_VIDEO. As framebuffer base address is setup by the bootloader which loads U-Boot, set plat->base to that fixed framebuffer address. This change was tested in qemu n900 machine and is working fine. What does not work is CONFIG_VIDEO_LOGO, seems to be buggy. Signed-off-by: Pali Rohár --- board/nokia/rx51/rx51.c | 40 +--- configs/nokia_rx51_defconfig | 7 +-- include/configs/nokia_rx51.h | 11 ++ 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c index a52691509da4..621cff095619 100644 --- a/board/nokia/rx51/rx51.c +++ b/board/nokia/rx51/rx51.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -62,8 +62,6 @@ struct emu_hal_params_rx51 { DECLARE_GLOBAL_DATA_PTR; -GraphicDevice gdev; - const omap3_sysinfo sysinfo = { DDR_STACKED, "Nokia RX-51", @@ -342,22 +340,28 @@ void setup_board_tags(struct tag **in_params) *in_params = params; } -/* - * Routine: video_hw_init - * Description: Set up the GraphicDevice depending on sys_boot. - */ -void *video_hw_init(void) +static int rx51_video_probe(struct udevice *dev) { - /* fill in Graphic Device */ - gdev.frameAdrs = 0x8f9c; - gdev.winSizeX = 800; - gdev.winSizeY = 480; - gdev.gdfBytesPP = 2; - gdev.gdfIndex = GDF_16BIT_565RGB; - memset((void *)gdev.frameAdrs, 0, 0xbb800); - return (void *) &gdev; + struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev); + struct video_priv *uc_priv = dev_get_uclass_priv(dev); + + uc_plat->base = 0x8f9c; + uc_plat->size = 800 * 480 * sizeof(u16); + uc_priv->xsize = 800; + uc_priv->ysize = 480; + uc_priv->bpix = VIDEO_BPP16; + + video_set_flush_dcache(dev, true); + + return 0; } +U_BOOT_DRIVER(rx51_video) = { + .name = "rx51_video", + .id = UCLASS_VIDEO, + .probe = rx51_video_probe, +}; + /* * Routine: twl4030_regulator_set_mode * Description: Set twl4030 regulator mode over i2c powerbus. @@ -777,6 +781,10 @@ U_BOOT_DRVINFOS(rx51_watchdog) = { { "rx51_watchdog" }, }; +U_BOOT_DRVINFOS(rx51_video) = { + { "rx51_video" }, +}; + U_BOOT_DRVINFOS(rx51_kp) = { { "rx51_kp" }, }; diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig index 47b7bc3b4f03..1d64981afc46 100644 --- a/configs/nokia_rx51_defconfig +++ b/configs/nokia_rx51_defconfig @@ -77,8 +77,11 @@ CONFIG_SPI=y CONFIG_USB=y CONFIG_USB_MUSB_UDC=y CONFIG_USB_OMAP3=y -CONFIG_CFB_CONSOLE=y -CONFIG_CFB_CONSOLE_ANSI=y +CONFIG_DM_VIDEO=y +CONFIG_VIDEO_LOGO=y +# CONFIG_VIDEO_BPP8 is not set +# CONFIG_VIDEO_BPP32 is not set +CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_SPLASH_SCREEN=y CONFIG_WATCHDOG_TIMEOUT_MSECS=31000 CONFIG_WDT=y diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h index 9be64c3d3f87..e837b12b568f 100644 --- a/include/configs/nokia_rx51.h +++ b/include/configs/nokia_rx51.h @@ -70,19 +70,12 @@ #define CONFIG_SYS_ONENAND_BASEONENAND_MAP -/* - * Framebuffer - */ -/* Video console */ -#define VIDEO_FB_16BPP_PIXEL_SWAP -#define VIDEO_FB_16BPP_WORD_SWAP - /* Environment information */ #define CONFIG_EXTRA_ENV_SETTINGS \ "usbtty=cdc_acm\0" \ "stdin=usbtty,serial,keyboard\0" \ - "stdout=usbtty,serial,vga\0" \ - "stderr=usbtty,serial,vga\0" \ + "stdout=usbtty,serial,vidconsole\0" \ + "stderr=usbtty,serial,vidconsole\0" \ "slide=gpio input " __stringify(GPIO_SLIDE) "\0" \ "switchmmc=mmc dev ${mmcnum}\0" \ "kernaddr=0x82008000\0" \ -- 2.20.1
Re: [PATCH v2] drivers: serial: Make sure we really return a serial device
On Mon, Feb 21, 2022 at 10:17:37PM +0100, Mark Kettenis wrote: > The stdout-path property in the device tree does not necessarily > point at a serial device. On machines such as the Apple M1 laptops > where the serial port isn't easy to access and users expect to see > console output on the integrated display stdout-path may point at > the device tree node for the framebuffer for example. > > If stdout-path does not point at a node for a serial device, the > serial_check_stdout() will not find a bound device and will drop > down into code that attempts to use lists_bind_fdt() to bind a > device anyway. However, that fallback code does not check that > the uclass of the device is UCLASS_SERIAL. So if stdout-path points > at the framebuffer instead of the serial device it will return a > UCLASS_VIDEO device. Since the code that calls this function > expects the returned device to be a UCLASS_SERIAL device, U-Boot > will crash as soon as it attempts to send output to the console. > > Add a check here to verify that the uclass of the bound device > really is UCLASS_SERIAL. If it isn't, serial_check_stdout() will > return an error and serial_find_console_or_panic() will use the > serial device with sequence number 0 as the console and all is fine. > > Signed-off-by: Mark Kettenis > Reviewed-by: Simon Glass Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH] .mailmap: Fix Heinrich's xypron.g...@gmx.de record
On Mon, Mar 07, 2022 at 08:41:21AM +0100, Michal Simek wrote: > There is one issue with Heinrich xypron.g...@gmx.de > record which should be specifically grouped with his name. > > Signed-off-by: Michal Simek Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH] board: .gitignore: replace dsdt.c by dsdt_generated.c
On Tue, Mar 08, 2022 at 10:37:19AM +0100, Philippe Reynes wrote: > Since commit 5d94cbd1dca7 ("scripts: Makefile.lib: generate > dsdt_generated.c instead of dsdt.c"), the file generated > is named dsdt_generated.c instead of dsdt.c. > So all files .gitignore referencing dsdt.c should be > upated with dsdt_generated.c. > > Signed-off-by: Philippe Reynes > Reviewed-by: Heinrich Schuchardt Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: Please pull u-boot-watchdog/master
On Tue, Mar 08, 2022 at 10:14:16AM +0100, Stefan Roese wrote: > Hi Tom, > > please pull the following watchdog related patches: > Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
[PATCH v3 2/4] arm: dts: k3-am64: Add support for ESM device nodes
Enable access to ESM0 configuration space and add Main ESM0 and MCU ESM nodes to the AM64 device tree. Signed-off-by: Hari Nagalla --- arch/arm/dts/k3-am64.dtsi| 1 + arch/arm/dts/k3-am642-r5-evm.dts | 19 +++ arch/arm/dts/k3-am642-r5-sk.dts | 19 +++ 3 files changed, 39 insertions(+) diff --git a/arch/arm/dts/k3-am64.dtsi b/arch/arm/dts/k3-am64.dtsi index de6805b0c7..7aa94d5a6e 100644 --- a/arch/arm/dts/k3-am64.dtsi +++ b/arch/arm/dts/k3-am64.dtsi @@ -64,6 +64,7 @@ #address-cells = <2>; #size-cells = <2>; ranges = <0x00 0x000f4000 0x00 0x000f4000 0x00 0x02d0>, /* PINCTRL */ +<0x00 0x0042 0x00 0x0042 0x00 0x1000>, /* ESM0 */ <0x00 0x0060 0x00 0x0060 0x00 0x1100>, /* GPIO */ <0x00 0x00a4 0x00 0x00a4 0x00 0x0800>, /* Timesync router */ <0x00 0x0100 0x00 0x0100 0x00 0x02330400>, /* First peripheral window */ diff --git a/arch/arm/dts/k3-am642-r5-evm.dts b/arch/arm/dts/k3-am642-r5-evm.dts index cc48fd4cb6..3ea6471e94 100644 --- a/arch/arm/dts/k3-am642-r5-evm.dts +++ b/arch/arm/dts/k3-am642-r5-evm.dts @@ -82,6 +82,25 @@ }; }; +&cbass_main { + main_esm: esm@42 { + compatible = "ti,j721e-esm"; + reg = <0x0 0x42 0x0 0x1000>; + ti,esm-pins = <160>, <161>; + u-boot,dm-spl; + }; +}; + +&cbass_mcu { + u-boot,dm-spl; + mcu_esm: esm@410 { + compatible = "ti,j721e-esm"; + reg = <0x0 0x410 0x0 0x1000>; + ti,esm-pins = <0>, <1>; + u-boot,dm-spl; + }; +}; + &main_pmx0 { u-boot,dm-spl; main_uart0_pins_default: main-uart0-pins-default { diff --git a/arch/arm/dts/k3-am642-r5-sk.dts b/arch/arm/dts/k3-am642-r5-sk.dts index 7d1cb85615..1f96e3fcac 100644 --- a/arch/arm/dts/k3-am642-r5-sk.dts +++ b/arch/arm/dts/k3-am642-r5-sk.dts @@ -75,6 +75,25 @@ }; }; +&cbass_main { + main_esm: esm@42 { + compatible = "ti,j721e-esm"; + reg = <0x0 0x42 0x0 0x1000>; + ti,esm-pins = <160>, <161>; + u-boot,dm-spl; + }; +}; + +&cbass_mcu { + u-boot,dm-spl; + mcu_esm: esm@410 { + compatible = "ti,j721e-esm"; + reg = <0x0 0x410 0x0 0x1000>; + ti,esm-pins = <0>, <1>; + u-boot,dm-spl; + }; +}; + &main_pmx0 { u-boot,dm-spl; main_uart0_pins_default: main-uart0-pins-default { -- 2.17.1
[PATCH v3 0/4] Add ESM driver support for AM64x R5 SPL/U-boot
AM64x devices have a main ESM and a MCU ESM. The ESM driver enables routing of the error events from various sources to different processors or to reset hardware logic. Only the MCU ESM's high output can trigger reset logic. The main RTI0 WWDT output can be routed to the MCU highoutput to trigger reset through the main ESM. For this reset to occur CTRLMMR_MCU_RST_CTRL:MCU_ESM_ERROR_RESET_EN_Z is set to '0'. AM64x Technical Reference Manual - https://www.ti.com/lit/pdf/spruim2 Hari Nagalla (4): misc: k3_esm: Add functionality to set and route error events within K3SoC arm: dts: k3-am64: Add support for ESM device nodes arch: arm: mach-k3: am642_init: Probe ESM nodes configs: am64x_evm_r5_defconfig: Add support for ESM arch/arm/dts/k3-am64.dtsi| 1 + arch/arm/dts/k3-am642-r5-evm.dts | 19 arch/arm/dts/k3-am642-r5-sk.dts | 19 arch/arm/mach-k3/am642_init.c| 40 +--- configs/am64x_evm_r5_defconfig | 1 + drivers/misc/k3_esm.c| 53 ++-- 6 files changed, 126 insertions(+), 7 deletions(-) -- 2.17.1
[PATCH v3 1/4] misc: k3_esm: Add functionality to set and route error events within K3SoC
Add functionality to enable, set priority to the input events and to route to MCU ESM. On AM64x/AM62x devices, it is possible to route Main ESM0 error events to MCU ESM. When these error events are routed to MCU ESM high output, it can trigger the reset logic to reset the device, when CTRLMMR_MCU_RST_CTRL:MCU_ESM_ERROR_RESET_EN_Z is set to '0'. K3 based J7 devices (ex: J721e) also have ESM modules, and the changes to the driver does not impact those devices. Signed-off-by: Hari Nagalla --- drivers/misc/k3_esm.c | 53 --- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/drivers/misc/k3_esm.c b/drivers/misc/k3_esm.c index cc2a23dd66..41faeb3d85 100644 --- a/drivers/misc/k3_esm.c +++ b/drivers/misc/k3_esm.c @@ -16,17 +16,57 @@ #define ESM_SFT_RST0x0c #define ESM_SFT_RST_KEY0x0f +#define ESM_EN 0x08 +#define ESM_EN_KEY 0x0f #define ESM_STS(i) (0x404 + (i) / 32 * 0x20) +#define ESM_STS_MASK(i)(1 << ((i) % 32)) #define ESM_PIN_EN_SET_OFFSET(i) (0x414 + (i) / 32 * 0x20) -#define ESM_PIN_MASK(i)BIT((i) & 0x1f) +#define ESM_PIN_MASK(i)(1 << ((i) % 32)) +#define ESM_INTR_EN_SET_OFFSET(i) (0x408 + (i) / 32 * 0x20) +#define ESM_INTR_MASK(i) (1 << ((i) % 32)) +#define ESM_INTR_PRIO_SET_OFFSET(i)(0x410 + (i) / 32 * 0x20) +#define ESM_INTR_PRIO_MASK(i) (1 << ((i) % 32)) static void esm_pin_enable(void __iomem *base, int pin) { + u32 value; + + value = readl(base + ESM_PIN_EN_SET_OFFSET(pin)); + value |= ESM_PIN_MASK(pin); /* Enable event */ - writel(ESM_PIN_MASK(pin), base + ESM_PIN_EN_SET_OFFSET(pin)); + writel(value, base + ESM_PIN_EN_SET_OFFSET(pin)); +} + +static void esm_intr_enable(void __iomem *base, int pin) +{ + u32 value; + + value = readl(base + ESM_INTR_EN_SET_OFFSET(pin)); + value |= ESM_INTR_MASK(pin); + /* Enable Interrupt event */ + writel(value, base + ESM_INTR_EN_SET_OFFSET(pin)); +} + +static void esm_intr_prio_set(void __iomem *base, int pin) +{ + u32 value; + + value = readl(base + ESM_INTR_PRIO_SET_OFFSET(pin)); + value |= ESM_INTR_PRIO_MASK(pin); + /* Set to priority */ + writel(value, base + ESM_INTR_PRIO_SET_OFFSET(pin)); } +static void esm_clear_raw_status(void __iomem *base, int pin) +{ + u32 value; + + value = readl(base + ESM_STS(pin)); + value |= ESM_STS_MASK(pin); + /* Clear Event status */ + writel(value, base + ESM_STS(pin)); +} /** * k3_esm_probe: configures ESM based on DT data * @@ -67,8 +107,15 @@ static int k3_esm_probe(struct udevice *dev) /* Clear any pending events */ writel(ESM_SFT_RST_KEY, base + ESM_SFT_RST); - for (i = 0; i < num_pins; i++) + for (i = 0; i < num_pins; i++) { + esm_intr_prio_set(base, pins[i]); + esm_clear_raw_status(base, pins[i]); esm_pin_enable(base, pins[i]); + esm_intr_enable(base, pins[i]); + } + + /* Enable ESM */ + writel(ESM_EN_KEY, base + ESM_EN); free_pins: kfree(pins); -- 2.17.1
[PATCH v3 4/4] configs: am64x_evm_r5_defconfig: Add support for ESM
Enable ESM driver for AM64x R5 SPL/u-boot builds. Signed-off-by: Hari Nagalla --- configs/am64x_evm_r5_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/am64x_evm_r5_defconfig b/configs/am64x_evm_r5_defconfig index 61138dd1a9..e29e99c2d1 100644 --- a/configs/am64x_evm_r5_defconfig +++ b/configs/am64x_evm_r5_defconfig @@ -103,6 +103,7 @@ CONFIG_DM_I2C=y CONFIG_SYS_I2C_OMAP24XX=y CONFIG_DM_MAILBOX=y CONFIG_K3_SEC_PROXY=y +CONFIG_ESM_K3=y CONFIG_SPL_MISC=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ADMA=y -- 2.17.1
[PATCH v3 3/4] arch: arm: mach-k3: am642_init: Probe ESM nodes
On AM64x devices, it is possible to route Main ESM0 error events to MCU ESM. MCU ESM high error output can trigger the reset logic to reset the device. So, for these devices we expect two ESM device nodes in the device tree, one for Main ESM and the another MCU ESM in the device tree. When these ESM device nodes are properly configired it is possible to route the Main RTI0 WWDT output to the MCU ESM high output through Main ESM and trigger a device reset when CTRLMMR_MCU_RST_CTRL:MCU_ESM_ERROR_RESET_EN_Z is set to '0'. On K3 AM64x devices, the R5 SPL u-boot handles the ESM device node configurations. Signed-off-by: Hari Nagalla --- arch/arm/mach-k3/am642_init.c | 40 +++ 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-k3/am642_init.c b/arch/arm/mach-k3/am642_init.c index 543dea02bc..3a75dcea35 100644 --- a/arch/arm/mach-k3/am642_init.c +++ b/arch/arm/mach-k3/am642_init.c @@ -24,12 +24,22 @@ #include #if defined(CONFIG_SPL_BUILD) +#define MCU_CTRL_MMR0_BASE 0x0450 +#define CTRLMMR_MCU_RST_CTRL 0x04518170 static void ctrl_mmr_unlock(void) { /* Unlock all PADCFG_MMR1 module registers */ mmr_unlock(PADCFG_MMR1_BASE, 1); + /* Unlock all MCU_CTRL_MMR0 module registers */ + mmr_unlock(MCU_CTRL_MMR0_BASE, 0); + mmr_unlock(MCU_CTRL_MMR0_BASE, 1); + mmr_unlock(MCU_CTRL_MMR0_BASE, 2); + mmr_unlock(MCU_CTRL_MMR0_BASE, 3); + mmr_unlock(MCU_CTRL_MMR0_BASE, 4); + mmr_unlock(MCU_CTRL_MMR0_BASE, 6); + /* Unlock all CTRL_MMR0 module registers */ mmr_unlock(CTRL_MMR0_BASE, 0); mmr_unlock(CTRL_MMR0_BASE, 1); @@ -37,9 +47,6 @@ static void ctrl_mmr_unlock(void) mmr_unlock(CTRL_MMR0_BASE, 3); mmr_unlock(CTRL_MMR0_BASE, 5); mmr_unlock(CTRL_MMR0_BASE, 6); - - /* Unlock all MCU_PADCFG_MMR1 module registers */ - mmr_unlock(MCU_PADCFG_MMR1_BASE, 1); } /* @@ -142,9 +149,20 @@ int fdtdec_board_setup(const void *fdt_blob) } #endif +#if defined(CONFIG_ESM_K3) +static void enable_mcu_esm_reset(void) +{ + /* Set CTRLMMR_MCU_RST_CTRL:MCU_ESM_ERROR_RST_EN_Z to '0' (low active) */ + u32 stat = readl(CTRLMMR_MCU_RST_CTRL); + + stat &= 0xFFFD; + writel(stat, CTRLMMR_MCU_RST_CTRL); +} +#endif + void board_init_f(ulong dummy) { -#if defined(CONFIG_K3_LOAD_SYSFW) || defined(CONFIG_K3_AM64_DDRSS) +#if defined(CONFIG_K3_LOAD_SYSFW) || defined(CONFIG_K3_AM64_DDRSS) || defined(CONFIG_ESM_K3) struct udevice *dev; int ret; #endif @@ -194,6 +212,20 @@ void board_init_f(ulong dummy) /* Output System Firmware version info */ k3_sysfw_print_ver(); +#if defined(CONFIG_ESM_K3) + /* Probe/configure ESM0 */ + ret = uclass_get_device_by_name(UCLASS_MISC, "esm@42", &dev); + if (ret) + printf("esm main init failed: %d\n", ret); + + /* Probe/configure MCUESM */ + ret = uclass_get_device_by_name(UCLASS_MISC, "esm@410", &dev); + if (ret) + printf("esm mcu init failed: %d\n", ret); + + enable_mcu_esm_reset(); +#endif + #if defined(CONFIG_K3_AM64_DDRSS) ret = uclass_get_device(UCLASS_RAM, 0, &dev); if (ret) -- 2.17.1
[PATCH 1/1] efi_loader: copy GUID in InstallProtocolInterface()
InstallProtocolInterface() is called with a pointer to the protocol GUID. There is not guarantee that the memory used by the caller for the protocol GUID stays allocated. To play it safe the GUID should be copied to U-Boot's internal structures. Reported-by: Joerie de Gram Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 2 +- lib/efi_loader/efi_boottime.c | 14 +++--- lib/efi_loader/efi_image_loader.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index e390d323a9..110d8ae79c 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -342,7 +342,7 @@ struct efi_open_protocol_info_item { */ struct efi_handler { struct list_head link; - const efi_guid_t *guid; + const efi_guid_t guid; void *protocol_interface; struct list_head open_infos; }; diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 82128ac1d5..d0f3e05e70 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -552,7 +552,7 @@ efi_status_t efi_search_protocol(const efi_handle_t handle, struct efi_handler *protocol; protocol = list_entry(lhandle, struct efi_handler, link); - if (!guidcmp(protocol->guid, protocol_guid)) { + if (!guidcmp(&protocol->guid, protocol_guid)) { if (handler) *handler = protocol; return EFI_SUCCESS; @@ -604,7 +604,7 @@ efi_status_t efi_remove_all_protocols(const efi_handle_t handle) list_for_each_entry_safe(protocol, pos, &efiobj->protocols, link) { efi_status_t ret; - ret = efi_remove_protocol(handle, protocol->guid, + ret = efi_remove_protocol(handle, &protocol->guid, protocol->protocol_interface); if (ret != EFI_SUCCESS) return ret; @@ -1131,7 +1131,7 @@ efi_status_t efi_add_protocol(const efi_handle_t handle, handler = calloc(1, sizeof(struct efi_handler)); if (!handler) return EFI_OUT_OF_RESOURCES; - handler->guid = protocol; + memcpy((void *)&handler->guid, protocol, sizeof(efi_guid_t)); handler->protocol_interface = protocol_interface; INIT_LIST_HEAD(&handler->open_infos); list_add_tail(&handler->link, &efiobj->protocols); @@ -1227,7 +1227,7 @@ static efi_status_t efi_get_drivers(efi_handle_t handle, /* Count all driver associations */ list_for_each_entry(handler, &handle->protocols, link) { - if (protocol && guidcmp(handler->guid, protocol)) + if (protocol && guidcmp(&handler->guid, protocol)) continue; list_for_each_entry(item, &handler->open_infos, link) { if (item->info.attributes & @@ -1249,7 +1249,7 @@ static efi_status_t efi_get_drivers(efi_handle_t handle, return EFI_OUT_OF_RESOURCES; /* Collect unique driver handles */ list_for_each_entry(handler, &handle->protocols, link) { - if (protocol && guidcmp(handler->guid, protocol)) + if (protocol && guidcmp(&handler->guid, protocol)) continue; list_for_each_entry(item, &handler->open_infos, link) { if (item->info.attributes & @@ -2446,7 +2446,7 @@ static efi_status_t EFIAPI efi_protocols_per_handle( protocol = list_entry(protocol_handle, struct efi_handler, link); - (*protocol_buffer)[j] = (void *)protocol->guid; + (*protocol_buffer)[j] = (void *)&protocol->guid; ++j; } } @@ -3094,7 +3094,7 @@ close_next: (efi_handle_t)image_obj) continue; r = EFI_CALL(efi_close_protocol - (efiobj, protocol->guid, + (efiobj, &protocol->guid, info->info.agent_handle, info->info.controller_handle )); diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index 5df35939f7..9611398885 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -91,7 +91,7 @@ void efi_print_image_infos(void *pc) list_for_each_entry(efiobj, &efi_obj_list, link) { list_for_each_entry(handler, &efiobj->protocols, link) { - if (!guidcmp(handler->guid, &efi_guid_loaded_image)) { + if (!guidcmp(&handler->
Re: [PATCH] WIP: Nokia RX-51: Convert to CONFIG_DM_VIDEO
Hi Pali, On Wed, 9 Mar 2022 20:44:50 +0100 Pali Rohár p...@kernel.org wrote: > On Sunday 06 March 2022 11:44:22 Simon Glass wrote: > > Hi Pali, > > > > On Sun, 6 Mar 2022 at 08:25, Pali Rohár wrote: > > > > > > On Sunday 06 March 2022 07:42:03 Simon Glass wrote: > > > > Yes let's go with that. > > > > > > Done, I sent final version of the patch. > > > > > > > > > > > > > Second thing is that CONFIG_VIDEO_LOGO is broken and does > > > > > > > > > > not work even it > > > > > > > > > > is enabled in config file. I do not know why too. > > > > > > > > > > > > > > > > > > > > Any idea? > > > > > > > > > > > > > > > > > > Not yet. There were some logo related changes recently, but > > > > > > > > > if I > > > > > > > > > remember correctly, I tested them on wandboard and nitrogen6q > > > > > > > > > targets and with sandbox, and logo drawing worked there. > > > > > > > > > > > > Can you be more specific than 'broken'? What is broken about it? > > > > > > > > > > Does not work, logo is not drown on the screen. > > > > > > > > See video_bmp_display() - I wonder if the particular depth you are > > > > using is not supported? > > > > > > Depth is 16bit which should be supported. > > > > But apparently isn't , at least in this case :-) > > Yea, something is broken there. > > > > > > > > Anyway you should be able to debug it there or > > > > using the bmp command. The file is drivers/video/u_boot_logo.bmp > > > > > > CONFIG_CMD_BMP=y is broken too. When I enable it then U-Boot freeze > > > after the line 'Loading Environment from ... OK'. > > > > OK I'm not sure why, but please investigate if you have time. > > I have looked at it and do not know. But probably it is because I > somehow have not caught how this new video code works... > > Anyway, I sent documentation update how to run u-boot for n900 in qemu: > https://patchwork.ozlabs.org/project/uboot/patch/20220308175956.4522-1-p...@kernel.org/ > > So it could help other people to look at issues which do not work > correctly in n900's u-boot without need to have n900 hardware. I've tested your v2 patches, and logo drawing works, but the logo appears for short time. Then it is later overwritten by boot menu. -- Anatolij
Re: [PATCH v3] arm: kirkwood: nas220: Add DM Ethernet, SATA, GPIO
Hi Hajo, Please see comments below. On Wed, Mar 9, 2022 at 5:42 AM Hajo Noerenberg wrote: > > On 09.03.2022 at 12:26 Tony Dinh wrote: > > Hi Hajo, > > > > Hi Tony, > > > On Wed, Mar 9, 2022 at 1:27 AM Hajo Noerenberg > > wrote: > >> > >> Bring the NAS220 board up to current standards. This is basically an > >> adaptation of the changes Tony Dinh implemented for the Dockstar board. > >> > >> - Implement the changes to v2 as suggested by Stefan Roese > >> - Add CONFIG_SUPPORT_PASSING_ATAGS et al, otherwise standard Debian > >> flash-kernel pkg is unable to start kernel > > > > I believe CONFIG_SUPPORT_PASSING_ATAGS should no longer be needed. > > Debian mainline kernels have been device-tree based for quite some > > time. Perhaps it is the flash-kernel package that needs to be looked > > at (maybe it failed to include the NAS220 DTB?). FWIW, I have been > > running a custom Debian Kirkwood kernel (with other Kirkwood boards) > > for many years with u-boots that don't have the ATAGS option enabled. > > > > I personally am a big friend of distributions running without changes, i.e. > no modified kernel or similar, and full update support for everything. So I > vote to keep ATAGS support and change this later in line with the > distribution. > > Note: My knowledge of ATAGS and so on is quite limited, so if in doubt I > would follow your thoughts, but would like to consider the above. Sure, I have no strong objection about including the CONFIG_SUPPORT_PASSING_ATAGS! I thought I just pointed out that it might not be necessary. > For reference, this is the relevant part from the flash-kernel database, > other Kirkwood devices (e.g. Dockstar) seem to have different settings: > > Machine: Seagate Blackarmor NAS220 > Kernel-Flavors: kirkwood marvell > DTB-Id: kirkwood-blackarmor-nas220.dtb > DTB-Append: yes > Mtd-Kernel: uimage > Mtd-Initrd: rootfs > U-Boot-Kernel-Address: 0x0004 > U-Boot-Initrd-Address: 0x0080 > Required-Packages: u-boot-tools > > Machine: Seagate FreeAgent Dockstar > Machine: Seagate FreeAgent DockStar > Kernel-Flavors: kirkwood marvell > DTB-Id: kirkwood-dockstar.dtb > DTB-Append: yes > U-Boot-Kernel-Address: 0x8000 > U-Boot-Initrd-Address: 0x0 > Boot-Kernel-Path: /boot/uImage > Boot-Initrd-Path: /boot/uInitrd > Boot-DTB-Path: /boot/dtb > Required-Packages: u-boot-tools The flash-kernel configurations above are practically the same as how the kernel will behave. Both have DTB appended in uImage. The differences are the locations of uImage and initrd. So if you can boot the same Kirkwood kernel on both Dockstar and NAS220, then both u-boots should have the same configuration regarding device-tree and ATAGS. The Dockstar u-boot does not have ATAGS: make dockstar_config grep ATAGS .config # CONFIG_SUPPORT_PASSING_ATAGS is not set But I think we are about to go off topic! I'd be OK with including CONFIG_SUPPORT_PASSING_ATAGS for now. And perhaps we can take this discussion offline to figure out why you need this config for NAS220 but not for Dockstar. Thanks, Tony > Kind regards, > Hajo > > > > > > >> - Add CONFIG_SYS_64BIT_LBA, basic read tests with a 4TB hdd succeed with > >> my NAS220 hardware > >> > >> - Thanks to Stefan and Tony > >> > >> > >> Signed-off-by: Hajo Noerenberg > >> --- > >> board/Seagate/nas220/MAINTAINERS | 1 + > >> board/Seagate/nas220/nas220.c| 68 +++- > >> configs/nas220_defconfig | 16 +++- > >> include/configs/nas220.h | 35 ++-- > >> 4 files changed, 49 insertions(+), 71 deletions(-) > >> > >> diff --git a/board/Seagate/nas220/MAINTAINERS > >> b/board/Seagate/nas220/MAINTAINERS > >> index f2df7ea64f..6033f93cf4 100644 > >> --- a/board/Seagate/nas220/MAINTAINERS > >> +++ b/board/Seagate/nas220/MAINTAINERS > >> @@ -4,3 +4,4 @@ S: Maintained > >> F: board/Seagate/nas220/ > >> F: include/configs/nas220.h > >> F: configs/nas220_defconfig > >> +F: arch/arm/dts/kirkwood-blackarmor-nas220.dts > >> diff --git a/board/Seagate/nas220/nas220.c b/board/Seagate/nas220/nas220.c > >> index cd2bbdad1c..fdbf321ff9 100644 > >> --- a/board/Seagate/nas220/nas220.c > >> +++ b/board/Seagate/nas220/nas220.c > >> @@ -10,17 +10,22 @@ > >> > >> #include > >> #include > >> -#include > >> -#include > >> -#include > >> -#include > >> +#include > >> +#include > >> #include > >> #include > >> -#include > >> -#include > >> +#include > >> +#include > >> +#include > >> > >> DECLARE_GLOBAL_DATA_PTR; > >> > >> +/* blue power led, board power, sata0, sata1 */ > >> +#define NAS220_GE_OE_LOW (~(BIT(12) | BIT(14) | BIT(24) | BIT(28))) > >> +#define NAS220_GE_OE_HIGH (~(0)) > >> +#define NAS220_GE_OE_VAL_LOW (BIT(12) | BIT(14) | BIT(24) | BIT(28)) > >> +#define NAS220_GE_OE_VAL_HIGH (0) > >> + > >> int board_early_init_f(void) > >> { > >> /* > >> @@ -43,9 +48,9 @@ int board_early_init_f(void) > >> MPP9_TW_SCK, > >> MPP10_UART0_T
Re: [PATCH v3 08/19] dm: add tag support
On Wed, Mar 09, 2022 at 01:41:04PM +0200, Ilias Apalodimas wrote: > Hi Akashi-san, > > > Signed-off-by: AKASHI Takahiro > > Reviewed-by: Simon Glass > > --- > > drivers/core/Makefile | 2 +- > > drivers/core/root.c | 2 + > > drivers/core/tag.c| 139 ++ > > include/asm-generic/global_data.h | 4 + > > include/dm/tag.h | 110 +++ > > 5 files changed, 256 insertions(+), 1 deletion(-) > > create mode 100644 drivers/core/tag.c > > create mode 100644 include/dm/tag.h > > > > diff --git a/drivers/core/Makefile b/drivers/core/Makefile > > index 5edd4e413576..3742e7574525 100644 > > --- a/drivers/core/Makefile > > +++ b/drivers/core/Makefile > > @@ -2,7 +2,7 @@ > > # > > # Copyright (c) 2013 Google, Inc > > > > -obj-y += device.o fdtaddr.o lists.o root.o uclass.o util.o > > +obj-y += device.o fdtaddr.o lists.o root.o uclass.o util.o tag.o > > obj-$(CONFIG_$(SPL_TPL_)ACPIGEN) += acpi.o > > obj-$(CONFIG_DEVRES) += devres.o > > obj-$(CONFIG_$(SPL_)DM_DEVICE_REMOVE) += device-remove.o > > diff --git a/drivers/core/root.c b/drivers/core/root.c > > index 8efb4256b27e..86b3884fc674 100644 > > --- a/drivers/core/root.c > > +++ b/drivers/core/root.c > > @@ -199,6 +199,8 @@ int dm_init(bool of_live) > > return ret; > > } > > > > + INIT_LIST_HEAD((struct list_head *)&gd->dmtag_list); > > + > > return 0; > > } > > > > diff --git a/drivers/core/tag.c b/drivers/core/tag.c > > new file mode 100644 > > index ..6829bcd8806c > > --- /dev/null > > +++ b/drivers/core/tag.c > > @@ -0,0 +1,139 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * Copyright (c) 2021 Linaro Limited > > + * Author: AKASHI Takahiro > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +struct udevice; > > + > > +DECLARE_GLOBAL_DATA_PTR; > > + > > +int dev_tag_set_ptr(struct udevice *dev, enum dm_tag_t tag, void *ptr) > > +{ > > + struct dmtag_node *node; > > + > > + if (!dev || tag >= DM_TAG_COUNT) > > + return -EINVAL; > > + > > + list_for_each_entry(node, &gd->dmtag_list, sibling) { > > + if (node->dev == dev && node->tag == tag) > > + return -EEXIST; > > + } > > + > > + node = calloc(sizeof(*node), 1); > > + if (!node) > > + return -ENOSPC; > > Isn't -ENOMEM better here? Ah, yes. > > + > > + node->dev = dev; > > + node->tag = tag; > > + node->ptr = ptr; > > + list_add_tail(&node->sibling, (struct list_head *)&gd->dmtag_list); > > + > > + return 0; > > +} > > + > > +int dev_tag_set_val(struct udevice *dev, enum dm_tag_t tag, ulong val) > > Is this used anywhere else apart from selftests? Currently, no. It exists just for future simpler use cases. -Takahiro Akashi > > +{ > > + struct dmtag_node *node; > > > Thanks > /Ilias
Re: [RFC PATCH v3 1/2] efi_loader: introduce "bootefi bootindex" command
Hi Akashi-san, Ilias, On Wed, 9 Mar 2022 at 22:50, Ilias Apalodimas wrote: > > Hi Kojima-san > > On Wed, Mar 09, 2022 at 11:35:57AM +0900, Takahiro Akashi wrote: > > On Wed, Mar 09, 2022 at 09:47:25AM +0900, Masahisa Kojima wrote: > > > On Tue, 8 Mar 2022 at 23:17, Takahiro Akashi > > > wrote: > > > > > > > > On Tue, Mar 08, 2022 at 11:07:44PM +0900, Masahisa Kojima wrote: > > > > > This commit introduces the new command "bootefi bootindex". > > > > > With this command, user can select which "Boot" option > > > > > to load and execute. > > > > > > > > You can do the same thing with: > > > > $ efidebug boot next 1 (for BOOT0001) > > > > $ bootefi bootmgr > > > > > > Thank you for the information, it is good to know. > > > My only concern is that user needs to enable "efidebug" command > > > for this case, since efidebug implies that it is for debug purpose. > > > > Yeah, that is the point where I and ex-maintainer have never agreed. > > So we have no standard UI for UEFI subsystem on U-Boot until now. > > > > Just FYI, we can do the same thing in yet another way :) > > => env set -e -nv -bs -rt BootNext =0x0001 > > > > Similarly, BootOrder as well. > > > > -Takahiro Akashi > > I also think it's safe to drop this patch. It's indeed an easier way to > load a specific boot index, however the use of bootnext is clearly defined > in the spec. I don't think we need to increase the EFI code more as long > as it's clear to anyone that setting bootnext (note here it has to be set > on each reboot) would have the same result. Thank you for your comment. I will drop this patch and will use BootNext for the same purpose. Thanks, Masahisa Kojima > > Cheers > /Ilias > > > > > Thanks, > > > Masahisa Kojima > > > > > > > > > > > -Takahiro Akashi > > > > > > > > > > > > > Signed-off-by: Masahisa Kojima > > > > > --- > > > > > Changes in v3: > > > > > - newly created > > > > > > > > > > cmd/bootefi.c| 42 > > > > > > > > > > include/efi_loader.h | 1 + > > > > > lib/efi_loader/efi_bootmgr.c | 7 +++--- > > > > > 3 files changed, 46 insertions(+), 4 deletions(-) > > > > > > > > > > diff --git a/cmd/bootefi.c b/cmd/bootefi.c > > > > > index 46eebd5ee2..df86438fec 100644 > > > > > --- a/cmd/bootefi.c > > > > > +++ b/cmd/bootefi.c > > > > > @@ -416,6 +416,30 @@ static int do_efibootmgr(void) > > > > > return CMD_RET_SUCCESS; > > > > > } > > > > > > > > > > +/** > > > > > + * do_efibootindex() - load and execute the specified Boot option > > > > > + * > > > > > + * Return: status code > > > > > + */ > > > > > +static int do_efibootindex(u16 boot_index) > > > > > +{ > > > > > + efi_handle_t handle; > > > > > + efi_status_t ret; > > > > > + void *load_options; > > > > > + > > > > > + ret = efi_try_load_entry(boot_index, &handle, &load_options); > > > > > + if (ret != EFI_SUCCESS) { > > > > > + log_notice("EFI boot manager: failed to load > > > > > Boot%04X\n", boot_index); > > > > > + return CMD_RET_FAILURE; > > > > > + } > > > > > + > > > > > + ret = do_bootefi_exec(handle, load_options); > > > > > + > > > > > + if (ret != EFI_SUCCESS) > > > > > + return CMD_RET_FAILURE; > > > > > + > > > > > + return CMD_RET_SUCCESS; > > > > > +} > > > > > /** > > > > > * do_bootefi_image() - execute EFI binary > > > > > * > > > > > @@ -654,6 +678,22 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int > > > > > flag, int argc, > > > > > return CMD_RET_FAILURE; > > > > > } > > > > > > > > > > + if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) { > > > > > + if (!strcmp(argv[1], "bootindex")) { > > > > > + char *endp; > > > > > + int boot_index; > > > > > + > > > > > + if (argc < 3) > > > > > + return CMD_RET_USAGE; > > > > > + > > > > > + boot_index = (int)hextoul(argv[2], &endp); > > > > > + if (*endp != '\0' || boot_index > 0x) > > > > > + return CMD_RET_USAGE; > > > > > + > > > > > + return do_efibootindex((u16)boot_index); > > > > > + } > > > > > + } > > > > > + > > > > > if (argc > 2) { > > > > > uintptr_t fdt_addr; > > > > > > > > > > @@ -702,6 +742,8 @@ static char bootefi_help_text[] = > > > > > "\n" > > > > > "If specified, the device tree located at > > > > > gets\n" > > > > > "exposed as EFI configuration table.\n" > > > > > + "bootefi bootindex \n" > > > > > + " - load and boot EFI payload based on the specified Boot > > > > > variable.\n" > > > > > #endif > > > > > ; > > > > > #endif > > > > > diff --git a/include/efi_loader.h b/include/efi_loader.h > > > > > index 80a5f1ec01..e5972f5fee 100644 > > > > > --- a/include/efi_loader.h > > > > > +++ b/include/efi_loader.h > > > >
[PATCH 01/15] Convert CONFIG_ARMV7_SECURE_BASE et al to Kconfig
This converts the following to Kconfig: CONFIG_ARMV7_SECURE_BASE CONFIG_ARMV7_SECURE_MAX_SIZE CONFIG_ARMV7_SECURE_RESERVE_SIZE Signed-off-by: Tom Rini --- arch/arm/cpu/armv7/Kconfig | 31 ++ configs/Bananapi_M2_Ultra_defconfig| 1 + configs/LicheePi_Zero_defconfig| 1 + configs/bananapi_m2_berry_defconfig| 1 + configs/mx7ulp_evk_defconfig | 1 + configs/mx7ulp_evk_plugin_defconfig| 1 + configs/pg_wcom_expu1_defconfig| 1 + configs/pg_wcom_expu1_update_defconfig | 1 + configs/pg_wcom_seli8_defconfig| 1 + configs/pg_wcom_seli8_update_defconfig | 1 + configs/pinecube_defconfig | 1 + include/configs/apalis-tk1.h | 4 include/configs/cei-tk1-som.h | 4 include/configs/jetson-tk1.h | 4 include/configs/ls1021aiot.h | 2 -- include/configs/ls1021aqds.h | 2 -- include/configs/ls1021atsn.h | 2 -- include/configs/ls1021atwr.h | 2 -- include/configs/mx7_common.h | 2 -- include/configs/mx7ulp_com.h | 2 -- include/configs/stm32mp15_common.h | 6 - include/configs/sun6i.h| 7 -- include/configs/sun7i.h| 7 -- include/configs/sun8i.h| 10 - 24 files changed, 41 insertions(+), 54 deletions(-) diff --git a/arch/arm/cpu/armv7/Kconfig b/arch/arm/cpu/armv7/Kconfig index 2eeef3cba96c..f1e4e26b8f00 100644 --- a/arch/arm/cpu/armv7/Kconfig +++ b/arch/arm/cpu/armv7/Kconfig @@ -27,6 +27,37 @@ config ARMV7_BOOT_SEC_DEFAULT This can be overridden at run-time by setting the bootm_boot_mode env. variable to "sec" or "nonsec". +config HAS_ARMV7_SECURE_BASE + bool "Enable support for a ahardware secure memory area" + default y if ARCH_LS1021A || ARCH_MX7 || ARCH_MX7ULP || ARCH_STM32MP \ + || MACH_SUN6I || MACH_SUN7I || MACH_SUN8I || TEGRA124 + +config ARMV7_SECURE_BASE + hex "Base address for secure mode memory" + depends on HAS_ARMV7_SECURE_BASE + default 0xfff0 if TEGRA124 + default 0x2ffc if ARCH_STM32MP + default 0x2f00 if ARCH_MX7ULP + default 0x1001 if ARCH_LS1021A + default 0x0090 if ARCH_MX7 + default 0x00044000 if MACH_SUN8I + default 0x0002 if MACH_SUN6I || MACH_SUN7I + +config ARMV7_SECURE_RESERVE_SIZE + hex + depends on TEGRA124 && HAS_ARMV7_SECURE_BASE + default 0x10 + help + Reserve top 1M for secure RAM + +config ARMV7_SECURE_MAX_SIZE + hex + depends on ARMV7_SECURE_BASE && ARCH_STM32MP || MACH_SUN6I \ + || MACH_SUN7I || MACH_SUN8I + default 0xbc00 if MACH_SUN8I && !MACH_SUN8I_H3 + default 0x3c00 if MACH_SUN8I && MACH_SUN8I_H3 + default 0x1 + config ARMV7_VIRT bool "Enable support for hardware virtualization" if EXPERT depends on CPU_V7_HAS_VIRT && ARMV7_NONSEC diff --git a/configs/Bananapi_M2_Ultra_defconfig b/configs/Bananapi_M2_Ultra_defconfig index 8917af3c93ac..a66aef0755ad 100644 --- a/configs/Bananapi_M2_Ultra_defconfig +++ b/configs/Bananapi_M2_Ultra_defconfig @@ -9,6 +9,7 @@ CONFIG_MMC0_CD_PIN="PH13" CONFIG_MMC_SUNXI_SLOT_EXTRA=2 CONFIG_USB1_VBUS_PIN="PH23" CONFIG_USB2_VBUS_PIN="PH23" +# CONFIG_HAS_ARMV7_SECURE_BASE is not set CONFIG_AHCI=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_I2C=y diff --git a/configs/LicheePi_Zero_defconfig b/configs/LicheePi_Zero_defconfig index b50bae9bbdea..9815348badd1 100644 --- a/configs/LicheePi_Zero_defconfig +++ b/configs/LicheePi_Zero_defconfig @@ -4,4 +4,5 @@ CONFIG_DEFAULT_DEVICE_TREE="sun8i-v3s-licheepi-zero" CONFIG_SPL=y CONFIG_MACH_SUN8I_V3S=y CONFIG_DRAM_CLK=360 +# CONFIG_HAS_ARMV7_SECURE_BASE is not set # CONFIG_NETDEVICES is not set diff --git a/configs/bananapi_m2_berry_defconfig b/configs/bananapi_m2_berry_defconfig index 2d65d0fd1989..a35fcdb64e8d 100644 --- a/configs/bananapi_m2_berry_defconfig +++ b/configs/bananapi_m2_berry_defconfig @@ -6,6 +6,7 @@ CONFIG_MACH_SUN8I_R40=y CONFIG_DRAM_CLK=576 CONFIG_MMC0_CD_PIN="PH13" CONFIG_USB1_VBUS_PIN="PH23" +# CONFIG_HAS_ARMV7_SECURE_BASE is not set CONFIG_AHCI=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_I2C=y diff --git a/configs/mx7ulp_evk_defconfig b/configs/mx7ulp_evk_defconfig index 4f641471acbc..192e9df2e49b 100644 --- a/configs/mx7ulp_evk_defconfig +++ b/configs/mx7ulp_evk_defconfig @@ -10,6 +10,7 @@ CONFIG_ENV_OFFSET=0xC CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="imx7ulp-evk" CONFIG_TARGET_MX7ULP_EVK=y +# CONFIG_HAS_ARMV7_SECURE_BASE is not set CONFIG_SYS_LOAD_ADDR=0x6080 CONFIG_OF_BOARD_SETUP=y CONFIG_USE_BOOTCOMMAND=y diff --git a/configs/mx7ulp_evk_plugin_defconfig b/configs/mx7ulp_evk_plugin_defconfig index 0f8e9e886ed0..a152c6e93a8a 100644 --- a/configs/mx7ulp_evk_plugin_defconfig +++ b/configs/mx7ulp_evk_plu
[PATCH 05/15] Convert CONFIG_A008044_WORKAROUND to Kconfig
This converts the following to Kconfig: CONFIG_A008044_WORKAROUND Signed-off-by: Tom Rini --- README | 4 arch/powerpc/cpu/mpc85xx/Kconfig | 7 +++ include/configs/T104xRDB.h | 6 -- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README b/README index 95da83b76414..a8e099485f3d 100644 --- a/README +++ b/README @@ -374,10 +374,6 @@ The following options need to be configured: See Freescale App Note 4493 for more information about this erratum. - CONFIG_A008044_WORKAROUND - Enables a workaround for T1040/T1042 erratum A008044. It is only - required during NAND boot and valid for Rev 1.0 SoC revision - CONFIG_SYS_FSL_CORENET_SNOOPVEC_COREONLY This is the value to write into CCSR offset 0x18600 diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig b/arch/powerpc/cpu/mpc85xx/Kconfig index 0e0b9235ad0e..b06416a90e83 100644 --- a/arch/powerpc/cpu/mpc85xx/Kconfig +++ b/arch/powerpc/cpu/mpc85xx/Kconfig @@ -885,6 +885,12 @@ config A003399_NOR_WORKAROUND Enables a workaround for IFC erratum A003399. It is only required during NOR boot. +config A008044_WORKAROUND + bool + help + Enables a workaround for T1040/T1042 erratum A008044. It is only + required during NAND boot and valid for Rev 1.0 SoC revision + config SYS_FSL_ERRATUM_A004468 bool @@ -967,6 +973,7 @@ config SYS_FSL_ERRATUM_A007907 config SYS_FSL_ERRATUM_A008044 bool + select A008044_WORKAROUND if MTD_RAW_NAND config SYS_FSL_ERRATUM_CPC_A002 bool diff --git a/include/configs/T104xRDB.h b/include/configs/T104xRDB.h index 8a71807679ee..d66ad8c481cb 100644 --- a/include/configs/T104xRDB.h +++ b/include/configs/T104xRDB.h @@ -310,12 +310,6 @@ #define CONFIG_SYS_RAMBOOT #endif -#ifdef CONFIG_SYS_FSL_ERRATUM_A008044 -#if defined(CONFIG_MTD_RAW_NAND) -#define CONFIG_A008044_WORKAROUND -#endif -#endif - #define CONFIG_HWCONFIG /* define to use L1 as initial stack */ -- 2.25.1
[PATCH 08/15] powerpc: Move CONFIG_BPTR_VIRT_ADDR out of CONFIG namespace
This is only used in one file, and is never overridden. Move this out of CONFIG namespace. Signed-off-by: Tom Rini --- arch/powerpc/cpu/mpc85xx/mp.c | 6 +++--- arch/powerpc/include/asm/config.h | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/mp.c b/arch/powerpc/cpu/mpc85xx/mp.c index b1b002c90021..84eb8b466b71 100644 --- a/arch/powerpc/cpu/mpc85xx/mp.c +++ b/arch/powerpc/cpu/mpc85xx/mp.c @@ -456,18 +456,18 @@ void setup_mp(void) flush_cache(bootpg, 4096); /* look for the tlb covering the reset page, there better be one */ - i = find_tlb_idx((void *)CONFIG_BPTR_VIRT_ADDR, 1); + i = find_tlb_idx((void *)BPTR_VIRT_ADDR, 1); /* we found a match */ if (i != -1) { /* map reset page to bootpg so we can copy code there */ disable_tlb(i); - set_tlb(1, CONFIG_BPTR_VIRT_ADDR, bootpg, /* tlb, epn, rpn */ + set_tlb(1, BPTR_VIRT_ADDR, bootpg, /* tlb, epn, rpn */ MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, /* perms, wimge */ 0, i, BOOKE_PAGESZ_4K, 1); /* ts, esel, tsize, iprot */ - memcpy((void *)CONFIG_BPTR_VIRT_ADDR, (void *)fixup, 4096); + memcpy((void *)BPTR_VIRT_ADDR, (void *)fixup, 4096); plat_mp_up(bootpg_map, pagesize); } else { diff --git a/arch/powerpc/include/asm/config.h b/arch/powerpc/include/asm/config.h index 354137124d89..059ffe1fd4f9 100644 --- a/arch/powerpc/include/asm/config.h +++ b/arch/powerpc/include/asm/config.h @@ -31,9 +31,7 @@ * Freescale's default e500 reset page. */ #if (defined(CONFIG_E500) && defined(CONFIG_MP)) -#ifndef CONFIG_BPTR_VIRT_ADDR -#define CONFIG_BPTR_VIRT_ADDR 0xf000 -#endif +#define BPTR_VIRT_ADDR 0xf000 #endif /* Since so many PPC SOCs have a semi-common LBC, define this here */ -- 2.25.1
[PATCH 03/15] Convert CONFIG_ARMV8_SWITCH_TO_EL1 to Kconfig
This converts the following to Kconfig: CONFIG_ARMV8_SWITCH_TO_EL1 As this option isn't enabled anywhere and is for very specific circumstances, it's not an asked Kconfig option and instead noted as something to select. Cc: Alex Nemirovsky Cc: Marek Vasut Cc: Michal Simek Cc: Nobuhiro Iwamatsu Cc: Simon Goldschmidt Cc: Tien Fong Chee Signed-off-by: Tom Rini --- arch/arm/cpu/armv8/Kconfig | 6 ++ include/configs/xilinx_versal.h | 2 -- include/configs/xilinx_zynqmp.h | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv8/Kconfig b/arch/arm/cpu/armv8/Kconfig index 9967376ecab9..8d29393bc0e9 100644 --- a/arch/arm/cpu/armv8/Kconfig +++ b/arch/arm/cpu/armv8/Kconfig @@ -31,6 +31,12 @@ config ARMV8_SET_SMPEN it can be safely enabled when EL2/EL3 initialized SMPEN bit or when CPU implementation doesn't include that register. +config ARMV8_SWITCH_TO_EL1 + bool + help + In some circumstances we need to switch to running in EL1. In + that case, select this option from your target Kconfig entry. + config ARMV8_SPIN_TABLE bool "Support spin-table enable method" depends on ARMV8_MULTIENTRY && OF_LIBFDT diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h index 20f5a7271a20..a8009f236937 100644 --- a/include/configs/xilinx_versal.h +++ b/include/configs/xilinx_versal.h @@ -10,8 +10,6 @@ #ifndef __XILINX_VERSAL_H #define __XILINX_VERSAL_H -/* #define CONFIG_ARMV8_SWITCH_TO_EL1 */ - /* Generic Interrupt Controller Definitions */ #define GICD_BASE 0xF900 #define GICR_BASE 0xF908 diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 1f0da1a4b3e4..27ec3e06270e 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -10,8 +10,6 @@ #ifndef __XILINX_ZYNQMP_H #define __XILINX_ZYNQMP_H -/* #define CONFIG_ARMV8_SWITCH_TO_EL1 */ - /* Generic Interrupt Controller Definitions */ #define GICD_BASE 0xF901 #define GICC_BASE 0xF902 -- 2.25.1
[PATCH 06/15] Convert CONFIG_ARP_TIMEOUT to Kconfig
This converts the following to Kconfig: CONFIG_ARP_TIMEOUT Cc: Ramon Fried Signed-off-by: Tom Rini --- README | 4 arch/arm/mach-mvebu/include/mach/config.h | 1 - configs/aristainetos2c_defconfig| 1 + configs/aristainetos2ccslb_defconfig| 1 + configs/bk4r1_defconfig | 1 + configs/brppt2_defconfig| 1 + configs/clearfog_defconfig | 1 + configs/clearfog_gt_8k_defconfig| 1 + configs/cm_fx6_defconfig| 1 + configs/controlcenterdc_defconfig | 1 + configs/crs305-1g-4s-bit_defconfig | 1 + configs/crs305-1g-4s_defconfig | 1 + configs/crs326-24g-2s-bit_defconfig | 1 + configs/crs326-24g-2s_defconfig | 1 + configs/crs328-4c-20s-4s-bit_defconfig | 1 + configs/crs328-4c-20s-4s_defconfig | 1 + configs/db-88f6720_defconfig| 1 + configs/db-88f6820-amc_defconfig| 1 + configs/db-88f6820-gp_defconfig | 1 + configs/db-mv784mp-gp_defconfig | 1 + configs/db-xc3-24g4xg_defconfig | 1 + configs/dh_imx6_defconfig | 1 + configs/ds414_defconfig | 1 + configs/helios4_defconfig | 1 + configs/imx6q_logic_defconfig | 1 + configs/kp_imx53_defconfig | 1 + configs/kp_imx6q_tpc_defconfig | 1 + configs/marsboard_defconfig | 1 + configs/maxbcm_defconfig| 1 + configs/mvebu_crb_cn9130_defconfig | 1 + configs/mvebu_db-88f3720_defconfig | 1 + configs/mvebu_db_armada8k_defconfig | 1 + configs/mvebu_db_cn9130_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/mvebu_mcbin-88f8040_defconfig | 1 + configs/mvebu_puzzle-m801-88f8040_defconfig | 1 + configs/mx51evk_defconfig | 1 + configs/mx53cx9020_defconfig| 1 + configs/mx53loco_defconfig | 1 + configs/mx53ppd_defconfig | 1 + configs/mx6sabreauto_defconfig | 1 + configs/mx6sabresd_defconfig| 1 + configs/pic32mzdask_defconfig | 1 + configs/riotboard_defconfig | 1 + configs/sama7g5ek_mmc1_defconfig| 1 + configs/sama7g5ek_mmc_defconfig | 1 + configs/socfpga_is1_defconfig | 1 + configs/theadorable_debug_defconfig | 1 + configs/tqma6dl_mba6_mmc_defconfig | 1 + configs/tqma6dl_mba6_spi_defconfig | 1 + configs/tqma6q_mba6_mmc_defconfig | 1 + configs/tqma6q_mba6_spi_defconfig | 1 + configs/tqma6s_mba6_mmc_defconfig | 1 + configs/tqma6s_mba6_spi_defconfig | 1 + configs/turris_mox_defconfig| 1 + configs/turris_omnia_defconfig | 1 + configs/uDPU_defconfig | 1 + configs/x530_defconfig | 1 + include/configs/aristainetos2.h | 2 -- include/configs/bk4r1.h | 3 --- include/configs/brppt2.h| 1 - include/configs/cm_fx6.h| 1 - include/configs/dh_imx6.h | 1 - include/configs/el6x_common.h | 2 -- include/configs/embestmx6boards.h | 2 -- include/configs/imx6_logic.h| 2 -- include/configs/kp_imx53.h | 2 -- include/configs/kp_imx6q_tpc.h | 1 - include/configs/mvebu_armada-37xx.h | 1 - include/configs/mvebu_armada-8k.h | 1 - include/configs/mx51evk.h | 2 -- include/configs/mx53cx9020.h| 2 -- include/configs/mx53loco.h | 2 -- include/configs/mx53ppd.h | 2 -- include/configs/mx6sabre_common.h | 2 -- include/configs/pic32mzdask.h | 1 - include/configs/sama7g5ek.h | 1 - include/configs/socfpga_is1.h | 3 --- include/configs/tqma6.h | 2 -- include/configs/turris_mox.h| 1 - net/Kconfig | 4 net/arp.c | 10 +- 82 files changed, 61 insertions(+), 51 deletions(-) diff --git a/README b/README index a8e099485f3d..220710631a39 100644 --- a/README +++ b/README @@ -1562,10 +1562,6 @@ The following options need to be configured: before giving up the operation. If not defined, a default value of 5 is used. - CONFIG_ARP_TIMEOUT - - Timeout waiting for an ARP reply in milliseconds. - CONFIG_NFS_TIMEOUT Timeout in milliseconds used in NFS protocol. diff --git a/arch/arm/mach-mvebu/include/mach/config.h b/arch/
[PATCH 04/15] Convert CONFIG_A003399_NOR_WORKAROUND to Kconfig
This converts the following to Kconfig: CONFIG_A003399_NOR_WORKAROUND Signed-off-by: Tom Rini --- README | 4 arch/powerpc/cpu/mpc85xx/Kconfig | 7 +++ include/configs/P1010RDB.h | 6 -- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README b/README index 6bb8d6e25bdc..95da83b76414 100644 --- a/README +++ b/README @@ -374,10 +374,6 @@ The following options need to be configured: See Freescale App Note 4493 for more information about this erratum. - CONFIG_A003399_NOR_WORKAROUND - Enables a workaround for IFC erratum A003399. It is only - required during NOR boot. - CONFIG_A008044_WORKAROUND Enables a workaround for T1040/T1042 erratum A008044. It is only required during NAND boot and valid for Rev 1.0 SoC revision diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig b/arch/powerpc/cpu/mpc85xx/Kconfig index a978eea1617a..0e0b9235ad0e 100644 --- a/arch/powerpc/cpu/mpc85xx/Kconfig +++ b/arch/powerpc/cpu/mpc85xx/Kconfig @@ -354,6 +354,7 @@ config ARCH_MPC8560 config ARCH_P1010 bool + select A003399_NOR_WORKAROUND if SYS_FSL_ERRATUM_IFC_A003399 && !SPL select BTB select FSL_LAW select SYS_CACHE_SHIFT_5 @@ -878,6 +879,12 @@ config SYS_CCSRBAR_DEFAULT if changed by pre-boot regime. The value here must match the current value in SoC. If not sure, do not change. +config A003399_NOR_WORKAROUND + bool + help + Enables a workaround for IFC erratum A003399. It is only required + during NOR boot. + config SYS_FSL_ERRATUM_A004468 bool diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h index 5f36951932d4..8fd9eb7bfa64 100644 --- a/include/configs/P1010RDB.h +++ b/include/configs/P1010RDB.h @@ -411,12 +411,6 @@ extern unsigned long get_sdram_size(void); #undef CONFIG_SYS_RAMBOOT #endif -#ifdef CONFIG_SYS_FSL_ERRATUM_IFC_A003399 -#if !defined(CONFIG_SPL) && !defined(CONFIG_SYS_RAMBOOT) -#define CONFIG_A003399_NOR_WORKAROUND -#endif -#endif - #define CONFIG_SYS_INIT_RAM_LOCK #define CONFIG_SYS_INIT_RAM_ADDR 0xffd0 /* stack in RAM */ #define CONFIG_SYS_INIT_RAM_SIZE 0x4000 /* End of used area in RAM */ -- 2.25.1
[PATCH 02/15] arm: sunxi: Remove most SoC-specific config header files
At this point, sunxi-common.h is used for all systems except for some MACH_SUN50I variants. Remove the now basically empty header files and update CONFIG_SYS_CONFIG_NAME to use sunxi-common.h directly. Cc: Jagan Teki Cc: Andre Przywara Signed-off-by: Tom Rini --- arch/arm/mach-sunxi/Kconfig | 12 ++-- include/configs/sun4i.h | 19 --- include/configs/sun5i.h | 19 --- include/configs/sun6i.h | 18 -- include/configs/sun7i.h | 16 include/configs/sun8i.h | 22 -- include/configs/sun9i.h | 20 include/configs/suniv.h | 14 -- 8 files changed, 2 insertions(+), 138 deletions(-) delete mode 100644 include/configs/sun4i.h delete mode 100644 include/configs/sun5i.h delete mode 100644 include/configs/sun6i.h delete mode 100644 include/configs/sun7i.h delete mode 100644 include/configs/sun8i.h delete mode 100644 include/configs/sun9i.h delete mode 100644 include/configs/suniv.h diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 205fe3c9d3ca..2abc00e51154 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -608,16 +608,8 @@ config SYS_CLK_FREQ default 100800 if MACH_SUN50I_H616 config SYS_CONFIG_NAME - default "suniv" if MACH_SUNIV - default "sun4i" if MACH_SUN4I - default "sun5i" if MACH_SUN5I - default "sun6i" if MACH_SUN6I - default "sun7i" if MACH_SUN7I - default "sun8i" if MACH_SUN8I - default "sun9i" if MACH_SUN9I - default "sun50i" if MACH_SUN50I - default "sun50i" if MACH_SUN50I_H6 - default "sun50i" if MACH_SUN50I_H616 + default "sun50i" if MACH_SUN50I || MACH_SUN50I_H6 || MACH_SUN50I_H616 + default "sunxi-common" config SYS_BOARD default "sunxi" diff --git a/include/configs/sun4i.h b/include/configs/sun4i.h deleted file mode 100644 index 0e1baa91bb14.. --- a/include/configs/sun4i.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2012-2013 Henrik Nordstrom - * - * Configuration settings for the Allwinner A10 (sun4i) CPU - */ -#ifndef __CONFIG_H -#define __CONFIG_H - -/* - * A10 specific configuration - */ - -/* - * Include common sunxi configuration where most the settings are - */ -#include - -#endif /* __CONFIG_H */ diff --git a/include/configs/sun5i.h b/include/configs/sun5i.h deleted file mode 100644 index ada18de75374.. --- a/include/configs/sun5i.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2012-2013 Henrik Nordstrom - * - * Configuration settings for the Allwinner A13 (sun5i) CPU - */ -#ifndef __CONFIG_H -#define __CONFIG_H - -/* - * High Level Configuration Options - */ - -/* - * Include common sunxi configuration where most the settings are - */ -#include - -#endif /* __CONFIG_H */ diff --git a/include/configs/sun6i.h b/include/configs/sun6i.h deleted file mode 100644 index 0b1fedda1081.. --- a/include/configs/sun6i.h +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2012-2013 Henrik Nordstrom - * (C) Copyright 2013 Luke Kenneth Casson Leighton - * (C) Copyright 2013 Maxime Ripard - * - * Configuration settings for the Allwinner A31 (sun6i) CPU - */ - -#ifndef __CONFIG_H -#define __CONFIG_H - -/* - * Include common sunxi configuration where most the settings are - */ -#include - -#endif /* __CONFIG_H */ diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h deleted file mode 100644 index bc2779fa26f8.. --- a/include/configs/sun7i.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2012-2013 Henrik Nordstrom - * (C) Copyright 2013 Luke Kenneth Casson Leighton - * - * Configuration settings for the Allwinner A20 (sun7i) CPU - */ -#ifndef __CONFIG_H -#define __CONFIG_H - -/* - * Include common sunxi configuration where most the settings are - */ -#include - -#endif /* __CONFIG_H */ diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h deleted file mode 100644 index 106139d0904a.. --- a/include/configs/sun8i.h +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2014 Chen-Yu Tsai - * - * Configuration settings for the Allwinner A23 (sun8i) CPU - */ - -#ifndef __CONFIG_H -#define __CONFIG_H - -/* - * A23 specific configuration - */ - -#include - -/* - * Include common sunxi configuration where most the settings are - */ -#include - -#endif /* __CONFIG_H */ diff --git a/include/configs/sun9i.h b/include/configs/sun9i.h deleted file mode 100644 index 6ee08cf0d95e.. --- a/include/configs/sun9i.h +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2015 Hans de Goede - * - * Configuration settings for the Allwinner A80 (sun9i) CPU
[PATCH 09/15] Convert CONFIG_BOOT_RETRY_TIME et al to Kconfig
This converts the following to Kconfig: CONFIG_BOOT_RETRY_TIME CONFIG_BOOT_RETRY_MIN CONFIG_RESET_TO_RETRY We also introduce CONFIG_BOOT_RETRY to gate these options, and clean up the associated Makefile entry and C code for picking default values of CONFIG_BOOT_RETRY_MIN. Signed-off-by: Tom Rini --- boot/Kconfig | 30 ++ boot/Makefile | 6 +- boot/bootretry.c | 4 configs/am335x_shc_defconfig | 3 +++ configs/am335x_shc_netboot_defconfig | 3 +++ configs/am335x_shc_sdboot_defconfig| 3 +++ configs/draco_defconfig| 3 +++ configs/eb_cpu5282_defconfig | 3 +++ configs/eb_cpu5282_internal_defconfig | 3 +++ configs/etamin_defconfig | 3 +++ configs/highbank_defconfig | 3 +++ configs/ids8313_defconfig | 4 configs/octeontx2_95xx_defconfig | 4 configs/octeontx2_96xx_defconfig | 4 configs/octeontx_81xx_defconfig| 4 configs/octeontx_83xx_defconfig| 4 configs/pxm2_defconfig | 3 +++ configs/rastaban_defconfig | 3 +++ configs/rut_defconfig | 3 +++ configs/socfpga_secu1_defconfig| 3 +++ configs/thuban_defconfig | 3 +++ include/configs/am335x_shc.h | 10 - include/configs/eb_cpu5282.h | 3 --- include/configs/highbank.h | 3 --- include/configs/ids8313.h | 3 --- include/configs/octeontx2_common.h | 5 - include/configs/octeontx_common.h | 5 - include/configs/siemens-am33x-common.h | 4 include/configs/smartweb.h | 1 - include/configs/socfpga_arria5_secu1.h | 9 30 files changed, 90 insertions(+), 52 deletions(-) diff --git a/boot/Kconfig b/boot/Kconfig index b83a4e840002..a395529b1f7c 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -991,6 +991,36 @@ config AUTOBOOT_MENU_SHOW environmnent variable (if enabled) and before handling the boot delay. See README.bootmenu for more details. +config BOOT_RETRY + bool "Boot retry feature" + help + Allow for having the U-Boot command prompt time out and attempt + to boot again. If the environment variable "bootretry" is found then + its value is used, otherwise the retry timeout is + CONFIG_BOOT_RETRY_TIME. CONFIG_BOOT_RETRY_MIN is optional and + defaults to CONFIG_BOOT_RETRY_TIME. All times are in seconds. + +config BOOT_RETRY_TIME + int "Timeout in seconds before attempting to boot again" + depends on BOOT_RETRY + help + Time in seconds before the U-Boot prompt will timeout and boot will + be attempted again. + +config BOOT_RETRY_MIN + int "Minimum timeout in seconds for 'bootretry'" + depends on BOOT_RETRY + default BOOT_RETRY_TIME + help + The minimum time in seconds that "bootretry" can be set to. + +config RESET_TO_RETRY + bool "Reset the board to retry autoboot" + depends on BOOT_RETRY + help + After the countdown timed out, the board will be reset to restart + again. + endmenu config USE_BOOTARGS diff --git a/boot/Makefile b/boot/Makefile index 2938c3f14583..75366c85c657 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -5,11 +5,7 @@ ifndef CONFIG_SPL_BUILD -# This option is not just y/n - it can have a numeric value -ifdef CONFIG_BOOT_RETRY_TIME -obj-y += bootretry.o -endif - +obj-$(CONFIG_BOOT_RETRY) += bootretry.o obj-$(CONFIG_CMD_BOOTM) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o bootm_os.o obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o diff --git a/boot/bootretry.c b/boot/bootretry.c index dac891fbc5e3..2bc9c6866e03 100644 --- a/boot/bootretry.c +++ b/boot/bootretry.c @@ -12,10 +12,6 @@ #include #include -#ifndef CONFIG_BOOT_RETRY_MIN -#define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME -#endif - static uint64_t endtime; /* must be set, default is instant timeout */ static int retry_time = -1; /* -1 so can call readline before main_loop */ diff --git a/configs/am335x_shc_defconfig b/configs/am335x_shc_defconfig index 212c884e62d6..5953193bc240 100644 --- a/configs/am335x_shc_defconfig +++ b/configs/am335x_shc_defconfig @@ -23,6 +23,9 @@ CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_PROMPT="Enter 'shc' to enter prompt (times out) %d \nEnter 'noautoboot' to enter prompt without timeout\n" CONFIG_AUTOBOOT_DELAY_STR="shc" CONFIG_AUTOBOOT_STOP_STR="noautoboot" +CONFIG_BOOT_RETRY=y +CONFIG_BOOT_RETRY_TIME=30 +CONFIG_RESET_TO_RETRY=y CONFIG_BOOTCOMMAND="if mmc dev 1; mmc rescan; then run emmc_setup; else echo ERROR: eMMC device not detected!; panic; fi; if run loaduimage; then run mmcboot; else echo ERROR Unable to load uImage from eMMC!; echo Performing Rollback!; setenv _active_ ${active_root}; setenv _inac
[PATCH 10/15] Convert CONFIG_NFS_TIMEOUT to Kconfig
This converts the following to Kconfig: CONFIG_NFS_TIMEOUT Cc: Ramon Fried Signed-off-by: Tom Rini --- README | 7 --- cmd/Kconfig | 9 + configs/kzm9g_defconfig | 1 + include/configs/kzm9g.h | 2 -- net/nfs.c | 9 ++--- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/README b/README index 227eb29a8902..b8b508f8a9c1 100644 --- a/README +++ b/README @@ -1555,13 +1555,6 @@ The following options need to be configured: FLAGADM - Error Recovery: - CONFIG_NFS_TIMEOUT - - Timeout in milliseconds used in NFS protocol. - If you encounter "ERROR: Cannot umount" in nfs command, - try longer timeout such as - #define CONFIG_NFS_TIMEOUT 1UL - Note: In the current implementation, the local variables diff --git a/cmd/Kconfig b/cmd/Kconfig index d10deed244b3..7790cf3201bd 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1638,6 +1638,15 @@ config CMD_NFS help Boot image via network using NFS protocol. +config NFS_TIMEOUT + int "Timeout in milliseconds for NFS mounts" + depends on CMD_NFS + default 2000 + help + Timeout in milliseconds used in NFS protocol. If you encounter + "ERROR: Cannot umount" in nfs command, try longer timeout such as + 1. + config CMD_MII bool "mii" imply CMD_MDIO diff --git a/configs/kzm9g_defconfig b/configs/kzm9g_defconfig index 867673f57358..e790072e539f 100644 --- a/configs/kzm9g_defconfig +++ b/configs/kzm9g_defconfig @@ -21,6 +21,7 @@ CONFIG_CMD_IMLS=y CONFIG_CMD_I2C=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_DHCP=y +CONFIG_NFS_TIMEOUT=1 CONFIG_CMD_PING=y CONFIG_CMD_FAT=y CONFIG_ENV_IS_IN_FLASH=y diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h index 022858f69282..42f881b0be9f 100644 --- a/include/configs/kzm9g.h +++ b/include/configs/kzm9g.h @@ -71,6 +71,4 @@ #define CONFIG_SH_SCIF_CLK_FREQ get_board_sys_clk() #define TMU_CLK_DIVIDER(4) /* 4 (default), 16, 64, 256 or 1024 */ -#define CONFIG_NFS_TIMEOUT 1UL - #endif /* __KZM9G_H */ diff --git a/net/nfs.c b/net/nfs.c index 70d0e08bde92..3c01cebd96f8 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -40,11 +40,6 @@ #define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ #define NFS_RETRY_COUNT 30 -#ifndef CONFIG_NFS_TIMEOUT -# define NFS_TIMEOUT 2000UL -#else -# define NFS_TIMEOUT CONFIG_NFS_TIMEOUT -#endif #define NFS_RPC_ERR1 #define NFS_RPC_DROP 124 @@ -53,7 +48,7 @@ static int fs_mounted; static unsigned long rpc_id; static int nfs_offset = -1; static int nfs_len; -static ulong nfs_timeout = NFS_TIMEOUT; +static const ulong nfs_timeout = CONFIG_NFS_TIMEOUT; static char dirfh[NFS_FHSIZE]; /* NFSv2 / NFSv3 file handle of directory */ static char filefh[NFS3_FHSIZE]; /* NFSv2 / NFSv3 file handle */ @@ -733,7 +728,7 @@ static void nfs_timeout_handler(void) } else { puts("T "); net_set_timeout_handler(nfs_timeout + - NFS_TIMEOUT * nfs_timeout_count, + nfs_timeout * nfs_timeout_count, nfs_timeout_handler); nfs_send(); } -- 2.25.1
[PATCH 11/15] Remove CONFIG_HAS_ETH0 et al symbols
This converts removes the following symbols: CONFIG_HAS_ETH0 CONFIG_HAS_ETH1 CONFIG_HAS_ETH2 CONFIG_HAS_ETH3 This is because at this point, only the ids8313 platform was using the code which was controlled by these symbols. In turn, this code already performs error checking on being able to perform the device tree fixup. Rather than convert these to Kconfig for a single platform, update the code to not need these checks and remove them from all the platforms they were unused on. Cc: Heiko Schocher Signed-off-by: Tom Rini --- arch/powerpc/cpu/mpc83xx/fdt.c | 8 include/configs/M5208EVBE.h | 1 - include/configs/M5275EVB.h | 1 - include/configs/M53017EVB.h | 1 - include/configs/MPC837XERDB.h| 2 -- include/configs/MPC8548CDS.h | 6 -- include/configs/P1010RDB.h | 6 -- include/configs/gazerbeam.h | 3 --- include/configs/ids8313.h| 2 -- include/configs/imx8mp_rsb3720.h | 2 -- include/configs/km/km-mpc8309.h | 1 - include/configs/km/km-mpc83xx.h | 4 include/configs/ls1021aiot.h | 4 include/configs/ls1021aqds.h | 4 include/configs/p1_p2_rdb_pc.h | 4 include/configs/socrates.h | 3 --- 16 files changed, 52 deletions(-) diff --git a/arch/powerpc/cpu/mpc83xx/fdt.c b/arch/powerpc/cpu/mpc83xx/fdt.c index 3393ad562e8d..33b2151f878c 100644 --- a/arch/powerpc/cpu/mpc83xx/fdt.c +++ b/arch/powerpc/cpu/mpc83xx/fdt.c @@ -51,9 +51,6 @@ void ft_cpu_setup(void *blob, struct bd_info *bd) REVID_MAJOR(spridr) >= 2) fdt_fixup_crypto_node(blob, 0x0204); -#if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\ -defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3) ||\ -defined(CONFIG_HAS_ETH4) || defined(CONFIG_HAS_ETH5) #ifdef CONFIG_ARCH_MPC8313 /* * mpc8313e erratum IPIC1 swapped TSEC interrupt ID numbers on rev. 1 @@ -66,7 +63,6 @@ void ft_cpu_setup(void *blob, struct bd_info *bd) nodeoffset = fdt_path_offset(blob, "/aliases"); if (nodeoffset >= 0) { -#if defined(CONFIG_HAS_ETH0) prop = fdt_getprop(blob, nodeoffset, "ethernet0", NULL); if (prop) { u32 tmp[] = { 32, 0x8, 33, 0x8, 34, 0x8 }; @@ -78,8 +74,6 @@ void ft_cpu_setup(void *blob, struct bd_info *bd) fdt_setprop(blob, path, "interrupts", &tmp, sizeof(tmp)); } -#endif -#if defined(CONFIG_HAS_ETH1) prop = fdt_getprop(blob, nodeoffset, "ethernet1", NULL); if (prop) { u32 tmp[] = { 35, 0x8, 36, 0x8, 37, 0x8 }; @@ -91,10 +85,8 @@ void ft_cpu_setup(void *blob, struct bd_info *bd) fdt_setprop(blob, path, "interrupts", &tmp, sizeof(tmp)); } -#endif } } -#endif #endif do_fixup_by_prop_u32(blob, "device_type", "cpu", 4, diff --git a/include/configs/M5208EVBE.h b/include/configs/M5208EVBE.h index e6f42556ffb3..76c85a7f5c38 100644 --- a/include/configs/M5208EVBE.h +++ b/include/configs/M5208EVBE.h @@ -22,7 +22,6 @@ # define CONFIG_SYS_DISCOVER_PHY # define CONFIG_SYS_RX_ETH_BUFFER 8 # define CONFIG_SYS_FAULT_ECHO_LINK_DOWN -# define CONFIG_HAS_ETH1 /* If CONFIG_SYS_DISCOVER_PHY is not defined - hardcoded */ # ifndef CONFIG_SYS_DISCOVER_PHY # define FECDUPLEXFULL diff --git a/include/configs/M5275EVB.h b/include/configs/M5275EVB.h index d95dd8ca860b..e9057ffd9551 100644 --- a/include/configs/M5275EVB.h +++ b/include/configs/M5275EVB.h @@ -40,7 +40,6 @@ #define CONFIG_SYS_DISCOVER_PHY #define CONFIG_SYS_RX_ETH_BUFFER 8 #define CONFIG_SYS_FAULT_ECHO_LINK_DOWN -#define CONFIG_HAS_ETH1 /* If CONFIG_SYS_DISCOVER_PHY is not defined - hardcoded */ #ifndef CONFIG_SYS_DISCOVER_PHY #define FECDUPLEX FULL diff --git a/include/configs/M53017EVB.h b/include/configs/M53017EVB.h index ec701867a806..06eb03b2b8ee 100644 --- a/include/configs/M53017EVB.h +++ b/include/configs/M53017EVB.h @@ -31,7 +31,6 @@ # define CONFIG_SYS_TX_ETH_BUFFER 8 # define CONFIG_SYS_FEC_BUF_USE_SRAM # define CONFIG_SYS_FAULT_ECHO_LINK_DOWN -# define CONFIG_HAS_ETH1 /* If CONFIG_SYS_DISCOVER_PHY is not defined - hardcoded */ # ifndef CONFIG_SYS_DISCOVER_PHY diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h index 8bbc5f477466..39c1e846b356 100644 --- a/include/configs/MPC837XERDB.h +++ b/include/configs/MPC837XERDB.h @@ -250,7 +250,6 @@ #define CONFIG_TSEC1 #ifdef CONFIG_TSEC1 -#define CONFIG_HAS_ETH0 #define CONFIG_TSEC1_NAME "TSEC0" #define CONFIG_SYS_TSEC1_OFFSET0x24000 #define TSEC1_PHY_ADDR 2 @@ -2
[PATCH 13/15] imx: Convert some boards to DM_ETH
A small number of i.MX6/7 and vf610 boards have not enabled DM_ETH yet. Given the state of the rest of the platform, enable DM_ETH. Cc: Alison Wang Cc: Fabio Estevam Cc: Richard Hu Cc: Troy Kisky Cc: Uri Mashiach Signed-off-by: Tom Rini --- I would very much welcome tested and perhaps slightly more complete migrations for these platforms as the deadline passed with v2020.07. But, in order to do more Kconfig migrations as well, I did this quick pass. --- board/boundary/nitrogen6x/nitrogen6x.c | 4 configs/cl-som-imx7_defconfig | 1 + configs/mx6qsabrelite_defconfig| 1 + configs/mx6sxsabreauto_defconfig | 1 + configs/mx6sxsabresd_defconfig | 1 + configs/nitrogen6dl2g_defconfig| 1 + configs/nitrogen6dl_defconfig | 1 + configs/nitrogen6q2g_defconfig | 1 + configs/nitrogen6q_defconfig | 1 + configs/nitrogen6s1g_defconfig | 1 + configs/nitrogen6s_defconfig | 1 + configs/pico-dwarf-imx6ul_defconfig| 1 + configs/pico-hobbit-imx6ul_defconfig | 1 + configs/pico-pi-imx6ul_defconfig | 1 + configs/vf610twr_defconfig | 1 + configs/vf610twr_nand_defconfig| 1 + 16 files changed, 15 insertions(+), 4 deletions(-) diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index 84e14d1124fc..8566c22a98f7 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -356,10 +356,6 @@ int board_eth_init(struct bd_info *bis) goto free_phydev; #endif -#ifdef CONFIG_CI_UDC - /* For otg ethernet*/ - usb_eth_initialize(bis); -#endif return 0; free_phydev: diff --git a/configs/cl-som-imx7_defconfig b/configs/cl-som-imx7_defconfig index 3779e57c60ff..7c708257b486 100644 --- a/configs/cl-som-imx7_defconfig +++ b/configs/cl-som-imx7_defconfig @@ -84,6 +84,7 @@ CONFIG_SPI_FLASH_SST=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_PHYLIB=y CONFIG_PHY_ATHEROS=y +CONFIG_DM_ETH=y CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_POWER_LEGACY=y diff --git a/configs/mx6qsabrelite_defconfig b/configs/mx6qsabrelite_defconfig index 954379f7213f..656ef0d04dab 100644 --- a/configs/mx6qsabrelite_defconfig +++ b/configs/mx6qsabrelite_defconfig @@ -64,6 +64,7 @@ CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y +CONFIG_DM_ETH=y CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PINCTRL=y diff --git a/configs/mx6sxsabreauto_defconfig b/configs/mx6sxsabreauto_defconfig index 790624ed8162..30194a8cde48 100644 --- a/configs/mx6sxsabreauto_defconfig +++ b/configs/mx6sxsabreauto_defconfig @@ -52,6 +52,7 @@ CONFIG_SF_DEFAULT_SPEED=4000 CONFIG_SPI_FLASH_STMICRO=y CONFIG_PHYLIB=y CONFIG_PHY_ATHEROS=y +CONFIG_DM_ETH=y CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PINCTRL=y diff --git a/configs/mx6sxsabresd_defconfig b/configs/mx6sxsabresd_defconfig index cc11d0495a40..b5b0b374f2e5 100644 --- a/configs/mx6sxsabresd_defconfig +++ b/configs/mx6sxsabresd_defconfig @@ -54,6 +54,7 @@ CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_PHYLIB=y CONFIG_PHY_ATHEROS=y +CONFIG_DM_ETH=y CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PCI=y diff --git a/configs/nitrogen6dl2g_defconfig b/configs/nitrogen6dl2g_defconfig index 9a9d0b33556b..848bafeba1e7 100644 --- a/configs/nitrogen6dl2g_defconfig +++ b/configs/nitrogen6dl2g_defconfig @@ -70,6 +70,7 @@ CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y +CONFIG_DM_ETH=y CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PINCTRL=y diff --git a/configs/nitrogen6dl_defconfig b/configs/nitrogen6dl_defconfig index ec7185bd49ef..fa88c0ce289b 100644 --- a/configs/nitrogen6dl_defconfig +++ b/configs/nitrogen6dl_defconfig @@ -70,6 +70,7 @@ CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y +CONFIG_DM_ETH=y CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PINCTRL=y diff --git a/configs/nitrogen6q2g_defconfig b/configs/nitrogen6q2g_defconfig index 46786ba73fe5..8401881c632d 100644 --- a/configs/nitrogen6q2g_defconfig +++ b/configs/nitrogen6q2g_defconfig @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y +CONFIG_DM_ETH=y CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PINCTRL=y diff --git a/configs/nitrogen6q_defconfig b/configs/nitrogen6q_defconfig index 32570b683f25..fe82c0f2f5c4 100644 --- a/configs/nitrogen6q_defconfig +++ b/configs/nitrogen6q_defconfig @@ -72,6 +72,7 @@ CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y +CONFIG_DM_ETH=y CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PINCTRL=y diff --git a/configs/nitrogen6s1g_defconfig b/configs/nitrogen6s1g_defconfig index 4336b1b628ae..8743e32afa97 100644 --- a/configs/nitrogen6s1g_defconfig +++ b/configs/nitrogen6s1g_defconfig @@ -70,6 +70,7 @@ CONFIG_SPI_FLASH_SST=y CONFIG_PHYLIB=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y +CONFIG_DM_ETH=y CONFIG_FEC_MXC=y CONFIG_
[PATCH 07/15] Convert CONFIG_NET_RETRY_COUNT to Kconfig
This converts the following to Kconfig: CONFIG_NET_RETRY_COUNT Cc: Ramon Fried Signed-off-by: Tom Rini --- README| 7 --- arch/arm/mach-mvebu/include/mach/config.h | 7 --- configs/am335x_baltos_defconfig | 1 + configs/am335x_boneblack_vboot_defconfig | 1 + configs/am335x_evm_defconfig | 1 + configs/am335x_evm_spiboot_defconfig | 1 + configs/am335x_guardian_defconfig | 1 + configs/am335x_hs_evm_defconfig | 1 + configs/am335x_hs_evm_uart_defconfig | 1 + configs/am335x_igep003x_defconfig | 1 + configs/am335x_shc_defconfig | 1 + configs/am335x_shc_ict_defconfig | 1 + configs/am335x_shc_netboot_defconfig | 1 + configs/am335x_shc_sdboot_defconfig | 1 + configs/am335x_sl50_defconfig | 1 + configs/am3517_evm_defconfig | 1 + configs/am43xx_evm_defconfig | 1 + configs/am43xx_evm_qspiboot_defconfig | 1 + configs/am43xx_evm_rtconly_defconfig | 1 + configs/am43xx_evm_usbhost_boot_defconfig | 1 + configs/am43xx_hs_evm_defconfig | 1 + configs/am57xx_evm_defconfig | 1 + configs/am57xx_hs_evm_defconfig | 1 + configs/am57xx_hs_evm_usb_defconfig | 1 + configs/at91sam9261ek_dataflash_cs0_defconfig | 1 + configs/at91sam9261ek_dataflash_cs3_defconfig | 1 + configs/at91sam9261ek_nandflash_defconfig | 1 + configs/at91sam9g10ek_dataflash_cs0_defconfig | 1 + configs/at91sam9g10ek_dataflash_cs3_defconfig | 1 + configs/at91sam9g10ek_nandflash_defconfig | 1 + configs/brppt1_mmc_defconfig | 1 + configs/brppt1_nand_defconfig | 1 + configs/brppt1_spi_defconfig | 1 + configs/brppt2_defconfig | 1 + configs/brsmarc1_defconfig| 1 + configs/brxre1_defconfig | 1 + configs/chiliboard_defconfig | 1 + configs/clearfog_defconfig| 1 + configs/clearfog_gt_8k_defconfig | 1 + configs/cm_t335_defconfig | 1 + configs/colibri_pxa270_defconfig | 1 + configs/controlcenterdc_defconfig | 1 + configs/corvus_defconfig | 1 + configs/crs305-1g-4s-bit_defconfig| 1 + configs/crs305-1g-4s_defconfig| 1 + configs/crs326-24g-2s-bit_defconfig | 1 + configs/crs326-24g-2s_defconfig | 1 + configs/crs328-4c-20s-4s-bit_defconfig| 1 + configs/crs328-4c-20s-4s_defconfig| 1 + configs/da850evm_defconfig| 1 + configs/da850evm_direct_nor_defconfig | 1 + configs/da850evm_nand_defconfig | 1 + configs/db-88f6720_defconfig | 1 + configs/db-88f6820-amc_defconfig | 1 + configs/db-88f6820-gp_defconfig | 1 + configs/db-mv784mp-gp_defconfig | 1 + configs/db-xc3-24g4xg_defconfig | 1 + configs/devkit8000_defconfig | 1 + configs/dra7xx_evm_defconfig | 1 + configs/dra7xx_hs_evm_defconfig | 1 + configs/dra7xx_hs_evm_usb_defconfig | 1 + configs/draco_defconfig | 1 + configs/ds414_defconfig | 1 + configs/etamin_defconfig | 1 + configs/ethernut5_defconfig | 1 + configs/gurnard_defconfig | 1 + configs/helios4_defconfig | 1 + configs/k2e_evm_defconfig | 1 + configs/k2e_hs_evm_defconfig | 1 + configs/k2g_evm_defconfig | 1 + configs/k2g_hs_evm_defconfig | 1 + configs/k2hk_evm_defconfig| 1 + configs/k2hk_hs_evm_defconfig | 1 + configs/k2l_evm_defconfig | 1 + configs/k2l_hs_evm_defconfig | 1 + configs/maxbcm_defconfig | 1 + configs/meesc_dataflash_defconfig | 1 + configs/meesc_defconfig | 1 + configs/mvebu_crb_cn9130_defconfig| 1 + configs/mvebu_db-88f3720_defconfig| 1 + configs/mvebu_db_armada8k_defconfig | 1 + configs/mvebu_db_cn9130_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/mvebu_mcbin-88f8040_defconfig | 1 + configs/mvebu_puzzle-m801-88f8040_defconfig | 1 + configs/omapl138_lcdk_defconfig | 1 + configs/phycore-am335x-r2-regor_defconfig | 1 + configs/phycore-am335x-r2-wega_defconfig | 1 + configs/pic32mzdask_defconfig | 1 + configs/pxm2_defconfig| 1 + configs/rasta
[PATCH 14/15] net: fec_mxc: Remove non-DM_ETH code
Now that all boards have been converted, remove the non-DM_ETH code. Cc: Fabio Estevam Cc: Ramon Fried Cc: Stefano Babic Signed-off-by: Tom Rini --- drivers/net/fec_mxc.c | 245 -- 1 file changed, 245 deletions(-) diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 985b03844739..a26927582d22 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -408,20 +408,11 @@ static int fec_get_hwaddr(int dev_id, unsigned char *mac) return !is_valid_ethaddr(mac); } -#ifdef CONFIG_DM_ETH static int fecmxc_set_hwaddr(struct udevice *dev) -#else -static int fec_set_hwaddr(struct eth_device *dev) -#endif { -#ifdef CONFIG_DM_ETH struct fec_priv *fec = dev_get_priv(dev); struct eth_pdata *pdata = dev_get_plat(dev); uchar *mac = pdata->enetaddr; -#else - uchar *mac = dev->enetaddr; - struct fec_priv *fec = (struct fec_priv *)dev->priv; -#endif writel(0, &fec->eth->iaddr1); writel(0, &fec->eth->iaddr2); @@ -468,17 +459,9 @@ static void fec_reg_setup(struct fec_priv *fec) * Start the FEC engine * @param[in] dev Our device to handle */ -#ifdef CONFIG_DM_ETH static int fec_open(struct udevice *dev) -#else -static int fec_open(struct eth_device *edev) -#endif { -#ifdef CONFIG_DM_ETH struct fec_priv *fec = dev_get_priv(dev); -#else - struct fec_priv *fec = (struct fec_priv *)edev->priv; -#endif int speed; ulong addr, size; int i; @@ -589,27 +572,15 @@ static int fec_open(struct eth_device *edev) return 0; } -#ifdef CONFIG_DM_ETH static int fecmxc_init(struct udevice *dev) -#else -static int fec_init(struct eth_device *dev, struct bd_info *bd) -#endif { -#ifdef CONFIG_DM_ETH struct fec_priv *fec = dev_get_priv(dev); -#else - struct fec_priv *fec = (struct fec_priv *)dev->priv; -#endif u8 *mib_ptr = (uint8_t *)&fec->eth->rmon_t_drop; u8 *i; ulong addr; /* Initialize MAC address */ -#ifdef CONFIG_DM_ETH fecmxc_set_hwaddr(dev); -#else - fec_set_hwaddr(dev); -#endif /* Setup transmit descriptors, there are two in total. */ fec_tbd_init(fec); @@ -661,17 +632,9 @@ static int fec_init(struct eth_device *dev, struct bd_info *bd) * Halt the FEC engine * @param[in] dev Our device to handle */ -#ifdef CONFIG_DM_ETH static void fecmxc_halt(struct udevice *dev) -#else -static void fec_halt(struct eth_device *dev) -#endif { -#ifdef CONFIG_DM_ETH struct fec_priv *fec = dev_get_priv(dev); -#else - struct fec_priv *fec = (struct fec_priv *)dev->priv; -#endif int counter = 0x; /* issue graceful stop command to the FEC transmitter if necessary */ @@ -705,11 +668,7 @@ static void fec_halt(struct eth_device *dev) * @param[in] length Data count in bytes * Return: 0 on success */ -#ifdef CONFIG_DM_ETH static int fecmxc_send(struct udevice *dev, void *packet, int length) -#else -static int fec_send(struct eth_device *dev, void *packet, int length) -#endif { unsigned int status; u32 size; @@ -721,11 +680,7 @@ static int fec_send(struct eth_device *dev, void *packet, int length) * This routine transmits one frame. This routine only accepts * 6-byte Ethernet addresses. */ -#ifdef CONFIG_DM_ETH struct fec_priv *fec = dev_get_priv(dev); -#else - struct fec_priv *fec = (struct fec_priv *)dev->priv; -#endif /* * Check for valid length of data. @@ -856,17 +811,9 @@ out: * @param[in] dev Our ethernet device to handle * Return: Length of packet read */ -#ifdef CONFIG_DM_ETH static int fecmxc_recv(struct udevice *dev, int flags, uchar **packetp) -#else -static int fec_recv(struct eth_device *dev) -#endif { -#ifdef CONFIG_DM_ETH struct fec_priv *fec = dev_get_priv(dev); -#else - struct fec_priv *fec = (struct fec_priv *)dev->priv; -#endif struct fec_bd *rbd = &fec->rbd_base[fec->rbd_index]; unsigned long ievent; int frame_length, len = 0; @@ -874,28 +821,19 @@ static int fec_recv(struct eth_device *dev) ulong addr, size, end; int i; -#ifdef CONFIG_DM_ETH *packetp = memalign(ARCH_DMA_MINALIGN, FEC_MAX_PKT_SIZE); if (*packetp == 0) { printf("%s: error allocating packetp\n", __func__); return -ENOMEM; } -#else - ALLOC_CACHE_ALIGN_BUFFER(uchar, buff, FEC_MAX_PKT_SIZE); -#endif /* Check if any critical events have happened */ ievent = readl(&fec->eth->ievent); writel(ievent, &fec->eth->ievent); debug("fec_recv: ievent 0x%lx\n", ievent); if (ievent & FEC_IEVENT_BABR) { -#ifdef CONFIG_DM_ETH fecmxc_halt(dev); fecmxc_init(dev); -#else - fec_halt(dev); - fec_init(dev, fec->bd); -#endif printf("some error: 0x%08lx\n", ievent);
[PATCH 15/15] net: fec_mxc: Drop CONFIG_FEC_XCV_TYPE
With all boards now using DM_ETH we determine the value for CONFIG_FEC_XCV_TYPE at run time, except in the case of the default fall-back. Set the fallback directly now. Cc: Fabio Estevam Cc: Ramon Fried Cc: Stefano Babic Signed-off-by: Tom Rini --- doc/README.fec_mxc | 5 - drivers/net/fec_mxc.c| 10 +++--- include/configs/apalis-imx8x.h | 1 - include/configs/aristainetos2.h | 2 -- include/configs/brppt2.h | 1 - include/configs/capricorn-common.h | 3 --- include/configs/cgtqmx8.h| 1 - include/configs/cl-som-imx7.h| 1 - include/configs/cm_fx6.h | 1 - include/configs/dh_imx6.h| 1 - include/configs/imx6_logic.h | 1 - include/configs/imx8mm-cl-iot-gate.h | 1 - include/configs/imx8mm_beacon.h | 1 - include/configs/imx8mm_evk.h | 1 - include/configs/imx8mm_venice.h | 1 - include/configs/imx8mn_beacon.h | 1 - include/configs/imx8mn_var_som.h | 5 - include/configs/imx8mn_venice.h | 1 - include/configs/imx8mp_evk.h | 1 - include/configs/imx8mp_rsb3720.h | 1 - include/configs/imx8mq_evk.h | 1 - include/configs/imx8mq_phanbell.h| 1 - include/configs/imx8qm_mek.h | 3 --- include/configs/imx8qm_rom7720.h | 3 --- include/configs/imx8qxp_mek.h| 3 --- include/configs/imx8ulp_evk.h| 1 - include/configs/kontron_pitx_imx8m.h | 1 - include/configs/liteboard.h | 1 - include/configs/m53menlo.h | 1 - include/configs/mx6sxsabreauto.h | 2 -- include/configs/mx6sxsabresd.h | 2 -- include/configs/mx6ul_14x14_evk.h| 2 -- include/configs/mxs.h| 7 --- include/configs/nitrogen6x.h | 1 - include/configs/npi_imx6ull.h| 1 - include/configs/o4-imx6ull-nano.h| 4 include/configs/pico-imx6.h | 1 - include/configs/pico-imx6ul.h| 1 - include/configs/pico-imx8mq.h| 1 - include/configs/somlabs_visionsom_6ull.h | 1 - include/configs/tqma6_mba6.h | 2 -- include/configs/tqma6_wru4.h | 1 - include/configs/verdin-imx8mm.h | 1 - include/configs/verdin-imx8mp.h | 1 - include/configs/vf610twr.h | 1 - include/configs/vining_2000.h| 2 -- include/configs/xpress.h | 1 - 47 files changed, 3 insertions(+), 84 deletions(-) diff --git a/doc/README.fec_mxc b/doc/README.fec_mxc index 9ca6ac2fb59d..d17dfb676f79 100644 --- a/doc/README.fec_mxc +++ b/doc/README.fec_mxc @@ -7,11 +7,6 @@ CONFIG_FEC_MXC CONFIG_MII Must be defined if CONFIG_FEC_MXC is defined. -CONFIG_FEC_XCV_TYPE - Defaults to MII100 for 100 Base-tx. - RGMII selects 1000 Base-tx reduced pin count interface. - RMII selects 100 Base-tx reduced pin count interface. - CONFIG_FEC_MXC_SWAP_PACKET Forced on iff MX28. Swaps the bytes order of all words(4 byte units) in the packet. diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index a26927582d22..e8ebef09032a 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -54,10 +54,6 @@ DECLARE_GLOBAL_DATA_PTR; #error "CONFIG_MII has to be defined!" #endif -#ifndef CONFIG_FEC_XCV_TYPE -#define CONFIG_FEC_XCV_TYPE MII100 -#endif - /* * The i.MX28 operates with packets in big endian. We need to swap them before * sending and after receiving. @@ -1269,9 +1265,9 @@ static int fecmxc_probe(struct udevice *dev) priv->xcv_type = RGMII; break; default: - priv->xcv_type = CONFIG_FEC_XCV_TYPE; - printf("Unsupported interface type %d defaulting to %d\n", - priv->interface, priv->xcv_type); + priv->xcv_type = MII100; + printf("Unsupported interface type %d defaulting to MII100\n", + priv->interface); break; } diff --git a/include/configs/apalis-imx8x.h b/include/configs/apalis-imx8x.h index f43e166c908d..71a80f38bbb0 100644 --- a/include/configs/apalis-imx8x.h +++ b/include/configs/apalis-imx8x.h @@ -122,7 +122,6 @@ #define CONFIG_FEC_ENET_DEV 0 #define IMX_FEC_BASE 0x5b04 #define CONFIG_FEC_MXC_PHYADDR 0x4 -#define CONFIG_FEC_XCV_TYPERGMII #define PHY_ANEG_TIMEOUT 2 #endif /* __APALIS_IMX8X_H */ diff --git a/include/configs/aristainetos2.h b/include/configs/aristainetos2.h index 96792028e023..fcf364be8df4 100644 --- a/include/configs/aristainetos2.h +++ b/include/configs/aristainetos2.h @@ -21,8 +21,6 @@ #define CONSOLE_DEV"ttymxc0" #endif -#define CONFIG_FEC_XCV_TYPERGMII - /* Framebuffer */ #define CONFIG_SYS_LDB_CLOCK 28341000
Re: [RFC PATCH v3 2/2] bootmenu: add UEFI and disto_boot entries
On Wed, Mar 09, 2022 at 04:34:42PM +0200, Ilias Apalodimas wrote: > Hi Kojima-san > > On Tue, Mar 08, 2022 at 11:07:45PM +0900, Masahisa Kojima wrote: > > This commit adds the UEFI related menu entries and > > distro_boot entries into the bootmenu. > > > > For UEFI, user can select which UEFI "Boot" option > > to execute, call UEFI bootmgr and UEFI boot variable > > maintenance menu. UEFI bootmgr entry is required to > > correctly handle "BootNext" variable. > > Hmm why? (some more info further down) > > > > > For distro_boot, user can select the boot device > > included in "boot_targets" u-boot environment variable. > > > > The menu example is as follows. > > > > *** U-Boot Boot Menu *** > > > > Boot 1. kernel (bootmenu_0) > > Boot 2. kernel (bootmenu_1) > > Reset board (bootmenu_2) > > debian (BOOT) > > ubuntu (BOOT0001) > > UEFI Boot Manager > > usb0 > > scsi0 > > virtio0 > > dhcp > > UEFI Boot Manager Maintenance > > U-Boot console > > > > Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit > > > > Signed-off-by: Masahisa Kojima > > --- > > Changes in v3: > > - newly created > > > > cmd/bootmenu.c | 268 +++-- > > 1 file changed, 259 insertions(+), 9 deletions(-) > > > > diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c > > index 409ef9a848..a8dc50dcaa 100644 > > --- a/cmd/bootmenu.c > > +++ b/cmd/bootmenu.c > > @@ -3,9 +3,12 @@ > > * (C) Copyright 2011-2013 Pali Rohár > > */ > > > > +#include > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > #include > > @@ -24,11 +27,20 @@ > > */ > > #define MAX_ENV_SIZE (9 + 2 + 1) > > > > +enum boot_type { > > + BOOT_TYPE_NONE = 0, > > + BOOT_TYPE_BOOTMENU, > > + BOOT_TYPE_UEFI, > > + BOOT_TYPE_DISTRO_BOOT, > > +}; > > + > > struct bootmenu_entry { > > unsigned short int num; /* unique number 0 .. MAX_COUNT */ > > char key[3];/* key identifier of number */ > > - char *title;/* title of entry */ > > + u16 *title; /* title of entry */ > > char *command; /* hush command of entry */ > > + enum boot_type type; > > + u16 bootorder; > > struct bootmenu_data *menu; /* this bootmenu */ > > struct bootmenu_entry *next;/* next menu entry (num+1) */ > > }; > > @@ -75,7 +87,12 @@ static void bootmenu_print_entry(void *data) > > if (reverse) > > puts(ANSI_COLOR_REVERSE); > > > > - puts(entry->title); > > + if (entry->type == BOOT_TYPE_BOOTMENU) > > + printf("%ls (bootmenu_%d)", entry->title, entry->bootorder); > > + else if (entry->type == BOOT_TYPE_UEFI) > > + printf("%ls (BOOT%04X)", entry->title, entry->bootorder); > > + else > > + printf("%ls", entry->title); > > > > if (reverse) > > puts(ANSI_COLOR_RESET); > > @@ -87,6 +104,10 @@ static void bootmenu_autoboot_loop(struct bootmenu_data > > *menu, > > int i, c; > > > > if (menu->delay > 0) { > > + /* flush input */ > > + while (tstc()) > > + getchar(); > > + > > printf(ANSI_CURSOR_POSITION, menu->count + 5, 1); > > printf(" Hit any key to stop autoboot: %2d ", menu->delay); > > } > > @@ -300,6 +321,8 @@ static struct bootmenu_data *bootmenu_create(int delay) > > menu->active = (int)simple_strtol(default_str, NULL, 10); > > > > while ((option = bootmenu_getoption(i))) { > > + u16 *buf; > > + > > sep = strchr(option, '='); > > if (!sep) { > > printf("Invalid bootmenu entry: %s\n", option); > > @@ -311,13 +334,13 @@ static struct bootmenu_data *bootmenu_create(int > > delay) > > goto cleanup; > > > > len = sep-option; > > - entry->title = malloc(len + 1); > > + buf = calloc(1, (len + 1) * sizeof(u16)); > > + entry->title = buf; > > if (!entry->title) { > > free(entry); > > goto cleanup; > > } > > - memcpy(entry->title, option, len); > > - entry->title[len] = 0; > > + utf8_utf16_strncpy(&buf, option, len); > > > > len = strlen(sep + 1); > > entry->command = malloc(len + 1); > > @@ -333,6 +356,190 @@ static struct bootmenu_data *bootmenu_create(int > > delay) > > > > entry->num = i; > > entry->menu = menu; > > + entry->type = BOOT_TYPE_BOOTMENU; > > + entry->bootorder = i; > > + entry->next = NULL; > > + > > + if (!iter) > > + menu->first = entry; > > + else > > + iter->next = entry; > > + > > + iter = entry; > > + ++i; > > + > > + if (i == MAX_COUNT -
Re: [PATCH 13/15] imx: Convert some boards to DM_ETH
On 3/9/2022 5:44 PM, Tom Rini wrote: > A small number of i.MX6/7 and vf610 boards have not enabled DM_ETH yet. > Given the state of the rest of the platform, enable DM_ETH. > > Cc: Alison Wang > Cc: Fabio Estevam > Cc: Richard Hu > Cc: Troy Kisky > Cc: Uri Mashiach > Signed-off-by: Tom Rini > --- > I would very much welcome tested and perhaps slightly more complete > migrations for these platforms as the deadline passed with v2020.07. > But, in order to do more Kconfig migrations as well, I did this quick > pass. > --- If I remember correctly, CONFIG_CI_UDC=y has trouble with DM_ETH. Has this been fixed? BR Troy
Re: [PATCH 13/15] imx: Convert some boards to DM_ETH
On Wed, Mar 09, 2022 at 06:07:44PM -0800, Troy Kisky wrote: > On 3/9/2022 5:44 PM, Tom Rini wrote: > > A small number of i.MX6/7 and vf610 boards have not enabled DM_ETH yet. > > Given the state of the rest of the platform, enable DM_ETH. > > > > Cc: Alison Wang > > Cc: Fabio Estevam > > Cc: Richard Hu > > Cc: Troy Kisky > > Cc: Uri Mashiach > > Signed-off-by: Tom Rini > > --- > > I would very much welcome tested and perhaps slightly more complete > > migrations for these platforms as the deadline passed with v2020.07. > > But, in order to do more Kconfig migrations as well, I did this quick > > pass. > > --- > > If I remember correctly, > CONFIG_CI_UDC=y > > has trouble with DM_ETH. Has this been fixed? Given commit cd18f1e6e614 ("imx: ventana: enable dm support for PCI and FEC ethernet") I don't know if it was fixed or simply dropped from the platform as part of the DM_ETH conversion. -- Tom signature.asc Description: PGP signature
Re: [RFC PATCH v3 2/2] bootmenu: add UEFI and disto_boot entries
On Thu, Mar 10, 2022 at 10:50:57AM +0900, Takahiro Akashi wrote: > On Wed, Mar 09, 2022 at 04:34:42PM +0200, Ilias Apalodimas wrote: > > Hi Kojima-san > > > > On Tue, Mar 08, 2022 at 11:07:45PM +0900, Masahisa Kojima wrote: > > > This commit adds the UEFI related menu entries and > > > distro_boot entries into the bootmenu. > > > > > > For UEFI, user can select which UEFI "Boot" option > > > to execute, call UEFI bootmgr and UEFI boot variable > > > maintenance menu. UEFI bootmgr entry is required to > > > correctly handle "BootNext" variable. > > > > Hmm why? (some more info further down) > > > > > > > > For distro_boot, user can select the boot device > > > included in "boot_targets" u-boot environment variable. > > > > > > The menu example is as follows. > > > > > > *** U-Boot Boot Menu *** > > > > > > Boot 1. kernel (bootmenu_0) > > > Boot 2. kernel (bootmenu_1) > > > Reset board (bootmenu_2) > > > debian (BOOT) > > > ubuntu (BOOT0001) > > > UEFI Boot Manager > > > usb0 > > > scsi0 > > > virtio0 > > > dhcp > > > UEFI Boot Manager Maintenance > > > U-Boot console > > > > > > Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit > > > > > > Signed-off-by: Masahisa Kojima > > > --- > > > Changes in v3: > > > - newly created > > > > > > cmd/bootmenu.c | 268 +++-- > > > 1 file changed, 259 insertions(+), 9 deletions(-) > > > > > > diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c > > > index 409ef9a848..a8dc50dcaa 100644 > > > --- a/cmd/bootmenu.c > > > +++ b/cmd/bootmenu.c > > > @@ -3,9 +3,12 @@ > > > * (C) Copyright 2011-2013 Pali Rohár > > > */ > > > > > > +#include > > > #include > > > #include > > > #include > > > +#include > > > +#include > > > #include > > > #include > > > #include > > > @@ -24,11 +27,20 @@ > > > */ > > > #define MAX_ENV_SIZE (9 + 2 + 1) > > > > > > +enum boot_type { > > > + BOOT_TYPE_NONE = 0, > > > + BOOT_TYPE_BOOTMENU, > > > + BOOT_TYPE_UEFI, > > > + BOOT_TYPE_DISTRO_BOOT, > > > +}; > > > + > > > struct bootmenu_entry { > > > unsigned short int num; /* unique number 0 .. MAX_COUNT */ > > > char key[3];/* key identifier of number */ > > > - char *title;/* title of entry */ > > > + u16 *title; /* title of entry */ > > > char *command; /* hush command of entry */ > > > + enum boot_type type; > > > + u16 bootorder; > > > struct bootmenu_data *menu; /* this bootmenu */ > > > struct bootmenu_entry *next;/* next menu entry (num+1) */ > > > }; > > > @@ -75,7 +87,12 @@ static void bootmenu_print_entry(void *data) > > > if (reverse) > > > puts(ANSI_COLOR_REVERSE); > > > > > > - puts(entry->title); > > > + if (entry->type == BOOT_TYPE_BOOTMENU) > > > + printf("%ls (bootmenu_%d)", entry->title, entry->bootorder); > > > + else if (entry->type == BOOT_TYPE_UEFI) > > > + printf("%ls (BOOT%04X)", entry->title, entry->bootorder); > > > + else > > > + printf("%ls", entry->title); > > > > > > if (reverse) > > > puts(ANSI_COLOR_RESET); > > > @@ -87,6 +104,10 @@ static void bootmenu_autoboot_loop(struct > > > bootmenu_data *menu, > > > int i, c; > > > > > > if (menu->delay > 0) { > > > + /* flush input */ > > > + while (tstc()) > > > + getchar(); > > > + > > > printf(ANSI_CURSOR_POSITION, menu->count + 5, 1); > > > printf(" Hit any key to stop autoboot: %2d ", menu->delay); > > > } > > > @@ -300,6 +321,8 @@ static struct bootmenu_data *bootmenu_create(int > > > delay) > > > menu->active = (int)simple_strtol(default_str, NULL, 10); > > > > > > while ((option = bootmenu_getoption(i))) { > > > + u16 *buf; > > > + > > > sep = strchr(option, '='); > > > if (!sep) { > > > printf("Invalid bootmenu entry: %s\n", option); > > > @@ -311,13 +334,13 @@ static struct bootmenu_data *bootmenu_create(int > > > delay) > > > goto cleanup; > > > > > > len = sep-option; > > > - entry->title = malloc(len + 1); > > > + buf = calloc(1, (len + 1) * sizeof(u16)); > > > + entry->title = buf; > > > if (!entry->title) { > > > free(entry); > > > goto cleanup; > > > } > > > - memcpy(entry->title, option, len); > > > - entry->title[len] = 0; > > > + utf8_utf16_strncpy(&buf, option, len); > > > > > > len = strlen(sep + 1); > > > entry->command = malloc(len + 1); > > > @@ -333,6 +356,190 @@ static struct bootmenu_data *bootmenu_create(int > > > delay) > > > > > > entry->num = i; > > > entry->menu = menu; > > > + entry->type = BOOT_TYPE_BOOTMENU; > > > + entry->bootorder = i; > > > + entry->next = NUL
Re: [RFC PATCH v3 2/2] bootmenu: add UEFI and disto_boot entries
Hi Ilias, On Wed, 9 Mar 2022 at 23:34, Ilias Apalodimas wrote: > > Hi Kojima-san > > On Tue, Mar 08, 2022 at 11:07:45PM +0900, Masahisa Kojima wrote: > > This commit adds the UEFI related menu entries and > > distro_boot entries into the bootmenu. > > > > For UEFI, user can select which UEFI "Boot" option > > to execute, call UEFI bootmgr and UEFI boot variable > > maintenance menu. UEFI bootmgr entry is required to > > correctly handle "BootNext" variable. > > Hmm why? (some more info further down) > > > > > For distro_boot, user can select the boot device > > included in "boot_targets" u-boot environment variable. > > > > The menu example is as follows. > > > > *** U-Boot Boot Menu *** > > > > Boot 1. kernel (bootmenu_0) > > Boot 2. kernel (bootmenu_1) > > Reset board (bootmenu_2) > > debian (BOOT) > > ubuntu (BOOT0001) > > UEFI Boot Manager > > usb0 > > scsi0 > > virtio0 > > dhcp > > UEFI Boot Manager Maintenance > > U-Boot console > > > > Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit > > > > Signed-off-by: Masahisa Kojima > > --- > > Changes in v3: > > - newly created > > > > cmd/bootmenu.c | 268 +++-- > > 1 file changed, 259 insertions(+), 9 deletions(-) > > > > diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c > > index 409ef9a848..a8dc50dcaa 100644 > > --- a/cmd/bootmenu.c > > +++ b/cmd/bootmenu.c > > @@ -3,9 +3,12 @@ > > * (C) Copyright 2011-2013 Pali Rohár > > */ > > > > +#include > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > #include > > @@ -24,11 +27,20 @@ > > */ > > #define MAX_ENV_SIZE (9 + 2 + 1) > > > > +enum boot_type { > > + BOOT_TYPE_NONE = 0, > > + BOOT_TYPE_BOOTMENU, > > + BOOT_TYPE_UEFI, > > + BOOT_TYPE_DISTRO_BOOT, > > +}; > > + > > struct bootmenu_entry { > > unsigned short int num; /* unique number 0 .. MAX_COUNT */ > > char key[3];/* key identifier of number */ > > - char *title;/* title of entry */ > > + u16 *title; /* title of entry */ > > char *command; /* hush command of entry */ > > + enum boot_type type; > > + u16 bootorder; > > struct bootmenu_data *menu; /* this bootmenu */ > > struct bootmenu_entry *next;/* next menu entry (num+1) */ > > }; > > @@ -75,7 +87,12 @@ static void bootmenu_print_entry(void *data) > > if (reverse) > > puts(ANSI_COLOR_REVERSE); > > > > - puts(entry->title); > > + if (entry->type == BOOT_TYPE_BOOTMENU) > > + printf("%ls (bootmenu_%d)", entry->title, entry->bootorder); > > + else if (entry->type == BOOT_TYPE_UEFI) > > + printf("%ls (BOOT%04X)", entry->title, entry->bootorder); > > + else > > + printf("%ls", entry->title); > > > > if (reverse) > > puts(ANSI_COLOR_RESET); > > @@ -87,6 +104,10 @@ static void bootmenu_autoboot_loop(struct bootmenu_data > > *menu, > > int i, c; > > > > if (menu->delay > 0) { > > + /* flush input */ > > + while (tstc()) > > + getchar(); > > + > > printf(ANSI_CURSOR_POSITION, menu->count + 5, 1); > > printf(" Hit any key to stop autoboot: %2d ", menu->delay); > > } > > @@ -300,6 +321,8 @@ static struct bootmenu_data *bootmenu_create(int delay) > > menu->active = (int)simple_strtol(default_str, NULL, 10); > > > > while ((option = bootmenu_getoption(i))) { > > + u16 *buf; > > + > > sep = strchr(option, '='); > > if (!sep) { > > printf("Invalid bootmenu entry: %s\n", option); > > @@ -311,13 +334,13 @@ static struct bootmenu_data *bootmenu_create(int > > delay) > > goto cleanup; > > > > len = sep-option; > > - entry->title = malloc(len + 1); > > + buf = calloc(1, (len + 1) * sizeof(u16)); > > + entry->title = buf; > > if (!entry->title) { > > free(entry); > > goto cleanup; > > } > > - memcpy(entry->title, option, len); > > - entry->title[len] = 0; > > + utf8_utf16_strncpy(&buf, option, len); > > > > len = strlen(sep + 1); > > entry->command = malloc(len + 1); > > @@ -333,6 +356,190 @@ static struct bootmenu_data *bootmenu_create(int > > delay) > > > > entry->num = i; > > entry->menu = menu; > > + entry->type = BOOT_TYPE_BOOTMENU; > > + entry->bootorder = i; > > + entry->next = NULL; > > + > > + if (!iter) > > + menu->first = entry; > > + else > > + iter->next = entry; > > + > > +
[PATCH v3] wdt: nuvoton: Add support for Nuvoton
Add watchdog controller driver for NPCM7xx/npcm8xx Signed-off-by: jimliu2 --- Changes for v2: - coding Style cleanup - change register type from struct npcm_wdt to iomem Changes for v3: - remove common.h drivers/watchdog/Kconfig| 6 ++ drivers/watchdog/Makefile | 1 + drivers/watchdog/npcm_wdt.c | 118 3 files changed, 125 insertions(+) create mode 100644 drivers/watchdog/npcm_wdt.c diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index f90f0ca02b..15edcf570f 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -196,6 +196,12 @@ config WDT_MTK The watchdog timer is stopped when initialized. It performs full SoC reset. +config WDT_NPCM + bool "Nuvoton watchdog timer support" + depends on WDT && ARCH_NPCM + help + Nuvoton npcm7xx/npcm8xx watchdog. + config WDT_OCTEONTX bool "OcteonTX core watchdog support" depends on WDT && (ARCH_OCTEONTX || ARCH_OCTEONTX2) diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index a35bd559f5..1089cd21f5 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_WDT_MPC8xx) += mpc8xx_wdt.o obj-$(CONFIG_WDT_MT7620) += mt7620_wdt.o obj-$(CONFIG_WDT_MT7621) += mt7621_wdt.o obj-$(CONFIG_WDT_MTK) += mtk_wdt.o +obj-$(CONFIG_WDT_NPCM) += npcm_wdt.o obj-$(CONFIG_WDT_OCTEONTX) += octeontx_wdt.o obj-$(CONFIG_WDT_OMAP3) += omap_wdt.o obj-$(CONFIG_WDT_SBSA) += sbsa_gwdt.o diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c new file mode 100644 index 00..333c06a4e7 --- /dev/null +++ b/drivers/watchdog/npcm_wdt.c @@ -0,0 +1,118 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2022 Nuvoton Technology, Inc + */ + +#include +#include +#include +#include +#include +#include +#include + +#define NPCM_WTCLK (BIT(10) | BIT(11)) /* Clock divider */ +#define NPCM_WTE BIT(7) /* Enable */ +#define NPCM_WTIE BIT(6) /* Enable irq */ +#define NPCM_WTIS (BIT(4) | BIT(5)) /* Interval selection */ +#define NPCM_WTIF BIT(3) /* Interrupt flag*/ +#define NPCM_WTRF BIT(2) /* Reset flag */ +#define NPCM_WTRE BIT(1) /* Reset enable */ +#define NPCM_WTR BIT(0) /* Reset counter */ + +struct npcm_wdt_priv { + void __iomem *regs; +}; + +static int npcm_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) +{ + struct npcm_wdt_priv *priv = dev_get_priv(dev); + u32 time_out, val; + + time_out = (u32)(timeout_ms) / 1000; + if (time_out < 2) + val = 0x800; + else if (time_out < 3) + val = 0x420; + else if (time_out < 6) + val = 0x810; + else if (time_out < 11) + val = 0x430; + else if (time_out < 22) + val = 0x820; + else if (time_out < 44) + val = 0xC00; + else if (time_out < 87) + val = 0x830; + else if (time_out < 173) + val = 0xC10; + else if (time_out < 688) + val = 0xC20; + else + val = 0xC30; + + val |= NPCM_WTRE | NPCM_WTE | NPCM_WTR | NPCM_WTIE; + writel(val, priv->regs); + + return 0; +} + +static int npcm_wdt_stop(struct udevice *dev) +{ + struct npcm_wdt_priv *priv = dev_get_priv(dev); + + writel(0, priv->regs); + + return 0; +} + +static int npcm_wdt_reset(struct udevice *dev) +{ + struct npcm_wdt_priv *priv = dev_get_priv(dev); + + writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, priv->regs); + udelay(1000); + + return 0; +} + +static int npcm_wdt_of_to_plat(struct udevice *dev) +{ + struct npcm_wdt_priv *priv = dev_get_priv(dev); + + priv->regs = dev_read_addr_ptr(dev); + if (!priv->regs) + return -EINVAL; + + return 0; +} + +static const struct wdt_ops npcm_wdt_ops = { + .start = npcm_wdt_start, + .reset = npcm_wdt_reset, + .stop = npcm_wdt_stop, +}; + +static const struct udevice_id npcm_wdt_ids[] = { + { .compatible = "nuvoton,npcm750-wdt" }, + { .compatible = "nuvoton,npcm845-wdt" }, + { } +}; + +static int npcm_wdt_probe(struct udevice *dev) +{ + debug("%s() wdt%u\n", __func__, dev_seq(dev)); + npcm_wdt_stop(dev); + + return 0; +} + +U_BOOT_DRIVER(npcm_wdt) = { + .name = "npcm_wdt", + .id = UCLASS_WDT, + .of_match = npcm_wdt_ids, + .probe = npcm_wdt_probe, + .priv_auto = sizeof(struct npcm_wdt_priv), + .of_to_plat = npcm_wdt_of_to_plat, + .ops = &npcm_wdt_ops, +}; -- 2.17.1
Re: [RFC PATCH v3 2/2] bootmenu: add UEFI and disto_boot entries
On Thu, 10 Mar 2022 at 11:42, Takahiro Akashi wrote: > > On Thu, Mar 10, 2022 at 10:50:57AM +0900, Takahiro Akashi wrote: > > On Wed, Mar 09, 2022 at 04:34:42PM +0200, Ilias Apalodimas wrote: > > > Hi Kojima-san > > > > > > On Tue, Mar 08, 2022 at 11:07:45PM +0900, Masahisa Kojima wrote: > > > > This commit adds the UEFI related menu entries and > > > > distro_boot entries into the bootmenu. > > > > > > > > For UEFI, user can select which UEFI "Boot" option > > > > to execute, call UEFI bootmgr and UEFI boot variable > > > > maintenance menu. UEFI bootmgr entry is required to > > > > correctly handle "BootNext" variable. > > > > > > Hmm why? (some more info further down) > > > > > > > > > > > For distro_boot, user can select the boot device > > > > included in "boot_targets" u-boot environment variable. > > > > > > > > The menu example is as follows. > > > > > > > > *** U-Boot Boot Menu *** > > > > > > > > Boot 1. kernel (bootmenu_0) > > > > Boot 2. kernel (bootmenu_1) > > > > Reset board (bootmenu_2) > > > > debian (BOOT) > > > > ubuntu (BOOT0001) > > > > UEFI Boot Manager > > > > usb0 > > > > scsi0 > > > > virtio0 > > > > dhcp > > > > UEFI Boot Manager Maintenance > > > > U-Boot console > > > > > > > > Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit > > > > > > > > Signed-off-by: Masahisa Kojima > > > > --- > > > > Changes in v3: > > > > - newly created > > > > > > > > cmd/bootmenu.c | 268 +++-- > > > > 1 file changed, 259 insertions(+), 9 deletions(-) > > > > > > > > diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c > > > > index 409ef9a848..a8dc50dcaa 100644 > > > > --- a/cmd/bootmenu.c > > > > +++ b/cmd/bootmenu.c > > > > @@ -3,9 +3,12 @@ > > > > * (C) Copyright 2011-2013 Pali Rohár > > > > */ > > > > > > > > +#include > > > > #include > > > > #include > > > > #include > > > > +#include > > > > +#include > > > > #include > > > > #include > > > > #include > > > > @@ -24,11 +27,20 @@ > > > > */ > > > > #define MAX_ENV_SIZE (9 + 2 + 1) > > > > > > > > +enum boot_type { > > > > + BOOT_TYPE_NONE = 0, > > > > + BOOT_TYPE_BOOTMENU, > > > > + BOOT_TYPE_UEFI, > > > > + BOOT_TYPE_DISTRO_BOOT, > > > > +}; > > > > + > > > > struct bootmenu_entry { > > > > unsigned short int num; /* unique number 0 .. MAX_COUNT */ > > > > char key[3];/* key identifier of number */ > > > > - char *title;/* title of entry */ > > > > + u16 *title; /* title of entry */ > > > > char *command; /* hush command of entry */ > > > > + enum boot_type type; > > > > + u16 bootorder; > > > > struct bootmenu_data *menu; /* this bootmenu */ > > > > struct bootmenu_entry *next;/* next menu entry (num+1) */ > > > > }; > > > > @@ -75,7 +87,12 @@ static void bootmenu_print_entry(void *data) > > > > if (reverse) > > > > puts(ANSI_COLOR_REVERSE); > > > > > > > > - puts(entry->title); > > > > + if (entry->type == BOOT_TYPE_BOOTMENU) > > > > + printf("%ls (bootmenu_%d)", entry->title, entry->bootorder); > > > > + else if (entry->type == BOOT_TYPE_UEFI) > > > > + printf("%ls (BOOT%04X)", entry->title, entry->bootorder); > > > > + else > > > > + printf("%ls", entry->title); > > > > > > > > if (reverse) > > > > puts(ANSI_COLOR_RESET); > > > > @@ -87,6 +104,10 @@ static void bootmenu_autoboot_loop(struct > > > > bootmenu_data *menu, > > > > int i, c; > > > > > > > > if (menu->delay > 0) { > > > > + /* flush input */ > > > > + while (tstc()) > > > > + getchar(); > > > > + > > > > printf(ANSI_CURSOR_POSITION, menu->count + 5, 1); > > > > printf(" Hit any key to stop autoboot: %2d ", menu->delay); > > > > } > > > > @@ -300,6 +321,8 @@ static struct bootmenu_data *bootmenu_create(int > > > > delay) > > > > menu->active = (int)simple_strtol(default_str, NULL, 10); > > > > > > > > while ((option = bootmenu_getoption(i))) { > > > > + u16 *buf; > > > > + > > > > sep = strchr(option, '='); > > > > if (!sep) { > > > > printf("Invalid bootmenu entry: %s\n", option); > > > > @@ -311,13 +334,13 @@ static struct bootmenu_data *bootmenu_create(int > > > > delay) > > > > goto cleanup; > > > > > > > > len = sep-option; > > > > - entry->title = malloc(len + 1); > > > > + buf = calloc(1, (len + 1) * sizeof(u16)); > > > > + entry->title = buf; > > > > if (!entry->title) { > > > > free(entry); > > > > goto cleanup; > > > > } > > > > - memcpy(entry->title, option, len); > > > > - entry->title[len] = 0; > > > > + utf8_utf16_strncpy(&buf, option, len); > > > > > > > > len = strlen(sep + 1); > > > > entry->command =
Re: [PATCH 11/15] Remove CONFIG_HAS_ETH0 et al symbols
Hello Tom, On 10.03.22 02:44, Tom Rini wrote: > This converts removes the following symbols: >CONFIG_HAS_ETH0 >CONFIG_HAS_ETH1 >CONFIG_HAS_ETH2 >CONFIG_HAS_ETH3 > > This is because at this point, only the ids8313 platform was using the > code which was controlled by these symbols. In turn, this code already > performs error checking on being able to perform the device tree fixup. > Rather than convert these to Kconfig for a single platform, update the > code to not need these checks and remove them from all the platforms > they were unused on. > > Cc: Heiko Schocher > Signed-off-by: Tom Rini > --- > arch/powerpc/cpu/mpc83xx/fdt.c | 8 > include/configs/M5208EVBE.h | 1 - > include/configs/M5275EVB.h | 1 - > include/configs/M53017EVB.h | 1 - > include/configs/MPC837XERDB.h| 2 -- > include/configs/MPC8548CDS.h | 6 -- > include/configs/P1010RDB.h | 6 -- > include/configs/gazerbeam.h | 3 --- > include/configs/ids8313.h| 2 -- > include/configs/imx8mp_rsb3720.h | 2 -- > include/configs/km/km-mpc8309.h | 1 - > include/configs/km/km-mpc83xx.h | 4 > include/configs/ls1021aiot.h | 4 > include/configs/ls1021aqds.h | 4 > include/configs/p1_p2_rdb_pc.h | 4 > include/configs/socrates.h | 3 --- > 16 files changed, 52 deletions(-) Looks good, thanks! Reviewed-by: Heiko Schocher bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: h...@denx.de
Re: [RFC PATCH v3 2/2] bootmenu: add UEFI and disto_boot entries
[...] > > > + command = calloc(1, command_size); > > > + if (!command) { > > > + free(entry->title); > > > + free(load_option); > > > + free(entry); > > > + goto cleanup; > > > + } > > > + snprintf(command, command_size, "bootefi bootindex > > > %X", bootorder[j]); > > > + entry->command = command; > > > + sprintf(entry->key, "%d", i); > > > + entry->num = i; > > > + entry->menu = menu; > > > + entry->type = BOOT_TYPE_UEFI; > > > + entry->bootorder = bootorder[j]; > > > + entry->next = NULL; > > > + > > > + if (!iter) > > > + menu->first = entry; > > > + else > > > + iter->next = entry; > > > + > > > + iter = entry; > > > + ++i; > > > + } > > > + > > > + if (i == MAX_COUNT - 1) > > > + break; > > > + } > > > + free(bootorder); > > > +} > > > + > > > +bootmgr: > > > > Why do we need an entire menu entry if the bootorder is not defined? > > Currently there's no logic in the efibootmgr to look for the standard > > filenames in the ESP (eg bootarm.efi, bootaa64.efi etc) if no boot option > > is defined. Instead this is implement in distro_bootcmd. > > In this version, newly added command "bootefi bootindex " is called > if the user selects one of the "Boot" option, and "bootefi bootindex" > does not handle "BootNext". That's why I think the menu entry simply > call "bootefi bootmgr" is required. > Anyway, I will modify to set "BootNext" and call "bootefi bootmgr" if > the user selects a "Boot" option. > > I think we need to consider the case that "BootNext" is already set > when bootmenu comes up. > In this case, bootmenu must automatically try to boot the load option > of "BootNext" without any user interaction. Good point. Especially if we fix setvariable at runtime for specific boards, capsuleupdates will need this > > > > > I was thinking of something along the lines of: > > 1. bootmenu comes up > > 2. We read all the Boot variables that are defined and add them on the > >menu > > 2a. If the user doesn't explicitly choose a boot option we run 'bootefi > > bootmgr' > > 2b. If the user does select a different option we set BootNext and still > > run 'bootefi bootmgr' > > 3. If there's not Boot option defined, we should in the future add the > >functionality of searching for bootaa64.efi etc in ESP and still just > >launch the efi bootmgr > > Thank you very much for summarizing. > I would like to update as follows. > > 1. bootmenu comes up > 2. If the BootNext is already defined, try to boot with BootNext > without showing bootmenu > 3. We read the BootOrder, then read Boot with the order specified > by BootOrder and add it on the menu (UEFI spec requires to honor the > priorities set in BootOrder variable) > 3a. If the user doesn't explicitly choose a boot option we run 'bootefi > bootmgr' > 3b. If the user does select a different option we set BootNext and still > run 'bootefi bootmgr' > 4. If there's not Boot option defined, we should in the future add the >functionality of searching for bootaa64.efi etc in ESP and still just >launch the efi bootmgr > 4a. If "bootefi bootmgr" returns, run U-Boot "bootcmd" environment variable. > Yep, that looks correct > > > > > + /* Add UEFI Boot Manager entry if available */ > > > + if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) { [...] > > > + free(entry); > > > + goto cleanup; > > > + } > > > > Any idea of how we'll tackle that? We could export the efibootmgr > > functions that deal with this and use them on the edit menu ? > > I guess you are referring the RFC patch[*1] I sent before? > If yes, yes I will reuse them. Yes > Or do you mean the "efidebug" command? > > [*1] > https://lore.kernel.org/u-boot/20220225013257.15674-5-masahisa.koj...@linaro.org/ > > > > > > + > > > + sprintf(entry->key, "%d", i); > > > + > > > + entry->num = i; > > > + entry->menu = menu; > > > + entry->type = BOOT_TYPE_NONE; > > > + entry->next = NULL; > > > + > > > + if (!iter) > > > + menu->first = entry; > > > + else > > > + iter->next = entry; > > > + > > > + iter = entry; > > > + ++i; > > > } > > > > > > /* Add U-Boot console entry at the end */ > > > @@ -353,7 +602,7 @@ static struct bootmenu_data *bootmenu_create(int > > > delay) > > > if (!entry) > > >
[PATCH] mtd: spi-nor: Parse SFDP Command Sequence to change to Octal DDR(8D-8D-8D) mode
Parcing table of SFDP Command Sequence to change to Octal DDR(8D-8D-8D) mode(CSODDR) and following SPI protocol to judge opcode, address, dummy and data. Enabling Octal DDR mode when nor->octal_dtr_enable didn't hook. Signed-off-by: JaimeLiao --- drivers/mtd/spi/spi-nor-core.c | 114 - include/linux/mtd/spi-nor.h| 8 ++- 2 files changed, 120 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index d5d905fa5a..058dd8e889 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -63,6 +63,9 @@ struct sfdp_parameter_header { #define SFDP_SECTOR_MAP_ID 0xff81 /* Sector Map Table */ #define SFDP_SST_ID0x01bf /* Manufacturer specific Table */ #define SFDP_PROFILE1_ID 0xff05 /* xSPI Profile 1.0 Table */ +#define SFDP_CSODDR_ID 0xff0a /* Command Sequences to Change to Octal +* DDR (8D-8D-8D) mode +*/ #define SFDP_SIGNATURE 0x50444653U #define SFDP_JESD216_MAJOR 1 @@ -172,6 +175,11 @@ struct sfdp_header { #define PROFILE1_DWORD5_DUMMY_100MHZ GENMASK(11, 7) #define PROFILE1_DUMMY_DEFAULT 20 +/* Command Sequences to Change to Octal DDR (8D-8D-8D) mode */ +#define CSODDR_LENGTH_OF_CMD GENMASK(31, 24) +#define CSODDR_DWORD1_OF_CMD GENMASK(31, 0) +#define CSODDR_DWORD2_OF_CMD GENMASK(31, 0) + struct sfdp_bfpt { u32 dwords[BFPT_DWORD_MAX]; }; @@ -2434,6 +2442,49 @@ out: return ret; } +/** + * spi_nor_parse_csoddr() - Parse Command Sequences to Change to Octal DDR (8D-8D-8D) + * mode. + * @nor: pointer to a 'struct spi_nor' + * @csoddr_header: pointer to the 'struct sfdp_parameter_header' describing + * the CSODDR table length and version. + * + * Return: 0 on success, -errno otherwise. + */ +static int spi_nor_parse_csoddr(struct spi_nor *nor, + const struct sfdp_parameter_header *csoddr_header) +{ + u32 *table, addr; + size_t len; + int ret, i; + + len = csoddr_header->length * sizeof(*table); + table = kmalloc(len, GFP_KERNEL); + if (!table) + return -ENOMEM; + + addr = SFDP_PARAM_HEADER_PTP(csoddr_header); + ret = spi_nor_read_sfdp(nor, addr, len, table); + if (ret) + goto out; + + /* Fix endianness of the table DWORDs. */ + for (i = 0; i < csoddr_header->length; i++) + table[i] = le32_to_cpu(table[i]); + + /* Each command sequence consists of 2DWORDs(8 bytes) */ + for(i = 0; i < csoddr_header->length/2; i++) { + if(FIELD_GET(CSODDR_LENGTH_OF_CMD, table[2*i])) { + memcpy(&nor->csoddr_cmd[i].cmd_byte[0], &table[2*i], 4); + memcpy(&nor->csoddr_cmd[i].cmd_byte[4], &table[2*i+1], 4); + } + } + +out: + kfree(table); + return ret; +} + /** * spi_nor_parse_sfdp() - parse the Serial Flash Discoverable Parameters. * @nor: pointer to a 'struct spi_nor' @@ -2540,6 +2591,10 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor, err = spi_nor_parse_profile1(nor, param_header, params); break; + case SFDP_CSODDR_ID: + err = spi_nor_parse_csoddr(nor, param_header); + break; + default: break; } @@ -3489,6 +3544,63 @@ static struct spi_nor_fixups mt35xu512aba_fixups = { }; #endif /* CONFIG_SPI_FLASH_MT35XU */ +/** + * spi_nor_generall_octal_dtr_enable() - execute command sequence to enable octal dtr mode. + * @nor: pointer to a 'struct spi_nor' + * + * Command Sequence to change to Octal DTR mode is parcing from SFDP table. + * Executing commands to enable Octal DTR mode. + * + * Return: 0 on success, -errno otherwise. + */ +static int spi_nor_generall_octal_dtr_enable(struct spi_nor *nor) +{ + struct spi_mem_op op; + int ret, i; + u8 opcode, buf, word_buf[2]; + u32 addr; + + /* According SPI protocol for judging combination of commands */ + for(i = 0; i < MAX_COMMAND_SEQUENCE_DTR; i++) { + if(nor->csoddr_cmd[i].cmd_byte[3]) { + if(nor->csoddr_cmd[i].cmd_byte[3] == 1) { + opcode = nor->csoddr_cmd[i].cmd_byte[2]; + ret = nor->write_reg(nor, opcode, NULL, 0); + } else if(nor->csoddr_cmd[i].cmd_byte[3] == 2 ) { + opcode = nor->csoddr_cmd[i].cmd_byte[2]; + buf = nor->csoddr_cmd[i].cmd_byte[1]; + ret = nor->write_reg(nor, opcode, &buf, 1); + } else if(no
Re: [PATCH 03/15] Convert CONFIG_ARMV8_SWITCH_TO_EL1 to Kconfig
Hi Tom, On 3/10/22 02:43, Tom Rini wrote: This converts the following to Kconfig: CONFIG_ARMV8_SWITCH_TO_EL1 As this option isn't enabled anywhere and is for very specific circumstances, it's not an asked Kconfig option and instead noted as something to select. Cc: Alex Nemirovsky Cc: Marek Vasut Cc: Michal Simek Cc: Nobuhiro Iwamatsu Cc: Simon Goldschmidt Cc: Tien Fong Chee Signed-off-by: Tom Rini --- arch/arm/cpu/armv8/Kconfig | 6 ++ include/configs/xilinx_versal.h | 2 -- include/configs/xilinx_zynqmp.h | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv8/Kconfig b/arch/arm/cpu/armv8/Kconfig index 9967376ecab9..8d29393bc0e9 100644 --- a/arch/arm/cpu/armv8/Kconfig +++ b/arch/arm/cpu/armv8/Kconfig @@ -31,6 +31,12 @@ config ARMV8_SET_SMPEN it can be safely enabled when EL2/EL3 initialized SMPEN bit or when CPU implementation doesn't include that register. +config ARMV8_SWITCH_TO_EL1 + bool I think it make sense to be able to enable it via menuconfig to make it selectable based on user wish. I was using it in past to check that we can do clear handoff to EL1 directly. Thanks, Michal
Re: [PATCH] doc: device-tree-bindings: watchdog: document common properties
On 3/9/22 14:56, Philippe Reynes wrote: Adds simple documentation about common properties for watchdog in the device tree. Signed-off-by: Philippe Reynes Reviewed-by: Stefan Roese Thanks, Stefan --- doc/device-tree-bindings/watchdog/common.txt | 12 1 file changed, 12 insertions(+) create mode 100644 doc/device-tree-bindings/watchdog/common.txt diff --git a/doc/device-tree-bindings/watchdog/common.txt b/doc/device-tree-bindings/watchdog/common.txt new file mode 100644 index 00..9db6dd6146 --- /dev/null +++ b/doc/device-tree-bindings/watchdog/common.txt @@ -0,0 +1,12 @@ +Common watchdog properties. + +Optional properties: +- timeout-sec : Timeout of the watchdog in seconds +If this timeout is not defined, the value of WATCHDOG_TIMEOUT_MSECS will +be used instead. +- hw_margin_ms : Period used to reset the watchdog in ms + If this period is not defined, the default value is 1000. +- u-boot,noautostart : Specify that this watchdog should not autostart + When the config option WATCHDOG_AUTOSTART is set, all enabled + watchdogs are started. This property allows specifying that this + watchdog should NOT be started. 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] wdt: nuvoton: Add support for Nuvoton
On 3/10/22 04:50, jimliu2 wrote: Add watchdog controller driver for NPCM7xx/npcm8xx Signed-off-by: jimliu2 Reviewed-by: Stefan Roese Thanks, Stefan --- Changes for v2: - coding Style cleanup - change register type from struct npcm_wdt to iomem Changes for v3: - remove common.h drivers/watchdog/Kconfig| 6 ++ drivers/watchdog/Makefile | 1 + drivers/watchdog/npcm_wdt.c | 118 3 files changed, 125 insertions(+) create mode 100644 drivers/watchdog/npcm_wdt.c diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index f90f0ca02b..15edcf570f 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -196,6 +196,12 @@ config WDT_MTK The watchdog timer is stopped when initialized. It performs full SoC reset. +config WDT_NPCM + bool "Nuvoton watchdog timer support" + depends on WDT && ARCH_NPCM + help + Nuvoton npcm7xx/npcm8xx watchdog. + config WDT_OCTEONTX bool "OcteonTX core watchdog support" depends on WDT && (ARCH_OCTEONTX || ARCH_OCTEONTX2) diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index a35bd559f5..1089cd21f5 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_WDT_MPC8xx) += mpc8xx_wdt.o obj-$(CONFIG_WDT_MT7620) += mt7620_wdt.o obj-$(CONFIG_WDT_MT7621) += mt7621_wdt.o obj-$(CONFIG_WDT_MTK) += mtk_wdt.o +obj-$(CONFIG_WDT_NPCM) += npcm_wdt.o obj-$(CONFIG_WDT_OCTEONTX) += octeontx_wdt.o obj-$(CONFIG_WDT_OMAP3) += omap_wdt.o obj-$(CONFIG_WDT_SBSA) += sbsa_gwdt.o diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c new file mode 100644 index 00..333c06a4e7 --- /dev/null +++ b/drivers/watchdog/npcm_wdt.c @@ -0,0 +1,118 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2022 Nuvoton Technology, Inc + */ + +#include +#include +#include +#include +#include +#include +#include + +#define NPCM_WTCLK (BIT(10) | BIT(11)) /* Clock divider */ +#define NPCM_WTE BIT(7) /* Enable */ +#define NPCM_WTIE BIT(6) /* Enable irq */ +#define NPCM_WTIS (BIT(4) | BIT(5)) /* Interval selection */ +#define NPCM_WTIF BIT(3) /* Interrupt flag*/ +#define NPCM_WTRF BIT(2) /* Reset flag */ +#define NPCM_WTRE BIT(1) /* Reset enable */ +#define NPCM_WTR BIT(0) /* Reset counter */ + +struct npcm_wdt_priv { + void __iomem *regs; +}; + +static int npcm_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) +{ + struct npcm_wdt_priv *priv = dev_get_priv(dev); + u32 time_out, val; + + time_out = (u32)(timeout_ms) / 1000; + if (time_out < 2) + val = 0x800; + else if (time_out < 3) + val = 0x420; + else if (time_out < 6) + val = 0x810; + else if (time_out < 11) + val = 0x430; + else if (time_out < 22) + val = 0x820; + else if (time_out < 44) + val = 0xC00; + else if (time_out < 87) + val = 0x830; + else if (time_out < 173) + val = 0xC10; + else if (time_out < 688) + val = 0xC20; + else + val = 0xC30; + + val |= NPCM_WTRE | NPCM_WTE | NPCM_WTR | NPCM_WTIE; + writel(val, priv->regs); + + return 0; +} + +static int npcm_wdt_stop(struct udevice *dev) +{ + struct npcm_wdt_priv *priv = dev_get_priv(dev); + + writel(0, priv->regs); + + return 0; +} + +static int npcm_wdt_reset(struct udevice *dev) +{ + struct npcm_wdt_priv *priv = dev_get_priv(dev); + + writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, priv->regs); + udelay(1000); + + return 0; +} + +static int npcm_wdt_of_to_plat(struct udevice *dev) +{ + struct npcm_wdt_priv *priv = dev_get_priv(dev); + + priv->regs = dev_read_addr_ptr(dev); + if (!priv->regs) + return -EINVAL; + + return 0; +} + +static const struct wdt_ops npcm_wdt_ops = { + .start = npcm_wdt_start, + .reset = npcm_wdt_reset, + .stop = npcm_wdt_stop, +}; + +static const struct udevice_id npcm_wdt_ids[] = { + { .compatible = "nuvoton,npcm750-wdt" }, + { .compatible = "nuvoton,npcm845-wdt" }, + { } +}; + +static int npcm_wdt_probe(struct udevice *dev) +{ + debug("%s() wdt%u\n", __func__, dev_seq(dev)); + npcm_wdt_stop(dev); + + return 0; +} + +U_BOOT_DRIVER(npcm_wdt) = { + .name = "npcm_wdt", + .id = UCLASS_WDT, + .of_match = npcm_wdt_ids, + .probe = npcm_wdt_probe, + .priv_auto = sizeof(struct npcm_wdt_priv), + .of_to_plat = npcm_wdt_of_to_plat, + .ops = &npcm_wdt_ops, +}; Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 M