Re: [PATCH v3] da9063: Add watchdog support
Hi Fabio, On 10/4/24 14:32, Fabio Estevam wrote: Hi Stefan, On 20/09/2024 07:00, Stefan Roese wrote: Changes since v2: - Use u8 instead of char. (Stefan) - Keep the Copyright header from Linux. (Stfan) Reviewed-by: Stefan Roese Would it be OK if I take this patch via the u-boot-imx tree? I have a patch that adds the DA9063 watchdog support to the imx6q-lxr2 board. Sure, please pull it in if this makes sense for you. Thanks, Stefan
Re: [PATCH 00/13] disentangling cyclic API from schedule()
Hi Rasmus, On 10/3/24 23:27, Rasmus Villemoes wrote: These patches are part of a longer-term plan to properly deal with the HW_WATCHDOG vs WATCHDOG dichotomy, and getting rid of the legacy HW_WATCHDOG concept completely. As part of that, clean up which headers include other headers. While schedule(), the artist formerly known as WATCHDOG_RESET(), is obviously called all over the tree, very few TUs make use of the cyclic API (cyclic_register etc.). And there's really no reason at all for global_data.h to include cyclic.h - except that some places implicitly rely on getting their declaration of schedule() through that include. So this introduces a separate mostly trivial header that just serves to declare schedule(). Then we can get rid of things that include cyclic.h just to get that declaration. A next, mostly mechanical step, could be to change almost all includes of watchdog.h (which most TUs that used to have a WATCHDOG_RESET() invocation has) to u-boot/schedule.h, because again, most of those TUs are not really concerned with implementing init_func_watchdog_init or need to call it. But that is for later. CI seems happy: https://github.com/u-boot/u-boot/pull/673 Rasmus Villemoes (13): doc: cyclic: remove reference to WATCHDOG_RESET cyclic: introduce u-boot/schedule.h led: include cyclic.h in led_sw_blink.c m68k: asm/ptrace.h: include linux/types.h fs/cramfs: use schedule instead of cyclic_run as callback test: dm: wdt: replace cyclic_run() by schedule() cyclic: make cyclic_run static watchdog.h: change include of cyclic.h to u-boot/schedule.h lib/sha*: include u-boot/schedule.h instead of cyclic.h i2c: rzg2l: include u-boot/schedule.h ddr: altera: include u-boot/schedule.h boot: cedit: include u-boot/schedule.h global_data.h: remove unnecesary include of cyclic.h arch/m68k/include/asm/ptrace.h| 2 ++ boot/cedit.c | 1 + common/cyclic.c | 3 ++- doc/develop/cyclic.rst| 10 +- drivers/ddr/altera/sdram_n5x.c| 1 + drivers/ddr/altera/sdram_soc64.c | 1 + drivers/i2c/rz_riic.c | 1 + drivers/led/led_sw_blink.c| 1 + fs/cramfs/uncompress.c| 4 ++-- include/asm-generic/global_data.h | 1 - include/cyclic.h | 24 +--- include/u-boot/schedule.h | 24 include/watchdog.h| 2 +- lib/sha1.c| 2 +- lib/sha256.c | 2 +- lib/sha512.c | 2 +- test/dm/wdt.c | 10 +- 17 files changed, 50 insertions(+), 41 deletions(-) create mode 100644 include/u-boot/schedule.h Thanks for this work - really appreciated. I'm leaving for vacation pretty soon. Will take a closer look at these patches in roughly 2 weeks. Thanks, Stefan
Re: [PATCH v3] da9063: Add watchdog support
Hi Fabio, On 9/17/24 15:55, Fabio Estevam wrote: From: Fabio Estevam The DA9063 PMIC is a multi-function device that provides regulator, watchdog, RTC, and ON key functionalities. Add support for the DA9063 PMIC watchdog functionality. Based on the 6.11 kernel drivers/watchdog/da9063_wdt.c driver. Signed-off-by: Fabio Estevam --- Changes since v2: - Use u8 instead of char. (Stefan) - Keep the Copyright header from Linux. (Stfan) Reviewed-by: Stefan Roese Thanks, Stefan drivers/power/pmic/da9063.c | 12 ++- drivers/watchdog/Kconfig | 6 ++ drivers/watchdog/Makefile | 1 + drivers/watchdog/da9063-wdt.c | 149 ++ 4 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 drivers/watchdog/da9063-wdt.c diff --git a/drivers/power/pmic/da9063.c b/drivers/power/pmic/da9063.c index 7bd3df391421..59c65702863c 100644 --- a/drivers/power/pmic/da9063.c +++ b/drivers/power/pmic/da9063.c @@ -7,6 +7,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -86,6 +89,7 @@ static int da9063_read(struct udevice *dev, uint reg, uint8_t *buff, int len) static int da9063_bind(struct udevice *dev) { ofnode regulators_node; + struct driver *drv; int children; regulators_node = dev_read_subnode(dev, "regulators"); @@ -101,8 +105,12 @@ static int da9063_bind(struct udevice *dev) if (!children) debug("%s: %s - no child found\n", __func__, dev->name); - /* Always return success for this device */ - return 0; + drv = lists_driver_lookup_name("da9063-wdt"); + if (!drv) + return 0; + + return device_bind_with_driver_data(dev, drv, "da9063-wdt", dev->driver_data, + dev_ofnode(dev), &dev); } static int da9063_probe(struct udevice *dev) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 0c3e99133186..90bc5653ee33 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -169,6 +169,12 @@ config WDT_CORTINA This driver support all CPU ISAs supported by Cortina Access CA SoCs. +config WDT_DA9063 + bool "DA9063 watchdog timer support" + depends on WDT && DM_PMIC_DA9063 + help + Enable support for the watchdog timer in Dialog DA9063. + config WDT_GPIO bool "External gpio watchdog support" depends on WDT diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 7b39adcf0ff4..6b564b7f96d2 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -29,6 +29,7 @@ obj-$(CONFIG_WDT_BOOKE) += booke_wdt.o obj-$(CONFIG_WDT_CORTINA) += cortina_wdt.o obj-$(CONFIG_WDT_ORION) += orion_wdt.o obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o +obj-$(CONFIG_WDT_DA9063) += da9063-wdt.o obj-$(CONFIG_WDT_FTWDT010) += ftwdt010_wdt.o obj-$(CONFIG_WDT_GPIO) += gpio_wdt.o obj-$(CONFIG_WDT_MAX6370) += max6370_wdt.o diff --git a/drivers/watchdog/da9063-wdt.c b/drivers/watchdog/da9063-wdt.c new file mode 100644 index ..b7216b578630 --- /dev/null +++ b/drivers/watchdog/da9063-wdt.c @@ -0,0 +1,149 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Based on the Linux drivers/watchdog/da9063_wdt.c file. + * + * Watchdog driver for DA9063 PMICs. + * + * Copyright(c) 2012 Dialog Semiconductor Ltd. + * + * Author: Mariusz Wojtasik + * + * Ported to U-Boot by Fabio Estevam + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#defineDA9063_REG_CONTROL_D0x11 +/* DA9063_REG_CONTROL_D (addr=0x11) */ +#defineDA9063_TWDSCALE_MASK0x0 +#define DA9063_TWDSCALE_DISABLE0 +#defineDA9063_REG_CONTROL_F0x13 +/* DA9063_REG_CONTROL_F (addr=0x13) */ +#defineDA9063_WATCHDOG 0x01 +#defineDA9063_SHUTDOWN 0x02 + +/* + * Watchdog selector to timeout in seconds. + * 0: WDT disabled; + * others: timeout = 2048 ms * 2^(TWDSCALE-1). + */ +static const unsigned int wdt_timeout[] = { 0, 2, 4, 8, 16, 32, 65, 131 }; + +#define DA9063_TWDSCALE_DISABLE0 +#define DA9063_TWDSCALE_MIN1 +#define DA9063_TWDSCALE_MAX(ARRAY_SIZE(wdt_timeout) - 1) + +static unsigned int da9063_wdt_timeout_to_sel(unsigned int secs) +{ + unsigned int i; + + for (i = DA9063_TWDSCALE_MIN; i <= DA9063_TWDSCALE_MAX; i++) { + if (wdt_timeout[i] >= secs) + return i; + } + + return DA9063_TWDSCALE_MAX; +} + +static int da9063_read(struct udevice *dev, uint reg, uint8_t *buff, int len) +{ + return dm_i2c_read(dev->parent, reg, buff, len); +} + +static int da9063_write(struct udevice *dev, uint reg, const u8 *buff, int len) +{ + return dm_i2c_write(dev-
Re: [PATCH v4 0/6] rpi5: initial support
Hi Ivan, Thanks for the quick response! On 2024-09-19 11:52, Ivan T. Ivanov wrote: > Hi Stefan, > >> On 19 Sep 2024, at 12:36, Stefan Agner wrote: >> >> Hi Ivan, >> >> I am looking into enabling NVMe boot support using U-Boot on Raspberry >> Pi 5. Which brings me to some questions wrt PCIe support (see below). >> >> On 2024-01-10 13:29, Ivan T. Ivanov wrote: >>> > > >>> * I am dropping PCIe patch for now. I made some progress on porting changes >>> from vendor Linux tree to U-Boot. Unfortunatly testing it is little bit >>> tricky. They are many devices behind PCIe, but more or less all of them >>> requires missing either "reset-controller" or "clock-controller" or >>> "pin-controller" drivers. I was able to probe "cdns,macb" device, but >>> access to ethernet PHY over MDIO bus is stucking. Then I ported >>> "raspberrypi,rp1-adc" driver from vendor Linux tree, but it requires >>> missing clock. And on top of that machine that I used for developing this >>> crashed and I lost my PCIe changes :-|. Anyway. >> >> Have you tried using a M.2 HAT? This likely won't require much in terms >> of enabling the device. >> >> You write that you made some progress, is that compared to v3? Do you >> mind sharing the latest version of your patches? > > > No further progress on PCIe for U-Boot from my side was made, sorry. > So v3 the patch you've shared in v3 is your latest state? I was wondering since you wrote in this v4 patch set "I made some progress on porting changes from vendor Linux tree to U-Boot."... > Stan is working on adding support for 2712 PCIe in Linux [1]. Perhaps > once this is complete we can work on adding U-Boot support for the same, > unless someone don’t beat us, of course. Hm, it seems the link did not make it. I guess you meant to link this patch set [1] -- Stefan [1] https://lore.kernel.org/lkml/20240910151845.17308-1-svarba...@suse.de/T/ > > Regards, > Ivan
Re: [PATCH v4 0/6] rpi5: initial support
Hi Ivan, I am looking into enabling NVMe boot support using U-Boot on Raspberry Pi 5. Which brings me to some questions wrt PCIe support (see below). On 2024-01-10 13:29, Ivan T. Ivanov wrote: > Hi, > > These patches are slight update for patches posted earlier here[1]. > They are adding basic support for RPi5 and are based on v2 series > from Dmitry Malkin[2]. > > What changed: > > * Initial memory map now includes whole first 1GB of DRAM. At runtime, > the firmware will adjust this size depending on whether an HDMI cable > is plugged in or not. If there is HDMI monitor connected it will reserve > framebufer memory region and will add simple-framebuffer device into > devicetree. > > * Dynamically calculate bits per pixel in video driver. This works > on all prevous RPi's models that I have. > > * I am dropping PCIe patch for now. I made some progress on porting changes > from vendor Linux tree to U-Boot. Unfortunatly testing it is little bit > tricky. They are many devices behind PCIe, but more or less all of them > requires missing either "reset-controller" or "clock-controller" or > "pin-controller" drivers. I was able to probe "cdns,macb" device, but > access to ethernet PHY over MDIO bus is stucking. Then I ported > "raspberrypi,rp1-adc" driver from vendor Linux tree, but it requires > missing clock. And on top of that machine that I used for developing this > crashed and I lost my PCIe changes :-|. Anyway. Have you tried using a M.2 HAT? This likely won't require much in terms of enabling the device. You write that you made some progress, is that compared to v3? Do you mind sharing the latest version of your patches? Best regards, Stefan > > These patches allows me to boot current openSUSE Tumbleweed without > modification. I can see serial console log and boot process on HDMI > connected monitor. > > I think these patches should be enough for start. Please consider for > inclusion. > > Thanks, > Ivan > > [1] https://lore.kernel.org/all/20231218210341.30073-1-iiva...@suse.de/ > [2] > https://lore.kernel.org/all/CAKRNjQ0dsWozGo4n8g58m4cCEk3n=qx1r+l24wbgpo-ip1y...@mail.gmail.com/ > > Dmitry Malkin (2): > rpi5: add initial memory map for bcm2712 > rpi5: Use devicetree as alternative way to read IO base addresses > > Ivan T. Ivanov (4): > rpi5: Use devicetree to retrieve board revision > bcm2835: Dynamically calculate bytes per pixel parameter > mmc: bcmstb: Add support for bcm2712 SD controller > configs: rpi_arm64: enable SDHCI BCMSTB driver > > arch/arm/mach-bcm283x/include/mach/base.h | 5 +- > arch/arm/mach-bcm283x/include/mach/mbox.h | 3 +- > arch/arm/mach-bcm283x/include/mach/sdhci.h | 3 +- > arch/arm/mach-bcm283x/include/mach/timer.h | 3 +- > arch/arm/mach-bcm283x/include/mach/wdog.h | 3 +- > arch/arm/mach-bcm283x/init.c | 74 - > board/raspberrypi/rpi/rpi.c| 22 ++- > configs/rpi_arm64_defconfig| 1 + > drivers/mmc/bcmstb_sdhci.c | 173 - > drivers/video/bcm2835.c| 18 ++- > 10 files changed, 282 insertions(+), 23 deletions(-)
Re: [PATCH] da9063: Add watchdog support
char val; Is char the correct variable type here? I would assume that u8 is more appropriate. + + da9063_read(dev, DA9063_REG_CONTROL_D, &val, 1); + val &= ~DA9063_TWDSCALE_MASK; + val |= DA9063_TWDSCALE_DISABLE; + da9063_write(dev, DA9063_REG_CONTROL_D, &val, 1); + + return 0; +} + +static int da9063_wdt_update_timeout(struct udevice *dev, unsigned int timeout) +{ + unsigned int regval; + char val; u8? + int ret; + + /* +* The watchdog triggers a reboot if a timeout value is already +* programmed because the timeout value combines two functions +* in one: indicating the counter limit and starting the watchdog. +* The watchdog must be disabled to be able to change the timeout +* value if the watchdog is already running. Then we can set the +* new timeout value which enables the watchdog again. +*/ + ret = da9063_wdt_disable_timer(dev); + if (ret) + return ret; + + udelay(300); + + regval = da9063_wdt_timeout_to_sel(timeout); + + da9063_read(dev, DA9063_REG_CONTROL_D, &val, 1); + val &= ~DA9063_TWDSCALE_MASK; + val |= regval; + da9063_write(dev, DA9063_REG_CONTROL_D, &val, 1); + + return 0; +} + +static int da9063_wdt_start(struct udevice *dev, u64 timeout, ulong flags) +{ + return da9063_wdt_update_timeout(dev, timeout); +} + +static int da9063_wdt_stop(struct udevice *dev) +{ + return da9063_wdt_disable_timer(dev); +} + +static int da9063_wdt_reset(struct udevice *dev) +{ + char val = DA9063_WATCHDOG; u8 + + return da9063_write(dev, DA9063_REG_CONTROL_F, &val, 1); +} + +static int da9063_wdt_expire_now(struct udevice *dev, ulong flags) +{ + char val = DA9063_SHUTDOWN; u8 + + return da9063_write(dev, DA9063_REG_CONTROL_F, &val, 1); +} + +static const struct wdt_ops da9063_wdt_ops = { + .start = da9063_wdt_start, + .stop = da9063_wdt_stop, + .reset = da9063_wdt_reset, + .expire_now = da9063_wdt_expire_now, +}; + +static const struct udevice_id da9063_wdt_ids[] = { + { .compatible = "dlg,da9063-watchdog", }, + {} +}; + +U_BOOT_DRIVER(da9063_wdt) = { + .name = "da9063-wdt", + .id = UCLASS_WDT, + .of_match = da9063_wdt_ids, + .ops = &da9063_wdt_ops, + .flags = DM_FLAG_PROBE_AFTER_BIND, +}; Thanks, Stefan
Re: [PATCH v3 17/30] drivers: ata: Rename ahci_mvebu
On 9/11/24 08:24, Patrick Rudolph wrote: Rename 'ahci_mvebu' to 'ahci_generic' and select it by default. The AHCI driver contains no SoC specific code and only expects the base address to be passed, thus rename it to ahci_generic and add the DT compatible string "generic-ahci". Update existing defconfigs to use the new Kconfig name as well. TEST: Booted on QEMU sbsa using the generic-ahci node. Signed-off-by: Patrick Rudolph Cc: Tom Rini Cc: Stefan Roese --- MAINTAINERS | 2 +- configs/clearfog_defconfig | 2 +- configs/clearfog_gt_8k_defconfig| 2 +- configs/clearfog_sata_defconfig | 2 +- configs/clearfog_spi_defconfig | 2 +- configs/db-88f6820-gp_defconfig | 2 +- configs/ds116_defconfig | 2 +- configs/helios4_defconfig | 2 +- configs/mvebu_crb_cn9130_defconfig | 2 +- configs/mvebu_db-88f3720_defconfig | 2 +- configs/mvebu_db_armada8k_defconfig | 2 +- configs/mvebu_db_cn9130_defconfig | 2 +- configs/mvebu_espressobin-88f3720_defconfig | 2 +- .../mvebu_espressobin_ultra-88f3720_defconfig | 2 +- configs/mvebu_mcbin-88f8040_defconfig | 2 +- configs/mvebu_puzzle-m801-88f8040_defconfig | 2 +- configs/n2350_defconfig | 2 +- configs/octeon_nic23_defconfig | 2 +- configs/turris_omnia_defconfig | 2 +- drivers/ata/Kconfig | 12 +++- drivers/ata/Makefile| 2 +- drivers/ata/{ahci_mvebu.c => ahci_generic.c}| 17 + 22 files changed, 36 insertions(+), 33 deletions(-) rename drivers/ata/{ahci_mvebu.c => ahci_generic.c} (71%) diff --git a/MAINTAINERS b/MAINTAINERS index 2050ae24df..d3a0469ca1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -356,7 +356,7 @@ S: Maintained T:git https://source.denx.de/u-boot/custodians/u-boot-marvell.git F:arch/arm/mach-kirkwood/ F:arch/arm/mach-mvebu/ -F: drivers/ata/ahci_mvebu.c +F: drivers/ata/ahci_generic.c F:drivers/clk/mvebu/ F:drivers/ddr/marvell/ F:drivers/gpio/mvebu_gpio.c diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index 62dbf2aa48..9cb4753685 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -52,7 +52,7 @@ CONFIG_ARP_TIMEOUT=200 CONFIG_NET_RETRY_COUNT=50 CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y -CONFIG_AHCI_MVEBU=y +CONFIG_AHCI_GENERIC=y CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y diff --git a/configs/clearfog_gt_8k_defconfig b/configs/clearfog_gt_8k_defconfig index df7e04a75b..66eb5e2407 100644 --- a/configs/clearfog_gt_8k_defconfig +++ b/configs/clearfog_gt_8k_defconfig @@ -46,7 +46,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ARP_TIMEOUT=200 CONFIG_NET_RETRY_COUNT=50 CONFIG_NET_RANDOM_ETHADDR=y -CONFIG_AHCI_MVEBU=y +CONFIG_AHCI_GENERIC=y CONFIG_LBA48=y CONFIG_SYS_64BIT_LBA=y CONFIG_DM_I2C=y diff --git a/configs/clearfog_sata_defconfig b/configs/clearfog_sata_defconfig index 41382f995d..b1e1fc75dd 100644 --- a/configs/clearfog_sata_defconfig +++ b/configs/clearfog_sata_defconfig @@ -52,7 +52,7 @@ CONFIG_ARP_TIMEOUT=200 CONFIG_NET_RETRY_COUNT=50 CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y -CONFIG_AHCI_MVEBU=y +CONFIG_AHCI_GENERIC=y CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y diff --git a/configs/clearfog_spi_defconfig b/configs/clearfog_spi_defconfig index f345b12e6c..64f862d298 100644 --- a/configs/clearfog_spi_defconfig +++ b/configs/clearfog_spi_defconfig @@ -52,7 +52,7 @@ CONFIG_ARP_TIMEOUT=200 CONFIG_NET_RETRY_COUNT=50 CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y -CONFIG_AHCI_MVEBU=y +CONFIG_AHCI_GENERIC=y CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y diff --git a/configs/db-88f6820-gp_defconfig b/configs/db-88f6820-gp_defconfig index ee8cb8ae66..16417a4e12 100644 --- a/configs/db-88f6820-gp_defconfig +++ b/configs/db-88f6820-gp_defconfig @@ -58,7 +58,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ARP_TIMEOUT=200 CONFIG_NET_RETRY_COUNT=50 CONFIG_SPL_OF_TRANSLATE=y -CONFIG_AHCI_MVEBU=y +CONFIG_AHCI_GENERIC=y CONFIG_SYS_I2C_LEGACY=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_MVTWSI=y diff --git a/configs/ds116_defconfig b/configs/ds116_defconfig index 1173e3a0f6..d687be2d5b 100644 --- a/configs/ds116_defconfig +++ b/configs/ds116_defconfig @@ -65,7 +65,7 @@ CONFIG_NET_RETRY_COUNT=50 CONFIG_NET_RANDOM_ETHADDR=y CONFIG_NETCONSOLE=y CONFIG_SPL_OF_TRANSLATE=y -CONFIG_AHCI_MVEBU=y +CONFIG_AHCI_GENERIC=y CONFIG_LBA48=y CONFIG_SYS_64BIT_LBA=y CONFIG_DM_I2C=y diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig index 29b6230e90..c0ae1de264 100644 --- a/con
Please pull u-boot-marvell/master
Hi Tom, I know it's late in the release process. But please consider pulling these Turris Omnia DDR related patches / fixes, which Marek would like to see in the upcoming release: - Turris Omnia DDR speed change with reset button (Marek) Here the Azure build, without any issues: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=374&view=results Thanks, Stefan The following changes since commit 1312faac5f52d27cfb45dfe1a5a93a2944ca5c21: Prepare v2024.10-rc4 (2024-09-02 14:07:53 -0600) are available in the Git repository at: g...@source.denx.de:u-boot/custodians/u-boot-marvell.git for you to fetch changes up to bc8664c9f31195a0249dd4eb0794f4a8625ad864: arm: mvebu: turris_omnia: Switch DDR speed to 1333H when reset 9 is selected (2024-09-03 14:24:32 +0200) Marek Behún (3): arm: mvebu: turris_omnia: Rename variable holding EEPROM udevice arm: mvebu: turris_omnia: Use the i2c_eeprom misc driver for EEPROM reading in U-Boot proper arm: mvebu: turris_omnia: Switch DDR speed to 1333H when reset 9 is selected arch/arm/mach-mvebu/Kconfig | 1 + board/CZ.NIC/turris_omnia/turris_omnia.c | 101 ++- configs/turris_omnia_defconfig | 1 - 3 files changed, 86 insertions(+), 17 deletions(-)
Re: [PATCH u-boot-marvell 0/3] Turris Omnia DDR speed change with reset button (for 2024.10)
On 8/29/24 10:08, Marek Behún wrote: Hello Stefan, this series adds the ability to select 1333H DDR speed mode for DDR training (instead of the default 1600K) with the factory reset button. If possible, I would like if this series went for U-Boot 2024.10 release. The heavy stuff to support DDR speed change is already in, this just adds the ability to do it with reset button instead of console command (which is inconvenient for most users). On Omnia, the user can select factory reset type by pressing the reset button on the rear panel and holding it. The front LEDs light on in sequence, representing a counter. Every ~2.5 second another LED lights on. When only the first LED is on, the board will do a standard reboot. Then different kinds of factory reboot will happen for reset types 1 to 7 (when 1, 2, ... or 7 LEDs are on) [1]. This series adds another reset type, number 10, which will make the board boot in 1333H DDR speed mode, and also write this setting to EEPROM, so that subsequent boots will also train in 1333H mode. The user can set back the default mode with the `eeprom` U-Boot command, or with the `omnia-eeprom` Linux command. Applied to u-boot-marvell/master Thanks, Stefan Marek [1] https://docs.turris.cz/hw/omnia/rescue-modes/ Marek Behún (3): arm: mvebu: turris_omnia: Rename variable holding EEPROM udevice arm: mvebu: turris_omnia: Use the i2c_eeprom misc driver for EEPROM reading in U-Boot proper arm: mvebu: turris_omnia: Switch DDR speed to 1333H when reset 9 is selected arch/arm/mach-mvebu/Kconfig | 1 + board/CZ.NIC/turris_omnia/turris_omnia.c | 101 +++ configs/turris_omnia_defconfig | 1 - 3 files changed, 86 insertions(+), 17 deletions(-) Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-marvell 2/3] arm: mvebu: turris_omnia: Use the i2c_eeprom misc driver for EEPROM reading in U-Boot proper
On 9/3/24 10:04, Marek Behún wrote: On Tue, Sep 03, 2024 at 08:57:24AM +0200, Stefan Roese wrote: On 8/29/24 10:08, Marek Behún wrote: Use the i2c_eeprom miscellaneous driver for reading Turris Omnia EEPROM in U-Boot proper. Keep using dm_i2c_read() in SPL build, since adding the i2c_eeprom driver to SPL build increases the image by 1.5 KiB. Signed-off-by: Marek Behún --- arch/arm/mach-mvebu/Kconfig | 1 + board/CZ.NIC/turris_omnia/turris_omnia.c | 9 +++-- configs/turris_omnia_defconfig | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 4a8328760eb..c1a1a333e6c 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -149,6 +149,7 @@ config TARGET_TURRIS_OMNIA select SPL_SYS_MALLOC_SIMPLE select SYS_I2C_MVTWSI select ATSHA204A + select I2C_EEPROM select ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING config TARGET_TURRIS_MOX diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 392df53a6d8..46f20f05c05 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -473,9 +474,13 @@ static bool omnia_read_eeprom(struct omnia_eeprom *oep) if (!eeprom) return false; - ret = dm_i2c_read(eeprom, 0, (void *)oep, sizeof(*oep)); + if (IS_ENABLED(CONFIG_SPL_BUILD)) + ret = dm_i2c_read(eeprom, 0, (void *)oep, sizeof(*oep)); + else + ret = i2c_eeprom_read(eeprom, 0, (void *)oep, sizeof(*oep)); So whats the advantage using i2c_eeprom_read() here in U-Boot proper? The only thing that stands out to me is that the code get more complex because of the SPL/non-SPL distinction. The reasons are as follows: - it's "more correct" semantically - the i2c_eeprom driver was already enabled for U-Boot proper in defconfig (with this commit selected by the board), because of the `eeprom` commmand, so I thought "why not use it?" (looking at the code now, it goes i2c_eeprom_read() dereference of i2c_eeprom_ops->read method i2c_eeprom_std_read() dm_i2c_read() so the complication is trivial, IMO) - the following commit adds code that writes the eeprom, and this cannot be done with simple dm_i2c_write(), because each eeprom page has to be written by another transaction, which is what i2c_eeprom_write() does. So I knew that I was going to add i2c_eeprom_write(), and I thought that it would seem weird writing with i2c_eeprom_write() but reading with dm_i2c_read(). That's what I thought after reviewing patch 3/3. Okay, makes sense. Let's see, if we can pull this into the upcoming release. Reviewed-by: Stefan Roese Thanks, Stefan
Re: [PATCH u-boot-marvell 3/3] arm: mvebu: turris_omnia: Switch DDR speed to 1333H when reset 9 is selected
oid fixup_speed_in_ddr_topology(struct mv_ddr_topology_map *topology) if (params->speed_bin_index == setting->speed_bin) return; - printf("Fixing up DDR3 speed (EEPROM defines %s)\n", speed); + if (reset_status == OMNIA_RESET_TO_LOWER_DDR_SPEED) + printf("Fixing up DDR3 speed to %s as requested by reset button\n", speed); + else + printf("Fixing up DDR3 speed (EEPROM defines %s)\n", speed); params->speed_bin_index = setting->speed_bin; params->memory_freq = setting->freq; @@ -771,8 +836,7 @@ static int set_regdomain(void) static void handle_reset_button(void) { const char * const vars[1] = { "bootcmd_rescue", }; - int ret; - u8 reset_status; + int reset_status; /* * Ensure that bootcmd_rescue has always stock value, so that running @@ -781,12 +845,12 @@ static void handle_reset_button(void) */ env_set_default_vars(1, (char * const *)vars, 0); - ret = omnia_mcu_read(CMD_GET_RESET, &reset_status, 1); - if (ret) { - printf("omnia_mcu_read failed: %i, reset status unknown!\n", - ret); + reset_status = omnia_mcu_get_reset(); + if (reset_status < 0) return; - } + + if (reset_status == OMNIA_RESET_TO_LOWER_DDR_SPEED) + return omnia_eeprom_set_lower_ddr_speed(); env_set_ulong("omnia_reset", reset_status); Reviewed-by: Stefan Roese Thanks, Stefan
Re: [PATCH u-boot-marvell 2/3] arm: mvebu: turris_omnia: Use the i2c_eeprom misc driver for EEPROM reading in U-Boot proper
On 8/29/24 10:08, Marek Behún wrote: Use the i2c_eeprom miscellaneous driver for reading Turris Omnia EEPROM in U-Boot proper. Keep using dm_i2c_read() in SPL build, since adding the i2c_eeprom driver to SPL build increases the image by 1.5 KiB. Signed-off-by: Marek Behún --- arch/arm/mach-mvebu/Kconfig | 1 + board/CZ.NIC/turris_omnia/turris_omnia.c | 9 +++-- configs/turris_omnia_defconfig | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 4a8328760eb..c1a1a333e6c 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -149,6 +149,7 @@ config TARGET_TURRIS_OMNIA select SPL_SYS_MALLOC_SIMPLE select SYS_I2C_MVTWSI select ATSHA204A + select I2C_EEPROM select ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING config TARGET_TURRIS_MOX diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 392df53a6d8..46f20f05c05 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -473,9 +474,13 @@ static bool omnia_read_eeprom(struct omnia_eeprom *oep) if (!eeprom) return false; - ret = dm_i2c_read(eeprom, 0, (void *)oep, sizeof(*oep)); + if (IS_ENABLED(CONFIG_SPL_BUILD)) + ret = dm_i2c_read(eeprom, 0, (void *)oep, sizeof(*oep)); + else + ret = i2c_eeprom_read(eeprom, 0, (void *)oep, sizeof(*oep)); So whats the advantage using i2c_eeprom_read() here in U-Boot proper? The only thing that stands out to me is that the code get more complex because of the SPL/non-SPL distinction. Thanks, Stefan + if (ret) { - printf("dm_i2c_read failed: %i, cannot read EEPROM\n", ret); + printf("cannot read EEPROM: %d\n", ret); return false; } diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index c8756a3a788..93f0bc53f9e 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -92,7 +92,6 @@ CONFIG_SPL_OF_TRANSLATE=y CONFIG_AHCI_PCI=y CONFIG_AHCI_MVEBU=y CONFIG_DM_PCA953X=y -CONFIG_I2C_EEPROM=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_MV=y CONFIG_DM_MTD=y
Re: [PATCH u-boot-marvell 1/3] arm: mvebu: turris_omnia: Rename variable holding EEPROM udevice
On 8/29/24 10:08, Marek Behún wrote: Rename the variable holding the EEPROM udevice from `chip` to `eeprom`. Signed-off-by: Marek Behún --- board/CZ.NIC/turris_omnia/turris_omnia.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 2f29d26edf8..392df53a6d8 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -464,16 +464,16 @@ static bool check_eeprom_crc(const void *buf, size_t size, u32 expected, static bool omnia_read_eeprom(struct omnia_eeprom *oep) { - struct udevice *chip; + struct udevice *eeprom; int ret; - chip = omnia_get_i2c_chip("EEPROM", OMNIA_I2C_EEPROM_CHIP_ADDR, - OMNIA_I2C_EEPROM_CHIP_LEN); + eeprom = omnia_get_i2c_chip("EEPROM", OMNIA_I2C_EEPROM_CHIP_ADDR, + OMNIA_I2C_EEPROM_CHIP_LEN); - if (!chip) + if (!eeprom) return false; - ret = dm_i2c_read(chip, 0, (void *)oep, sizeof(*oep)); + ret = dm_i2c_read(eeprom, 0, (void *)oep, sizeof(*oep)); if (ret) { printf("dm_i2c_read failed: %i, cannot read EEPROM\n", ret); return false; Reviewed-by: Stefan Roese Thanks, Stefan
Re: [PATCH 06/35] arm: friendlyarm: Avoid accessing global_data fb_base
Hi Simon, On 24.07.24 17:08, Simon Glass wrote: Use the new video function to get the framebuffer base. Signed-off-by: Simon Glass --- Tested-by: Stefan Bosch Looks OK, tested on FriendlyElec-Board NanoPC-T2 (s5p4418_nanopi2_defconfig). Thanks! board/friendlyarm/nanopi2/board.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/board/friendlyarm/nanopi2/board.c b/board/friendlyarm/nanopi2/board.c index c8cbc5a15fa..b32dfc6b570 100644 --- a/board/friendlyarm/nanopi2/board.c +++ b/board/friendlyarm/nanopi2/board.c @@ -11,6 +11,7 @@ #ifdef CONFIG_PWM_NX #include #endif +#include #include #include @@ -492,12 +493,8 @@ int splash_screen_prepare(void) ARRAY_SIZE(splash_locations)); } - if (!err) { - char addr[64]; - - sprintf(addr, "0x%lx", gd->fb_base); - env_set("fb_addr", addr); - } + if (!err) + env_set_hex("fb_addr", video_get_fb()); return err; } Regards, Stefan
Re: [PATCH v2 0/2] a little RPi watchdog cleanup
On 7/15/24 15:03, Rasmus Villemoes wrote: Stefan Roese writes: @Tom, I can't find these patches (and v1) in patchworks. Do you have an idea, why this is the case? Perhaps because they (v2) have already been merged to master via a PR from Peter? commit 1ca216522d4. Ah, I was not aware that it was already merged. Okay, that explains it of course. So one has to change 'state' from 'action required' to see them: https://patchwork.ozlabs.org/project/uboot/list/?series=&submitter=&state=*&q=hw_watchdog&archive=&delegate= Nice, I never noticed that I could change this view. Thanks, Stefan
Please pull u-boot-marvell/master
Hi Tom, please pull this small batch of Marvell related patches: - mvebu: Migrate to upstream DT for Synology DS116 (Armada 385) board (Tony) - mvebu: Enable bootstd and other modernization for Synology DS414 (Armada XP) board (Tony) Here the Azure build, without any issues: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=373&view=results Thanks, Stefan The following changes since commit b182816c1fb436916661949213c543bf4d42250b: turris_1x: Normalize Kconfig usage (2024-07-13 10:42:15 -0600) are available in the Git repository at: g...@source.denx.de:u-boot/custodians/u-boot-marvell.git for you to fetch changes up to 51d4eb8bbaf35d14d4e30b885863ae00fbc47258: arm: mvebu: Enable bootstd and other modernization for Synology DS414 (Armada XP) board (2024-07-15 08:42:04 +0200) Tony Dinh (2): arm: dts: mvebu: Migrate to upstream DT for Synology DS116 (Armada 385) board arm: mvebu: Enable bootstd and other modernization for Synology DS414 (Armada XP) board arch/arm/dts/Makefile | 1 - arch/arm/dts/armada-385-synology-ds116.dts | 291 - board/Synology/ds414/ds414.c | 14 +- configs/ds116_defconfig| 3 +- configs/ds414_defconfig| 19 +- include/configs/ds414.h| 65 +-- 6 files changed, 63 insertions(+), 330 deletions(-) delete mode 100644 arch/arm/dts/armada-385-synology-ds116.dts
Re: [PATCH v3] arm: mvebu: Enable bootstd and other modernization for Synology DS414 (Armada XP) board
On 7/8/24 06:39, Tony Dinh wrote: - Switch to standard boot (in include/configs/ds414.h and configs/ds414_defconfig) - Implement board_late_init() to ensure successful enumeration of USB3 devices - Remove unnecessary checkboard() - Updated IDENT_STRING to indicate this u-boot supports both Synology DS414 and DS214+ boards - Add SYS_THUMB_BUILD to reduce binary size - Add NET_RANDOM_ETHADDR - Add CONFIG_LBA48 and CONFIG_SYS_64BIT_LBA to support >2TB HDD/SDD Signed-off-by: Tony Dinh Applied to u-boot-marvell/master Thanks, Stefan --- Changes in v3: - Restore misc_init_r() to support booting legacy FW. - Correct scripting error in EXTRA_ENV_SETTINGS_LEGACY in /include/configs/ds414.h - Remove CONFIG_PHY_ANEG_TIMEOUT from /include/configs/ds414.h. This symbol has been moved to Kconfig. Changes in v2: - Define EXTRA_ENV_SETTINGS_LEGACY to restore default envs support for booting legacy FW. board/Synology/ds414/ds414.c | 14 configs/ds414_defconfig | 19 +-- include/configs/ds414.h | 65 +--- 3 files changed, 61 insertions(+), 37 deletions(-) diff --git a/board/Synology/ds414/ds414.c b/board/Synology/ds414/ds414.c index 8db810ad3e..1a4cea87e1 100644 --- a/board/Synology/ds414/ds414.c +++ b/board/Synology/ds414/ds414.c @@ -180,6 +180,13 @@ int board_init(void) return 0; } +int board_late_init(void) +{ + /* Do late init to ensure successful enumeration of XHCI devices */ + pci_init(); + return 0; +} + int misc_init_r(void) { if (!env_get("ethaddr")) { @@ -188,10 +195,3 @@ int misc_init_r(void) } return 0; } - -int checkboard(void) -{ - puts("Board: DS414\n"); - - return 0; -} diff --git a/configs/ds414_defconfig b/configs/ds414_defconfig index 18c741d4f2..6391c43474 100644 --- a/configs/ds414_defconfig +++ b/configs/ds414_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_ARCH_CPU_INIT=y +CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_MVEBU=y CONFIG_SUPPORT_PASSING_ATAGS=y CONFIG_CMDLINE_TAG=y @@ -25,44 +26,41 @@ CONFIG_SPL_BSS_MAX_SIZE=0x4000 CONFIG_SPL=y CONFIG_DEBUG_UART_BASE=0xf1012000 CONFIG_DEBUG_UART_CLOCK=25000 +CONFIG_IDENT_STRING="\nSynology DS214+/DS414 2/4-Bay Diskstation" CONFIG_SYS_LOAD_ADDR=0x80 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_BOOTSTD_FULL=y CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y -CONFIG_BOOTARGS="console=ttyS0,115200 ip=off initrd=0x840,8M root=/dev/md0 rw syno_hw_version=DS414r1 ihd_num=4 netif_num=2 flash_size=8 SataLedSpecial=1 HddHotplug=1" -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="sf probe; sf read ${loadaddr} 0xd 0x2d; sf read ${ramdisk_addr_r} 0x3a 0x43; bootm ${loadaddr} ${ramdisk_addr_r}" # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_BOARD_LATE_INIT=y CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x1bfd0 CONFIG_SPL_SYS_MALLOC_SIMPLE=y # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set CONFIG_SPL_I2C=y +CONFIG_SYS_PROMPT="DS414> " CONFIG_SYS_MAXARGS=32 CONFIG_CMD_I2C=y CONFIG_CMD_PCI=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y -# CONFIG_CMD_SETEXPR is not set -CONFIG_CMD_DHCP=y CONFIG_CMD_TFTPPUT=y -CONFIG_CMD_MII=y -CONFIG_CMD_PING=y CONFIG_CMD_TIME=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_FAT=y CONFIG_CMD_JFFS2=y CONFIG_CMD_MTDPARTS=y CONFIG_CMD_UBI=y -CONFIG_ISO_PARTITION=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_SPI_MAX_HZ=5000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ARP_TIMEOUT=200 CONFIG_NET_RETRY_COUNT=50 +CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y +CONFIG_LBA48=y +CONFIG_SYS_64BIT_LBA=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y # CONFIG_MMC is not set @@ -84,4 +82,3 @@ CONFIG_USB_XHCI_HCD=y # CONFIG_USB_XHCI_MVEBU is not set CONFIG_USB_XHCI_PCI=y CONFIG_USB_EHCI_HCD=y -CONFIG_USB_STORAGE=y diff --git a/include/configs/ds414.h b/include/configs/ds414.h index 6fbcec0898..9525657558 100644 --- a/include/configs/ds414.h +++ b/include/configs/ds414.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* + * Copyright (C) 2024 Tony Dinh * Copyright (C) 2014 Stefan Roese */ @@ -16,15 +17,8 @@ * U-Boot into it. */ -/* I2C */ #define CFG_I2C_MVTWSI_BASE0 MVEBU_TWSI_BASE -/* - * mv-common.h should be defined after CMD configs since it used them - * to enable certain macros - */ -#include "mv-common.h" - /* * Memory layout while starting into the bin_hdr via the * BootROM: @@ -38,21 +32,54 @@ * L2 cache thus cannot be used. */ -/* SPL */ -/* Defines for SPL */ +/* Keep device tree and initrd in lower memory so the kernel can access them */ +#define RELOCATION_LIMITS_ENV_SETTINGS \ + "fdt_high=0x1000\0" \ + "initrd_high=0x1000\0" -/* Default Environment */ +/* + * mv-common.h should be defined after CMD configs since it used them +
Re: [PATCH] arm: dts: mvebu: Migrate to upstream DT for Synology DS116 (Armada 385) board
On 5/22/24 23:51, Tony Dinh wrote: Enable OF_UPSTREAM to use upstream DT and add marvell/ prefix to the DEFAULT_DEVICE_TREE in DS116 defconfig. Remove current DTS in arch/arm/dts/ directory. Signed-off-by: Tony Dinh Applied to u-boot-marvell/master Thanks, Stefan --- arch/arm/dts/Makefile | 1 - arch/arm/dts/armada-385-synology-ds116.dts | 291 - configs/ds116_defconfig| 3 +- 3 files changed, 2 insertions(+), 293 deletions(-) delete mode 100644 arch/arm/dts/armada-385-synology-ds116.dts diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index a5c82ebf7a..75f7e616b4 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -155,7 +155,6 @@ dtb-$(CONFIG_ARCH_MVEBU) += \ armada-385-atl-x530.dtb \ armada-385-atl-x530DP.dtb \ armada-385-db-88f6820-amc.dtb \ - armada-385-synology-ds116.dtb \ armada-385-thecus-n2350.dtb \ armada-385-turris-omnia.dtb \ armada-388-clearfog.dtb \ diff --git a/arch/arm/dts/armada-385-synology-ds116.dts b/arch/arm/dts/armada-385-synology-ds116.dts deleted file mode 100644 index 82a0373f7f..00 --- a/arch/arm/dts/armada-385-synology-ds116.dts +++ /dev/null @@ -1,291 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) -/* - * Device Tree file for Synology DS116 NAS - * - * Copyright (C) 2017 Willy Tarreau - */ - -/dts-v1/; -#include "armada-385.dtsi" -#include - -/ { - model = "Synology DS116"; - compatible = "marvell,a385-gp", "marvell,armada385", "marvell,armada380"; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - memory { - device_type = "memory"; - reg = <0x 0x4000>; /* 1 GB */ - }; - - soc { - ranges = ; - - internal-regs { - i2c@11000 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c0_pins>; - status = "okay"; - clock-frequency = <10>; - - eeprom@57 { - compatible = "atmel,24c64"; - reg = <0x57>; - }; - }; - - serial@12000 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins>; - status = "okay"; - }; - - serial@12100 { - /* A PIC16F1829 is connected to uart1 at 9600 bps, -* and takes single-character orders : -* "1" : power off // already handled by the poweroff node -* "2" : short beep -* "3" : long beep -* "4" : turn the power LED ON -* "5" : flash the power LED -* "6" : turn the power LED OFF -* "7" : turn the status LED OFF -* "8" : turn the status LED ON -* "9" : flash the status LED -* "A" : flash the motherboard LED (D8) -* "B" : turn the motherboard LED OFF -* "C" : hard reset -*/ - pinctrl-names = "default"; - pinctrl-0 = <&uart1_pins>; - status = "okay"; - }; - - poweroff@12100 { - compatible = "synology,power-off"; - reg = <0x12100 0x100>; - clocks = <&coreclk 0>; - }; - - ethernet@7 { - pinctrl-names = "default"; - phy = <&phy0>; - phy-mode = "sgmii"; - buffer-manager = <&bm>; - bm,pool-long = <0>; - status = "okay"; - }; - - mdio@
Re: [PATCH v2 0/2] a little RPi watchdog cleanup
@Tom, I can't find these patches (and v1) in patchworks. Do you have an idea, why this is the case? Thanks, Stefan On 7/12/24 11:07, Rasmus Villemoes wrote: Two related leftovers I found while looking at remaining hw_watchdog/CONFIG_HW_WATCHDOG items. v2: Add Stefan's R-bs. Trim commit log in patch 1. No code changes. CI: https://dev.azure.com/u-boot/u-boot/_build/results?buildId=8910&view=results I'm pretty sure the only failures are the false positive 'cyclic ...' ones. Rasmus Villemoes (2): arm: bcm283x: remove unused empty hw_watchdog_disable board: rpi: remove leftover CONFIG_HW_WATCHDOG block arch/arm/mach-bcm283x/reset.c | 7 ++- board/raspberrypi/rpi/rpi.c | 4 2 files changed, 2 insertions(+), 9 deletions(-) Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 2/2] board: rpi: remove leftover CONFIG_HW_WATCHDOG block
On 7/10/24 23:17, Rasmus Villemoes wrote: This was added in commit 45a6d231b2f (bcm2835_wdt: support for the BCM2835/2836 watchdog), which did do 'select HW_WATCHDOG'. That incarnation of the watchdog driver later got removed in c7adc0b5f98 (watchdog: bcm2835_wdt: Remove unused BCM283x watchdog driver and its references), but this block was left behind. Another rpi watchdog driver has since been added, but that does not select HW_WATCHDOG, so this remains dead and unused. Remove it. Signed-off-by: Rasmus Villemoes Reviewed-by: Stefan Roese Thanks, Stefan --- board/raspberrypi/rpi/rpi.c | 4 1 file changed, 4 deletions(-) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index d996eb0cf69..9a83cf2d6a7 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -493,10 +493,6 @@ static void get_board_revision(void) int board_init(void) { -#ifdef CONFIG_HW_WATCHDOG - hw_watchdog_init(); -#endif - get_board_revision(); gd->bd->bi_boot_params = 0x100; Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 1/2] arm: bcm283x: remove pointless empty hw_watchdog_disable
On 7/11/24 09:54, Peter Robinson wrote: On Wed, 10 Jul 2024 at 22:17, Rasmus Villemoes wrote: This empty stub was originally added as one branch of an #ifdef in commit 45a6d231b2f (bcm2835_wdt: support for the BCM2835/2836 watchdog). That incarnation of the rpi watchdog driver was later removed in c7adc0b5f98 (watchdog: bcm2835_wdt: Remove unused BCM283x watchdog driver and its references), but this now-pointless stub was You don't need a - in "now-pointless" and I think "now unused" is a better term, please update the subject too. left behind. The later (re-)added rpi watchdog driver does not define a hw_watchdog_disable() function, as that is properly integrated in the watchdog framework (i.e. not of the hw_* kind). Since it wasn't declared static, the compiler cannot even elide it (though it does get inlined into the caller here, and the out-of-line definition does get gc'ed by the linker). All the things in () don't add value to this, please remove them. I am a big friend of extensive commit messages, so IMHO all this should stay in. If a developer is not interested in such details he can skip these infos. Still if somebody feels strong here to drop these infos, then I won't object. Reviewed-by: Stefan Roese Thanks, Stefan Signed-off-by: Rasmus Villemoes --- arch/arm/mach-bcm283x/reset.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-bcm283x/reset.c b/arch/arm/mach-bcm283x/reset.c index 9199234917f..1dc7ce50d1d 100644 --- a/arch/arm/mach-bcm283x/reset.c +++ b/arch/arm/mach-bcm283x/reset.c @@ -25,8 +25,6 @@ /* max ticks timeout */ #define BCM2835_WDOG_MAX_TIMEOUT 0x000f -void hw_watchdog_disable(void) {} - __efi_runtime_data struct bcm2835_wdog_regs *wdog_regs; static void __efi_runtime @@ -34,10 +32,9 @@ __reset_cpu(struct bcm2835_wdog_regs *wdog_regs, ulong ticks) { uint32_t rstc, timeout; - if (ticks == 0) { - hw_watchdog_disable(); + if (ticks == 0) timeout = RESET_TIMEOUT; - } else + else timeout = ticks & BCM2835_WDOG_MAX_TIMEOUT; rstc = readl(&wdog_regs->rstc); -- 2.45.2 Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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] arm: mvebu: Enable bootstd and other modernization for Synology DS414 (Armada XP) board
On 7/8/24 06:39, Tony Dinh wrote: - Switch to standard boot (in include/configs/ds414.h and configs/ds414_defconfig) - Implement board_late_init() to ensure successful enumeration of USB3 devices - Remove unnecessary checkboard() - Updated IDENT_STRING to indicate this u-boot supports both Synology DS414 and DS214+ boards - Add SYS_THUMB_BUILD to reduce binary size - Add NET_RANDOM_ETHADDR - Add CONFIG_LBA48 and CONFIG_SYS_64BIT_LBA to support >2TB HDD/SDD Signed-off-by: Tony Dinh Reviewed-by: Stefan Roese @Phil, is this ready to be merged from your point of view as well? Thanks, Stefan --- Changes in v3: - Restore misc_init_r() to support booting legacy FW. - Correct scripting error in EXTRA_ENV_SETTINGS_LEGACY in /include/configs/ds414.h - Remove CONFIG_PHY_ANEG_TIMEOUT from /include/configs/ds414.h. This symbol has been moved to Kconfig. Changes in v2: - Define EXTRA_ENV_SETTINGS_LEGACY to restore default envs support for booting legacy FW. board/Synology/ds414/ds414.c | 14 configs/ds414_defconfig | 19 +-- include/configs/ds414.h | 65 +--- 3 files changed, 61 insertions(+), 37 deletions(-) diff --git a/board/Synology/ds414/ds414.c b/board/Synology/ds414/ds414.c index 8db810ad3e..1a4cea87e1 100644 --- a/board/Synology/ds414/ds414.c +++ b/board/Synology/ds414/ds414.c @@ -180,6 +180,13 @@ int board_init(void) return 0; } +int board_late_init(void) +{ + /* Do late init to ensure successful enumeration of XHCI devices */ + pci_init(); + return 0; +} + int misc_init_r(void) { if (!env_get("ethaddr")) { @@ -188,10 +195,3 @@ int misc_init_r(void) } return 0; } - -int checkboard(void) -{ - puts("Board: DS414\n"); - - return 0; -} diff --git a/configs/ds414_defconfig b/configs/ds414_defconfig index 18c741d4f2..6391c43474 100644 --- a/configs/ds414_defconfig +++ b/configs/ds414_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_ARCH_CPU_INIT=y +CONFIG_SYS_THUMB_BUILD=y CONFIG_ARCH_MVEBU=y CONFIG_SUPPORT_PASSING_ATAGS=y CONFIG_CMDLINE_TAG=y @@ -25,44 +26,41 @@ CONFIG_SPL_BSS_MAX_SIZE=0x4000 CONFIG_SPL=y CONFIG_DEBUG_UART_BASE=0xf1012000 CONFIG_DEBUG_UART_CLOCK=25000 +CONFIG_IDENT_STRING="\nSynology DS214+/DS414 2/4-Bay Diskstation" CONFIG_SYS_LOAD_ADDR=0x80 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_BOOTSTD_FULL=y CONFIG_BOOTDELAY=3 CONFIG_USE_BOOTARGS=y -CONFIG_BOOTARGS="console=ttyS0,115200 ip=off initrd=0x840,8M root=/dev/md0 rw syno_hw_version=DS414r1 ihd_num=4 netif_num=2 flash_size=8 SataLedSpecial=1 HddHotplug=1" -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="sf probe; sf read ${loadaddr} 0xd 0x2d; sf read ${ramdisk_addr_r} 0x3a 0x43; bootm ${loadaddr} ${ramdisk_addr_r}" # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_BOARD_LATE_INIT=y CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x1bfd0 CONFIG_SPL_SYS_MALLOC_SIMPLE=y # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set CONFIG_SPL_I2C=y +CONFIG_SYS_PROMPT="DS414> " CONFIG_SYS_MAXARGS=32 CONFIG_CMD_I2C=y CONFIG_CMD_PCI=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y -# CONFIG_CMD_SETEXPR is not set -CONFIG_CMD_DHCP=y CONFIG_CMD_TFTPPUT=y -CONFIG_CMD_MII=y -CONFIG_CMD_PING=y CONFIG_CMD_TIME=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_FAT=y CONFIG_CMD_JFFS2=y CONFIG_CMD_MTDPARTS=y CONFIG_CMD_UBI=y -CONFIG_ISO_PARTITION=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_SPI_MAX_HZ=5000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ARP_TIMEOUT=200 CONFIG_NET_RETRY_COUNT=50 +CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y +CONFIG_LBA48=y +CONFIG_SYS_64BIT_LBA=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y # CONFIG_MMC is not set @@ -84,4 +82,3 @@ CONFIG_USB_XHCI_HCD=y # CONFIG_USB_XHCI_MVEBU is not set CONFIG_USB_XHCI_PCI=y CONFIG_USB_EHCI_HCD=y -CONFIG_USB_STORAGE=y diff --git a/include/configs/ds414.h b/include/configs/ds414.h index 6fbcec0898..9525657558 100644 --- a/include/configs/ds414.h +++ b/include/configs/ds414.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* + * Copyright (C) 2024 Tony Dinh * Copyright (C) 2014 Stefan Roese */ @@ -16,15 +17,8 @@ * U-Boot into it. */ -/* I2C */ #define CFG_I2C_MVTWSI_BASE0 MVEBU_TWSI_BASE -/* - * mv-common.h should be defined after CMD configs since it used them - * to enable certain macros - */ -#include "mv-common.h" - /* * Memory layout while starting into the bin_hdr via the * BootROM: @@ -38,21 +32,54 @@ * L2 cache thus cannot be used. */ -/* SPL */ -/* Defines for SPL */ +/* Keep device tree and initrd in lower memory so the kernel can access them */ +#define RELOCATION_LIMITS_ENV_SETTINGS \ + "fdt_high=0x1000\0" \ + "initrd_high=0x1000\0" -/* Default Environment */ +/* + *
Re: [PATCH] arm: dts: mvebu: Migrate to upstream DT for Synology DS116 (Armada 385) board
Hi Tony, On 7/9/24 22:27, Tony Dinh wrote: Hi Stefan, On Thu, May 23, 2024 at 12:27 AM Sumit Garg wrote: On Thu, 23 May 2024 at 03:22, Tony Dinh wrote: Enable OF_UPSTREAM to use upstream DT and add marvell/ prefix to the DEFAULT_DEVICE_TREE in DS116 defconfig. Remove current DTS in arch/arm/dts/ directory. Signed-off-by: Tony Dinh --- arch/arm/dts/Makefile | 1 - arch/arm/dts/armada-385-synology-ds116.dts | 291 - configs/ds116_defconfig| 3 +- 3 files changed, 2 insertions(+), 293 deletions(-) delete mode 100644 arch/arm/dts/armada-385-synology-ds116.dts Acked-by: Sumit Garg -Sumit Is this OK to be merged to next? I think so: Reviewed-by: Stefan Roese Thanks, Stefan All the best, Tony diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index a5c82ebf7a..75f7e616b4 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -155,7 +155,6 @@ dtb-$(CONFIG_ARCH_MVEBU) += \ armada-385-atl-x530.dtb \ armada-385-atl-x530DP.dtb \ armada-385-db-88f6820-amc.dtb \ - armada-385-synology-ds116.dtb \ armada-385-thecus-n2350.dtb \ armada-385-turris-omnia.dtb \ armada-388-clearfog.dtb \ diff --git a/arch/arm/dts/armada-385-synology-ds116.dts b/arch/arm/dts/armada-385-synology-ds116.dts deleted file mode 100644 index 82a0373f7f..00 --- a/arch/arm/dts/armada-385-synology-ds116.dts +++ /dev/null @@ -1,291 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0 OR MIT) -/* - * Device Tree file for Synology DS116 NAS - * - * Copyright (C) 2017 Willy Tarreau - */ - -/dts-v1/; -#include "armada-385.dtsi" -#include - -/ { - model = "Synology DS116"; - compatible = "marvell,a385-gp", "marvell,armada385", "marvell,armada380"; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - memory { - device_type = "memory"; - reg = <0x 0x4000>; /* 1 GB */ - }; - - soc { - ranges = ; - - internal-regs { - i2c@11000 { - pinctrl-names = "default"; - pinctrl-0 = <&i2c0_pins>; - status = "okay"; - clock-frequency = <10>; - - eeprom@57 { - compatible = "atmel,24c64"; - reg = <0x57>; - }; - }; - - serial@12000 { - pinctrl-names = "default"; - pinctrl-0 = <&uart0_pins>; - status = "okay"; - }; - - serial@12100 { - /* A PIC16F1829 is connected to uart1 at 9600 bps, -* and takes single-character orders : -* "1" : power off // already handled by the poweroff node -* "2" : short beep -* "3" : long beep -* "4" : turn the power LED ON -* "5" : flash the power LED -* "6" : turn the power LED OFF -* "7" : turn the status LED OFF -* "8" : turn the status LED ON -* "9" : flash the status LED -* "A" : flash the motherboard LED (D8) -* "B" : turn the motherboard LED OFF -* "C" : hard reset -*/ - pinctrl-names = "default"; - pinctrl-0 = <&uart1_pins>; - status = "okay"; - }; - - poweroff@12100 { - compatible = "synology,power-off"; - reg = <0x12100 0x100>; - clocks = <&coreclk 0>; - }; - - ethernet@7 { - pinctrl-names = "default"; - phy = <&phy0>; - phy-mode = "sgmii"; -
Please pull u-boot-marvell/master
Hi Tom, please pull the following Marvell MVEBU related patches into master: - Add mvebu_espressobin_ultra-88f3720_defconfig (Benjamin) - Update DTS for Thecus N2350 board (Tony) - Add "old" Marvell DDR3 training for Armada 38x and Turris Omnia (Marek) - Misc turris_omnia changes (Marek) Here the Azure build, without any issues: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=372&view=results Thanks, Stefan The following changes since commit fd46ea0e701920eb205c2bce9d527bf0dec10b59: Merge branch '2024-07-05-assorted-updates' (2024-07-05 16:36:43 -0600) are available in the Git repository at: g...@source.denx.de:u-boot/custodians/u-boot-marvell.git for you to fetch changes up to 711443eafe0d8064744f6ee69cef08b032346c74: mvebu: armada-8k: respect CONFIG_DISTRO_DEFAULTS (2024-07-08 08:20:58 +0200) Benjamin Schneider (1): configs: add mvebu_espressobin_ultra-88f3720_defconfig Marek Behún (16): arm: mvebu: turris_omnia: Disable ext4 write support in defconfig ddr: marvell: a38x: debug: return from ddr3_tip_print_log() early if we won't print anything ddr: marvell: a38x: debug: Remove unused variables ddr: marvell: a38x: debug: Define DDR_VIEWER_TOOL variables only if needed, and make them static ddr: marvell: a38x: debug: Allow compiling with immutable debug settings to reduce binary size arm: mvebu: turris_omnia: Enable immutable debug settings in DDR3 training by default arm: mvebu: turris_omnia: Fix ethernet PHY reset gpio FDT fixup arm: mvebu: turris_omnia: Implement EEPROM layout for the 'eeprom' command arm: mvebu: turris_omnia: Enable the 'eeprom' command arm: mvebu: turris_omnia: Extend EEPROM info structure arm: mvebu: turris_omnia: Read DDR speed from EEPROM ddr: marvell: a38x: Import old DDR training code from 2017 version of U-Boot ddr: marvell: a38x: old: Fix some compiler warning of the old code ddr: marvell: a38x: old: Backport immutable debug settings arm: mvebu: a38x: Add optional support for using old DDR3 training code arm: mvebu: turris_omnia: Support old DDR3 training Robert Marko (1): mvebu: armada-8k: respect CONFIG_DISTRO_DEFAULTS Tony Dinh (2): arm: mvebu: env_sf_get_env_addr() missing check for CONFIG_ENV_IS_IN_SPI_FLASH arm: dts: mvebu: Update DTS for Thecus N2350 board arch/arm/dts/armada-385-thecus-n2350.dts | 10 +- arch/arm/mach-mvebu/Kconfig| 15 + arch/arm/mach-mvebu/cpu.c |2 +- arch/arm/mach-mvebu/include/mach/cpu.h |1 + arch/arm/mach-mvebu/spl.c | 37 +- board/CZ.NIC/turris_omnia/Makefile |2 + board/CZ.NIC/turris_omnia/eeprom.c | 190 ++ board/CZ.NIC/turris_omnia/old_ddr3_training.c | 63 + board/CZ.NIC/turris_omnia/turris_omnia.c | 199 +- board/Marvell/mvebu_armada-37xx/MAINTAINERS|5 + configs/mvebu_espressobin_ultra-88f3720_defconfig | 106 + configs/turris_omnia_defconfig |6 +- drivers/ddr/marvell/a38x/Makefile |2 + drivers/ddr/marvell/a38x/ddr3_debug.c | 30 +- drivers/ddr/marvell/a38x/ddr3_init.c |3 +- drivers/ddr/marvell/a38x/ddr3_init.h | 43 +- drivers/ddr/marvell/a38x/old/Makefile | 29 + drivers/ddr/marvell/a38x/old/ddr3_a38x.c | 737 ++ drivers/ddr/marvell/a38x/old/ddr3_a38x.h | 93 + drivers/ddr/marvell/a38x/old/ddr3_a38x_mc_static.h | 226 ++ drivers/ddr/marvell/a38x/old/ddr3_a38x_topology.h | 22 + drivers/ddr/marvell/a38x/old/ddr3_a38x_training.c | 39 + drivers/ddr/marvell/a38x/old/ddr3_debug.c | 1546 .../ddr/marvell/a38x/old/ddr3_hws_hw_training.c| 147 ++ .../ddr/marvell/a38x/old/ddr3_hws_hw_training.h| 49 + .../marvell/a38x/old/ddr3_hws_hw_training_def.h| 464 .../ddr/marvell/a38x/old/ddr3_hws_sil_training.h | 17 + drivers/ddr/marvell/a38x/old/ddr3_init.c | 769 ++ drivers/ddr/marvell/a38x/old/ddr3_init.h | 405 +++ drivers/ddr/marvell/a38x/old/ddr3_logging_def.h| 101 + drivers/ddr/marvell/a38x/old/ddr3_patterns_64bit.h | 924 +++ drivers/ddr/marvell/a38x/old/ddr3_topology_def.h | 76 + drivers/ddr/marvell/a38x/old/ddr3_training.c | 2650 drivers/ddr/marvell/a38x/old/ddr3_training_bist.c | 288 +++ .../a38x/old/ddr3_training_centralization.c| 711 ++ drivers/ddr/marvell/a38x/old/ddr3_training_db.c| 651 + .../ddr/marvell/a38x/old/ddr3_training_hw_algo.c | 685 + .../ddr/
Re: [PATCH] mvebu: armada-8k: respect CONFIG_DISTRO_DEFAULTS
On 6/21/24 11:46, Robert Marko wrote: Currently, Armada 8k config header is setting boot devices and including regardless of the CONFIG_DISTRO_DEFAULTS being enabled or not, thus populating the environment for distro boot even on devices that have no need for it. So, lets simply respect the value of CONFIG_DISTRO_DEFAULTS. Signed-off-by: Robert Marko Applied to u-boot-marvell/master Thanks, Stefan --- include/configs/mvebu_armada-8k.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/configs/mvebu_armada-8k.h b/include/configs/mvebu_armada-8k.h index 239a09763a..6fedbe9ee3 100644 --- a/include/configs/mvebu_armada-8k.h +++ b/include/configs/mvebu_armada-8k.h @@ -30,7 +30,7 @@ /* * PCI configuration */ - +#ifdef CONFIG_DISTRO_DEFAULTS #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 1) \ func(MMC, mmc, 0) \ @@ -40,6 +40,9 @@ func(DHCP, dhcp, na) #include +#else +#define BOOTENV +#endif #define CFG_EXTRA_ENV_SETTINGS \ "scriptaddr=0x6d0\0" \ Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-marvell 00/16] Turris Omnia DDR training changes
On 6/18/24 17:34, Marek Behún wrote: Hi Stefan, this is v2 of the series adds some changes to DDR3 training for Armada 38x and Turris Omnia. I also put one unrelated patch (Fix ethernet PHY reset gpio FDT fixup) here. It depends on stuff in Tom's next branch. Applied to u-boot-marvell/master Thanks, Stefan Marek Marek Behún (16): arm: mvebu: turris_omnia: Disable ext4 write support in defconfig ddr: marvell: a38x: debug: return from ddr3_tip_print_log() early if we won't print anything ddr: marvell: a38x: debug: Remove unused variables ddr: marvell: a38x: debug: Define DDR_VIEWER_TOOL variables only if needed, and make them static ddr: marvell: a38x: debug: Allow compiling with immutable debug settings to reduce binary size arm: mvebu: turris_omnia: Enable immutable debug settings in DDR3 training by default arm: mvebu: turris_omnia: Fix ethernet PHY reset gpio FDT fixup arm: mvebu: turris_omnia: Implement EEPROM layout for the 'eeprom' command arm: mvebu: turris_omnia: Enable the 'eeprom' command arm: mvebu: turris_omnia: Extend EEPROM info structure arm: mvebu: turris_omnia: Read DDR speed from EEPROM ddr: marvell: a38x: Import old DDR training code from 2017 version of U-Boot ddr: marvell: a38x: old: Fix some compiler warning of the old code ddr: marvell: a38x: old: Backport immutable debug settings arm: mvebu: a38x: Add optional support for using old DDR3 training code arm: mvebu: turris_omnia: Support old DDR3 training arch/arm/mach-mvebu/Kconfig | 15 + arch/arm/mach-mvebu/include/mach/cpu.h|1 + arch/arm/mach-mvebu/spl.c | 37 +- board/CZ.NIC/turris_omnia/Makefile|2 + board/CZ.NIC/turris_omnia/eeprom.c| 190 ++ board/CZ.NIC/turris_omnia/old_ddr3_training.c | 63 + board/CZ.NIC/turris_omnia/turris_omnia.c | 199 +- configs/turris_omnia_defconfig|6 +- drivers/ddr/marvell/a38x/Makefile |2 + drivers/ddr/marvell/a38x/ddr3_debug.c | 30 +- drivers/ddr/marvell/a38x/ddr3_init.c |3 +- drivers/ddr/marvell/a38x/ddr3_init.h | 43 +- drivers/ddr/marvell/a38x/old/Makefile | 29 + drivers/ddr/marvell/a38x/old/ddr3_a38x.c | 737 + drivers/ddr/marvell/a38x/old/ddr3_a38x.h | 93 + .../marvell/a38x/old/ddr3_a38x_mc_static.h| 226 ++ .../ddr/marvell/a38x/old/ddr3_a38x_topology.h | 22 + .../ddr/marvell/a38x/old/ddr3_a38x_training.c | 39 + drivers/ddr/marvell/a38x/old/ddr3_debug.c | 1546 ++ .../marvell/a38x/old/ddr3_hws_hw_training.c | 147 + .../marvell/a38x/old/ddr3_hws_hw_training.h | 49 + .../a38x/old/ddr3_hws_hw_training_def.h | 464 +++ .../marvell/a38x/old/ddr3_hws_sil_training.h | 17 + drivers/ddr/marvell/a38x/old/ddr3_init.c | 769 + drivers/ddr/marvell/a38x/old/ddr3_init.h | 405 +++ .../ddr/marvell/a38x/old/ddr3_logging_def.h | 101 + .../marvell/a38x/old/ddr3_patterns_64bit.h| 924 ++ .../ddr/marvell/a38x/old/ddr3_topology_def.h | 76 + drivers/ddr/marvell/a38x/old/ddr3_training.c | 2650 + .../ddr/marvell/a38x/old/ddr3_training_bist.c | 288 ++ .../a38x/old/ddr3_training_centralization.c | 711 + .../ddr/marvell/a38x/old/ddr3_training_db.c | 651 .../marvell/a38x/old/ddr3_training_hw_algo.c | 685 + .../marvell/a38x/old/ddr3_training_hw_algo.h | 14 + .../ddr/marvell/a38x/old/ddr3_training_ip.h | 178 ++ .../marvell/a38x/old/ddr3_training_ip_bist.h | 54 + .../old/ddr3_training_ip_centralization.h | 15 + .../marvell/a38x/old/ddr3_training_ip_db.h| 34 + .../marvell/a38x/old/ddr3_training_ip_def.h | 173 ++ .../a38x/old/ddr3_training_ip_engine.c| 1354 + .../a38x/old/ddr3_training_ip_engine.h| 85 + .../marvell/a38x/old/ddr3_training_ip_flow.h | 349 +++ .../marvell/a38x/old/ddr3_training_ip_pbs.h | 41 + .../a38x/old/ddr3_training_ip_prv_if.h| 107 + .../a38x/old/ddr3_training_ip_static.h| 31 + .../marvell/a38x/old/ddr3_training_leveling.c | 1836 .../marvell/a38x/old/ddr3_training_leveling.h | 17 + .../ddr/marvell/a38x/old/ddr3_training_pbs.c | 994 +++ .../marvell/a38x/old/ddr3_training_static.c | 537 .../ddr/marvell/a38x/old/ddr_topology_def.h | 121 + .../ddr/marvell/a38x/old/ddr_training_ip_db.h | 16 + .../marvell/a38x/old/glue_symbol_renames.h| 247 ++ drivers/ddr/marvell/a38x/old/silicon_if.h | 17 + drivers/ddr/marvell/a38x/old/xor.h| 92 + 54 files changed, 17475 insertions(+), 57 deletions(-) create mode 100644 board/CZ.NIC/turris_omnia/eeprom.c create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c create mode 100644 drivers/ddr/marvell/a38x/old/Makefile create m
Re: [PATCH] arm: dts: mvebu: Update DTS for Thecus N2350 board
On 6/11/24 23:42, Tony Dinh wrote: Hi Dragan, On Sun, Jun 9, 2024 at 6:07 PM Dragan Simic wrote: Hello Tony, Please see a few comments below. On 2024-06-10 02:34, Tony Dinh wrote: - Change the spi-max-frequency to 5000 (50 Mhz). According to the data sheet[1], the MX25L3205D max frequency is 86 Mhz. Using 50 Mhz in the DTS to ensure u-boot is consistent with what Linux kernel expected. - Update GPIO fan to conform to the latest DT binding. There's no need for the bullet points, plain prose will do fine instead. I like bullet points :) All my patch descriptions have bullet points when there are 2 or more different items. [1] MX25L3205D-MX25L1605D-MX25L6405D-Macronix-MX25L3205DM2I-12G-datasheet.pdf Unless you can provide a real, working URL for the datasheet, this reference should actually be deleted. It was my oversight. That should have been this URL: https://www.macronix.com/Lists/Datasheet/Attachments/8575/MX25L3205D,%203V,%2032Mb,%20v1.5.pdf I'll wait for Stefan to review the patch and let him decide whether I should send in a V2 patch or he will modify the commit description. I've changed the commit message accordingly. Applied to u-boot-marvell/master Thanks, Stefan Thanks for the comments! All the best, Tony Signed-off-by: Tony Dinh --- arch/arm/dts/armada-385-thecus-n2350.dts | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm/dts/armada-385-thecus-n2350.dts b/arch/arm/dts/armada-385-thecus-n2350.dts index 253cf01130..fdaa444e51 100644 --- a/arch/arm/dts/armada-385-thecus-n2350.dts +++ b/arch/arm/dts/armada-385-thecus-n2350.dts @@ -2,7 +2,7 @@ /* * Device Tree file for Thecus N2350 board * - * Copyright (C) 2018-2023 Tony Dinh + * Copyright (C) 2018-2024 Tony Dinh * Copyright (C) 2018 Manuel Jung */ @@ -143,9 +143,9 @@ fan { compatible = "gpio-fan"; gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>; - gpio-fan,speed-map = <0 0 - 600 1 - 3000 2 >; + gpio-fan,speed-map = <0 0>, + <600 1>, + <3000 2 >; pinctrl-0 = <&pmx_fan>; pinctrl-names = "default"; }; @@ -415,7 +415,7 @@ compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <10800>; + spi-max-frequency = <5000>; spi-cpha; partition@0 { Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
Re: [PATCH] arm: mvebu: env_sf_get_env_addr() missing check for CONFIG_ENV_IS_IN_SPI_FLASH
On 6/6/24 02:12, Tony Dinh wrote: The CONFIG_ENV_OFFSET is undefined if boot device is UART (CONFIG_MVEBU_SPL_BOOT_DEVICE_UART), or envs are not stored on flash (CONFIG_ENV_IS_NOWHERE). Check for CONFIG_ENV_IS_IN_SPI_FLASH as the first condition to determine whether env_sf_get_env_addr() should be provided. Signed-off-by: Tony Dinh Applied to u-boot-marvell/master Thanks, Stefan --- arch/arm/mach-mvebu/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c index 7c62a5dbb6..6dd729ae6e 100644 --- a/arch/arm/mach-mvebu/cpu.c +++ b/arch/arm/mach-mvebu/cpu.c @@ -36,7 +36,7 @@ static const struct mbus_win windows[] = { }; /* SPI0 CS0 Flash of size MBUS_SPI_SIZE is mapped to address MBUS_SPI_BASE */ -#if CONFIG_ENV_SPI_BUS == 0 && CONFIG_ENV_SPI_CS == 0 && \ +#if defined(CONFIG_ENV_IS_IN_SPI_FLASH) && CONFIG_ENV_SPI_BUS == 0 && CONFIG_ENV_SPI_CS == 0 && \ CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE <= MBUS_SPI_SIZE void *env_sf_get_env_addr(void) { Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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] configs: add mvebu_espressobin_ultra-88f3720_defconfig
On 5/30/24 06:47, Benjamin Schneider wrote: Add support for a Marvell Armada 3720 device variant Signed-off-by: Benjamin Schneider Applied to u-boot-marvell/master Thanks, Stefan --- Changes in v3: - Fix typo in MAINTAINERS board/Marvell/mvebu_armada-37xx/MAINTAINERS | 5 + .../mvebu_espressobin_ultra-88f3720_defconfig | 106 ++ 2 files changed, 111 insertions(+) create mode 100644 configs/mvebu_espressobin_ultra-88f3720_defconfig diff --git a/board/Marvell/mvebu_armada-37xx/MAINTAINERS b/board/Marvell/mvebu_armada-37xx/MAINTAINERS index 9b0afeef10..e96499e161 100644 --- a/board/Marvell/mvebu_armada-37xx/MAINTAINERS +++ b/board/Marvell/mvebu_armada-37xx/MAINTAINERS @@ -9,3 +9,8 @@ ESPRESSOBin BOARD M:Konstantin Porotchkin S:Maintained F:configs/mvebu_espressobin-88f3720_defconfig + +ESPRESSOBin Ultra BOARD +M: Ben Schneider +S: Maintained +F: configs/mvebu_espressobin_ultra-88f3720_defconfig diff --git a/configs/mvebu_espressobin_ultra-88f3720_defconfig b/configs/mvebu_espressobin_ultra-88f3720_defconfig new file mode 100644 index 00..c6ffaaabca --- /dev/null +++ b/configs/mvebu_espressobin_ultra-88f3720_defconfig @@ -0,0 +1,106 @@ +CONFIG_ARM=y +CONFIG_ARCH_CPU_INIT=y +CONFIG_ARCH_MVEBU=y +CONFIG_TEXT_BASE=0x +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xff +CONFIG_TARGET_MVEBU_ARMADA_37XX=y +CONFIG_SF_DEFAULT_SPEED=4000 +CONFIG_ENV_SIZE=0x1 +CONFIG_ENV_OFFSET=0x3F +CONFIG_ENV_SECT_SIZE=0x1 +CONFIG_DM_GPIO=y +CONFIG_OF_UPSTREAM=y +CONFIG_DEFAULT_DEVICE_TREE="marvell/armada-3720-espressobin-ultra" +CONFIG_SYS_LOAD_ADDR=0x600 +CONFIG_PCI=y +CONFIG_AHCI=y +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_DISTRO_DEFAULTS=y +CONFIG_OF_BOARD_SETUP=y +CONFIG_USE_PREBOOT=y +CONFIG_SYS_CONSOLE_INFO_QUIET=y +# CONFIG_DISPLAY_CPUINFO is not set +# CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_BOARD_LATE_INIT=y +CONFIG_SYS_MAXARGS=32 +CONFIG_CMD_FUSE=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_I2C=y +CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y +CONFIG_CMD_PCI=y +CONFIG_CMD_SATA=y +CONFIG_CMD_SPI=y +CONFIG_CMD_USB=y +CONFIG_CMD_WDT=y +CONFIG_CMD_TFTPPUT=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_TIME=y +CONFIG_CMD_BTRFS=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_CMD_SQUASHFS=y +CONFIG_CMD_FS_UUID=y +CONFIG_MAC_PARTITION=y +CONFIG_ENV_OVERWRITE=y +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_ARP_TIMEOUT=200 +CONFIG_NET_RETRY_COUNT=50 +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_AHCI_PCI=y +CONFIG_AHCI_MVEBU=y +CONFIG_LBA48=y +CONFIG_SYS_64BIT_LBA=y +CONFIG_CLK=y +CONFIG_CLK_MVEBU=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_MV=y +CONFIG_MISC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_SDMA=y +CONFIG_MMC_SDHCI_XENON=y +CONFIG_MTD=y +CONFIG_DM_MTD=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_ISSI=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_PHY_MARVELL=y +CONFIG_PHY_FIXED=y +CONFIG_PHY_GIGE=y +CONFIG_DM_DSA=y +CONFIG_MV88E6XXX=y +CONFIG_MVNETA=y +CONFIG_MVMDIO=y +CONFIG_NVME_PCI=y +CONFIG_PCI_AARDVARK=y +CONFIG_PHY=y +CONFIG_MVEBU_COMPHY_SUPPORT=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_ARMADA_37XX=y +CONFIG_DM_REGULATOR_GPIO=y +CONFIG_DEFAULT_ENV_IS_RW=y +CONFIG_MVEBU_A3700_UART=y +CONFIG_MVEBU_A3700_SPI=y +CONFIG_USB=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_EHCI_HCD=y +# CONFIG_WATCHDOG_AUTOSTART is not set +CONFIG_WDT=y +CONFIG_WDT_ARMADA_37XX=y +CONFIG_SHA1=y +CONFIG_DM_RTC=y +CONFIG_RTC_PCF8563=y +# CONFIG_DEBUG_UART=y +# CONFIG_DEBUG_UART_BASE=0xd0012000 +# CONFIG_DEBUG_UART_CLOCK=25804800 +# CONFIG_DEBUG_UART_SHIFT=2 +# CONFIG_DEBUG_UART_ANNOUNCE=y Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
Re: [PATCH] arm: davinci: remove unused defines
On 6/19/24 13:00, Emil Kronborg wrote: The last usage of the DV_TIMER_ and DV_WDT_ definitions were removed in commits 8d7757637138 ("ARM: davinci: remove support for cam_enc_4xx") and cef443c1666c ("arm: davinci: remove leftover code for dm* SoCs"), respectively. Signed-off-by: Emil Kronborg --- arch/arm/mach-davinci/include/mach/timer_defs.h | 16 1 file changed, 16 deletions(-) Reviewed-by: Stefan Roese Thanks, Stefan diff --git a/arch/arm/mach-davinci/include/mach/timer_defs.h b/arch/arm/mach-davinci/include/mach/timer_defs.h index 110e67e454ce..38188dc699cf 100644 --- a/arch/arm/mach-davinci/include/mach/timer_defs.h +++ b/arch/arm/mach-davinci/include/mach/timer_defs.h @@ -20,22 +20,6 @@ struct davinci_timer { u_int32_t wdtcr; }; -#define DV_TIMER_TCR_ENAMODE_MASK 3 - -#define DV_TIMER_TCR_ENAMODE12_SHIFT 6 -#define DV_TIMER_TCR_CLKSRC12_SHIFT8 -#define DV_TIMER_TCR_READRSTMODE12_SHIFT 10 -#define DV_TIMER_TCR_CAPMODE12_SHIFT 11 -#define DV_TIMER_TCR_CAPVTMODE12_SHIFT 12 -#define DV_TIMER_TCR_ENAMODE34_SHIFT 22 -#define DV_TIMER_TCR_CLKSRC34_SHIFT24 -#define DV_TIMER_TCR_READRSTMODE34_SHIFT 26 -#define DV_TIMER_TCR_CAPMODE34_SHIFT 27 -#define DV_TIMER_TCR_CAPEVTMODE12_SHIFT28 - -#define DV_WDT_ENABLE_SYS_RESET0x0002 -#define DV_WDT_TRIGGER_SYS_RESET 0x00020002 - #ifdef CONFIG_HW_WATCHDOG void davinci_hw_watchdog_enable(void); void davinci_hw_watchdog_reset(void); base-commit: 01a5d7547ed3a51a8ac5837c31a150f85bc475f8 Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
Re: [PATCH] arm: davinci: remove unused watchdog functions
On 6/19/24 12:57, Emil Kronborg wrote: The davinci_hw_watchdog_ functions are defined but never called from anywhere. Commit 881ae794b93b ("calimain: remove board") eliminated the last call to these functions. Signed-off-by: Emil Kronborg --- .../mach-davinci/include/mach/timer_defs.h| 4 --- arch/arm/mach-davinci/timer.c | 31 --- 2 files changed, 35 deletions(-) Nice small cleanup: Reviewed-by: Stefan Roese Thanks, Stefan diff --git a/arch/arm/mach-davinci/include/mach/timer_defs.h b/arch/arm/mach-davinci/include/mach/timer_defs.h index 110e67e454ce..7b21f2599930 100644 --- a/arch/arm/mach-davinci/include/mach/timer_defs.h +++ b/arch/arm/mach-davinci/include/mach/timer_defs.h @@ -36,8 +36,4 @@ struct davinci_timer { #define DV_WDT_ENABLE_SYS_RESET 0x0002 #define DV_WDT_TRIGGER_SYS_RESET 0x00020002 -#ifdef CONFIG_HW_WATCHDOG -void davinci_hw_watchdog_enable(void); -void davinci_hw_watchdog_reset(void); -#endif #endif /* _TIMER_DEFS_H_ */ diff --git a/arch/arm/mach-davinci/timer.c b/arch/arm/mach-davinci/timer.c index f2990f718773..474dc6b1abd9 100644 --- a/arch/arm/mach-davinci/timer.c +++ b/arch/arm/mach-davinci/timer.c @@ -98,34 +98,3 @@ ulong get_tbclk(void) { return gd->arch.timer_rate_hz; } - -#ifdef CONFIG_HW_WATCHDOG -static struct davinci_timer * const wdttimer = - (struct davinci_timer *)CONFIG_SYS_WDTTIMERBASE; - -/* - * See prufw2.pdf for using Timer as a WDT - */ -void davinci_hw_watchdog_enable(void) -{ - writel(0x0, &wdttimer->tcr); - writel(0x0, &wdttimer->tgcr); - /* TIMMODE = 2h */ - writel(0x08 | 0x03 | ((TIM_CLK_DIV - 1) << 8), &wdttimer->tgcr); - writel(CONFIG_SYS_WDT_PERIOD_LOW, &wdttimer->prd12); - writel(CONFIG_SYS_WDT_PERIOD_HIGH, &wdttimer->prd34); - writel(2 << 22, &wdttimer->tcr); - writel(0x0, &wdttimer->tim12); - writel(0x0, &wdttimer->tim34); - /* set WDEN bit, WDKEY 0xa5c6 */ - writel(0xa5c64000, &wdttimer->wdtcr); - /* clear counter register */ - writel(0xda7e4000, &wdttimer->wdtcr); -} - -void davinci_hw_watchdog_reset(void) -{ - writel(0xa5c64000, &wdttimer->wdtcr); - writel(0xda7e4000, &wdttimer->wdtcr); -} -#endif base-commit: 01a5d7547ed3a51a8ac5837c31a150f85bc475f8 Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 12/20] cyclic: Rise default CYCLIC_MAX_CPU_TIME_US to 5000
Hi Jiaxun, On 6/18/24 16:00, Jiaxun Yang wrote: 在2024年6月18日六月 上午12:29,Tom Rini写道: [...] Acked-by: Stefan Roese Can we please get either this, or https://patchwork.ozlabs.org/project/uboot/patch/20240524210817.1953298-1-rasmus.villem...@prevas.dk/ merged for master? The number of false negatives in CI due to this is big issue for getting more contributors to use CI. Thanks. It seems like CYCLIC doesn't have it's own custodian tree. How are we going to handle it in this case? I've already pulled this patch. I introduced the cyclic framework some time ago and as it's closely related to the watchdog stuff, I'm currently handling these patches as well. Thanks, Stefan
Please pull u-boot-watchdog/master
Hi Tom, please pull the following cyclic related change to fix the CI build issue here: - cyclic: Rise default CYCLIC_MAX_CPU_TIME_US to 5000 (Jiaxun) Here the Azure build, without any issues: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=371&view=results Thanks, Stefan The following changes since commit 16324b43db3f2b4fbbc3b701893fcfc4104f33fb: Merge tag 'u-boot-nand-20240617' of https://source.denx.de/u-boot/custodians/u-boot-nand-flash (2024-06-17 09:27:28 -0600) are available in the Git repository at: g...@source.denx.de:u-boot/custodians/u-boot-watchdog.git for you to fetch changes up to 1fd754cebd38d7456caa82bef15225cbe77960ec: cyclic: Rise default CYCLIC_MAX_CPU_TIME_US to 5000 (2024-06-18 12:34:37 +0200) Jiaxun Yang (1): cyclic: Rise default CYCLIC_MAX_CPU_TIME_US to 5000 common/Kconfig | 2 +- configs/octeon_nic23_defconfig | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
Re: [PATCH 12/20] cyclic: Rise default CYCLIC_MAX_CPU_TIME_US to 5000
On 6/18/24 01:29, Tom Rini wrote: On Fri, Jun 14, 2024 at 04:13:54PM +0200, Stefan Roese wrote: On 6/12/24 18:50, Tom Rini wrote: On Wed, Jun 12, 2024 at 05:13:37PM +0100, Jiaxun Yang wrote: 在2024年6月12日六月 下午5:00,Tom Rini写道: [...] configs/octeon_nic23_defconfig | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) This seems similar to: https://patchwork.ozlabs.org/project/uboot/patch/20240524210817.1953298-1-rasmus.villem...@prevas.dk/ at least for CI. And for outside CI, I'm OK with just having the value be changed in the defconfig as needed. We do support using config fragments, so keeping such changes locally isn't too hard. So the default value is a little bit too hard even for some of the actual hardware. Right, there's some platforms where it's too small and we should just bump it up. I think for now the default is what we want it to be for most platforms. The current default value is definitely too small, especially when CI is involved (I did not have this in mind when implementing), so: Acked-by: Stefan Roese Can we please get either this, or https://patchwork.ozlabs.org/project/uboot/patch/20240524210817.1953298-1-rasmus.villem...@prevas.dk/ merged for master? The number of false negatives in CI due to this is big issue for getting more contributors to use CI. Thanks. Yes. Applied to u-boot-watchdog/master Thanks, Stefan
Please pull u-boot-watchdog/next
Hi Tom, please pull the following watchdog & cyclic related patches: - misc cyclic infrastructure improvements (Rasmus) - watchdog_reset cleanup (Rasmus) Here the Azure build, without any issues: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=369&view=results Thanks, Stefan The following changes since commit 0786dd573d0793417852e009dee3148ebdd163f3: test/py: net_boot: Add test cases for net boot (2024-06-13 16:31:24 -0600) are available in the Git repository at: g...@source.denx.de:u-boot/custodians/u-boot-watchdog.git next for you to fetch changes up to 85c476759a42dfedb2d66e9734f8c05b7cfb62d5: powerpc: mpc85xx: remove dead watchdog-related code (2024-06-16 12:14:18 +0200) Rasmus Villemoes (10): cyclic: stop strdup'ing name in cyclic_register() wdt-uclass: prevent multiple cyclic_register calls cyclic: make clients embed a struct cyclic_info in their own data structure m68k: remove dead code wdt-uclass: watchdog_reset cleanup serial: ns16550: fix comment to mention schedule instead of watchdog_reset sh4: move reset_cpu() from watchdog.c to cpu.c sh4: remove watchdog.c file powerpc: mpc83xx: remove unused watchdog_reset() function powerpc: mpc85xx: remove dead watchdog-related code arch/m68k/cpu/mcf52x2/cpu.c| 108 - arch/powerpc/cpu/mpc83xx/cpu.c | 15 -- arch/powerpc/cpu/mpc85xx/cpu.c | 31 --- arch/sh/cpu/sh4/Makefile | 2 +- arch/sh/cpu/sh4/cpu.c | 10 arch/sh/cpu/sh4/watchdog.c | 60 - board/Marvell/octeon_nic23/board.c | 11 ++-- cmd/cyclic.c | 12 ++--- common/cyclic.c| 24 +++-- doc/develop/cyclic.rst | 26 + drivers/serial/ns16550.c | 8 +-- drivers/watchdog/wdt-uclass.c | 57 include/cyclic.h | 37 ++--- include/watchdog.h | 3 -- test/common/cyclic.c | 19 --- 15 files changed, 102 insertions(+), 321 deletions(-) delete mode 100644 arch/sh/cpu/sh4/watchdog.c
Re: [PATCH 0/7] watchdog_reset cleanup
On 5/28/24 13:13, Rasmus Villemoes wrote: watchdog_reset is no more. That is, it is no longer called from anywhere, so any leftover definitions are just dead weight, and references in comments need to be updated. I don't have access to any m68k, sh or powerpc boards. Only lightly compile-tested. Apart from the two sh4 patches, these are independent of each other and can be applied individually. Cc: Angelo Dureghello Cc: Christophe Leroy Cc: Huan Wang Cc: Nobuhiro Iwamatsu Applied to u-boot-watchdog/next Thanks, Stefan Rasmus Villemoes (7): m68k: remove dead code wdt-uclass: watchdog_reset cleanup serial: ns16550: fix comment to mention schedule instead of watchdog_reset sh4: move reset_cpu() from watchdog.c to cpu.c sh4: remove watchdog.c file powerpc: mpc83xx: remove unused watchdog_reset() function powerpc: mpc85xx: remove dead watchdog-related code arch/m68k/cpu/mcf52x2/cpu.c| 108 - arch/powerpc/cpu/mpc83xx/cpu.c | 15 - arch/powerpc/cpu/mpc85xx/cpu.c | 31 -- arch/sh/cpu/sh4/Makefile | 2 +- arch/sh/cpu/sh4/cpu.c | 10 +++ arch/sh/cpu/sh4/watchdog.c | 61 --- drivers/serial/ns16550.c | 8 +-- drivers/watchdog/wdt-uclass.c | 19 +- include/watchdog.h | 3 - 9 files changed, 17 insertions(+), 240 deletions(-) delete mode 100644 arch/sh/cpu/sh4/watchdog.c Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 v4 0/3] cyclic/watchdog patches
On 5/21/24 10:46, Rasmus Villemoes wrote: A bit of a mixed bag. I've been wanting to submit something like 3/3 for a while. So when I stumbled on Marek's patch https://lore.kernel.org/u-boot/20240316201416.211480-1-marek.vasut+rene...@mailbox.org/ , I got reminded of that plan, and I think that patch could be more readable if we adopt this model. While actually doing those mostly mechanical changes, I stumbled on two separate issues that probably want fixing regardless of the fate of 3/3. Mostly just compile-tested, and now also checked that at least the sandbox test runs succesfully, and that it builds both with and without CONFIG_CYCLIC. v4: Make sure there's only one definition of struct cyclic_info, previous versions failed to move the full definition under #ifdef CONFIG_CYCLIC, breaking builds with !CONFIG_CYCLIC. v3: Also update the unit test according to the new API. v2: Add R-bs from Stefan. Fixup whitespace in the doc/ part. Rebase to current master (676903c1b97), fixing trivial conflict with 301bac6047c8. Rasmus Villemoes (3): cyclic: stop strdup'ing name in cyclic_register() wdt-uclass: prevent multiple cyclic_register calls cyclic: make clients embed a struct cyclic_info in their own data structure Applied to u-boot-watchdog/next Thanks, Stefan board/Marvell/octeon_nic23/board.c | 9 --- cmd/cyclic.c | 12 -- common/cyclic.c| 24 +-- doc/develop/cyclic.rst | 26 drivers/watchdog/wdt-uclass.c | 38 -- include/cyclic.h | 37 +++-- test/common/cyclic.c | 19 +-- 7 files changed, 84 insertions(+), 81 deletions(-) Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 0/7] watchdog_reset cleanup
On 5/28/24 13:13, Rasmus Villemoes wrote: watchdog_reset is no more. That is, it is no longer called from anywhere, so any leftover definitions are just dead weight, and references in comments need to be updated. I don't have access to any m68k, sh or powerpc boards. Only lightly compile-tested. Apart from the two sh4 patches, these are independent of each other and can be applied individually. Cc: Angelo Dureghello Cc: Christophe Leroy Cc: Huan Wang Cc: Nobuhiro Iwamatsu Thanks for continuing the cleanup here: Reviewed-by: Stefan Roese Thanks, Stefan Rasmus Villemoes (7): m68k: remove dead code wdt-uclass: watchdog_reset cleanup serial: ns16550: fix comment to mention schedule instead of watchdog_reset sh4: move reset_cpu() from watchdog.c to cpu.c sh4: remove watchdog.c file powerpc: mpc83xx: remove unused watchdog_reset() function powerpc: mpc85xx: remove dead watchdog-related code arch/m68k/cpu/mcf52x2/cpu.c| 108 - arch/powerpc/cpu/mpc83xx/cpu.c | 15 - arch/powerpc/cpu/mpc85xx/cpu.c | 31 -- arch/sh/cpu/sh4/Makefile | 2 +- arch/sh/cpu/sh4/cpu.c | 10 +++ arch/sh/cpu/sh4/watchdog.c | 61 --- drivers/serial/ns16550.c | 8 +-- drivers/watchdog/wdt-uclass.c | 19 +- include/watchdog.h | 3 - 9 files changed, 17 insertions(+), 240 deletions(-) delete mode 100644 arch/sh/cpu/sh4/watchdog.c Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 12/20] cyclic: Rise default CYCLIC_MAX_CPU_TIME_US to 5000
On 6/12/24 18:50, Tom Rini wrote: On Wed, Jun 12, 2024 at 05:13:37PM +0100, Jiaxun Yang wrote: 在2024年6月12日六月 下午5:00,Tom Rini写道: [...] configs/octeon_nic23_defconfig | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) This seems similar to: https://patchwork.ozlabs.org/project/uboot/patch/20240524210817.1953298-1-rasmus.villem...@prevas.dk/ at least for CI. And for outside CI, I'm OK with just having the value be changed in the defconfig as needed. We do support using config fragments, so keeping such changes locally isn't too hard. So the default value is a little bit too hard even for some of the actual hardware. Right, there's some platforms where it's too small and we should just bump it up. I think for now the default is what we want it to be for most platforms. The current default value is definitely too small, especially when CI is involved (I did not have this in mind when implementing), so: Acked-by: Stefan Roese Thanks, Stefan
Re: [PATCH v4 0/3] cyclic/watchdog patches
On 5/21/24 14:45, Rasmus Villemoes wrote: On 21/05/2024 13.54, Stefan Roese wrote: On 5/21/24 11:47, Rasmus Villemoes wrote: On 21/05/2024 10.46, Rasmus Villemoes wrote: A bit of a mixed bag. I've been wanting to submit something like 3/3 for a while. So when I stumbled on Marek's patch https://lore.kernel.org/u-boot/20240316201416.211480-1-marek.vasut+rene...@mailbox.org/ , I got reminded of that plan, and I think that patch could be more readable if we adopt this model. While actually doing those mostly mechanical changes, I stumbled on two separate issues that probably want fixing regardless of the fate of 3/3. Mostly just compile-tested, and now also checked that at least the sandbox test runs succesfully, and that it builds both with and without CONFIG_CYCLIC. So I managed to trigger an azure test by pushing to github and creating a dummy PR: https://github.com/u-boot/u-boot/pull/542 That fails, and while it involves the cyclic framework, I'm pretty sure these patches are not to blame, since the same error also exists in other pipelines. It's an "expect" failure, because some watchdog callback apparently sometimes takes more than 1ms, so the default 1000us threshold is exceeded, and that prints a warning which breaks the "expect". An example is https://dev.azure.com/u-boot/u-boot/_build/results?buildId=8459&view=logs&j=a1270dec-081b-5c65-5cd5-5e915a842596&t=69f6cf72-86f3-551a-807d-f28f62a1426f&l=1055 . I don't know why it only/mostly seems to happen in clang builds, but I think the fact that these happen quite frequently warrants either bumping the threshold used in the CI builds quite a lot, or adding a config option to suppress that warning/limit altogether for CI builds. I've also seen CI build issues from time to time and restarting the build magically solved these issues. I'm all for making this CI build more stable, perhaps Tom has some ideas? Well, the problem seems to be inherent in the warning from the cyclic framework; maybe more so when the build server is overloaded (as sometimes those callbacks are reported to have taken 5+ ms). So when running sandbox, or under qemu, I think that warning should be disabled. Agreed. Regarding this cyclic patch: Still some problems, MIPS64 related at least, octeon_nic23 target: https://dev.azure.com/sr0718/0cded7c3-6e6a-4b57-8d0f-65c99496c42f/_apis/build/builds/357/logs/415 Oh my, this is starting to be really embarrassing. The fix is trivial (as the callback doesn't even use any context): -static void octeon_board_restore_pf(void *ctx) +static void octeon_board_restore_pf(struct cyclic_info *c) Should I resend yet again? No need. I'll apply this and squash it here. If CI build works, I'll send the pull request. Otherwise this needs to wait for the next merge window I'm afraid. Thanks, Stefan
Re: [PATCH v4 0/3] cyclic/watchdog patches
On 5/21/24 11:47, Rasmus Villemoes wrote: On 21/05/2024 10.46, Rasmus Villemoes wrote: A bit of a mixed bag. I've been wanting to submit something like 3/3 for a while. So when I stumbled on Marek's patch https://lore.kernel.org/u-boot/20240316201416.211480-1-marek.vasut+rene...@mailbox.org/ , I got reminded of that plan, and I think that patch could be more readable if we adopt this model. While actually doing those mostly mechanical changes, I stumbled on two separate issues that probably want fixing regardless of the fate of 3/3. Mostly just compile-tested, and now also checked that at least the sandbox test runs succesfully, and that it builds both with and without CONFIG_CYCLIC. So I managed to trigger an azure test by pushing to github and creating a dummy PR: https://github.com/u-boot/u-boot/pull/542 That fails, and while it involves the cyclic framework, I'm pretty sure these patches are not to blame, since the same error also exists in other pipelines. It's an "expect" failure, because some watchdog callback apparently sometimes takes more than 1ms, so the default 1000us threshold is exceeded, and that prints a warning which breaks the "expect". An example is https://dev.azure.com/u-boot/u-boot/_build/results?buildId=8459&view=logs&j=a1270dec-081b-5c65-5cd5-5e915a842596&t=69f6cf72-86f3-551a-807d-f28f62a1426f&l=1055 . I don't know why it only/mostly seems to happen in clang builds, but I think the fact that these happen quite frequently warrants either bumping the threshold used in the CI builds quite a lot, or adding a config option to suppress that warning/limit altogether for CI builds. I've also seen CI build issues from time to time and restarting the build magically solved these issues. I'm all for making this CI build more stable, perhaps Tom has some ideas? Regarding this cyclic patch: Still some problems, MIPS64 related at least, octeon_nic23 target: https://dev.azure.com/sr0718/0cded7c3-6e6a-4b57-8d0f-65c99496c42f/_apis/build/builds/357/logs/415 Thanks, Stefan
Re: [PATCH v2 3/3] cyclic: make clients embed a struct cyclic_info in their own data structure
On 5/21/24 10:38, Rasmus Villemoes wrote: On 21/05/2024 08.57, Stefan Roese wrote: On 5/19/24 21:44, Rasmus Villemoes wrote: On 18/05/2024 09.34, Stefan Roese wrote: This introduces some problems when compiling e.g. sandbox: In file included from test/common/cyclic.c:10: test/common/cyclic.c: In function ‘dm_test_cyclic_running’: test/common/cyclic.c:25:42: warning: passing argument 1 of ‘cyclic_register’ from incompatible pointer type [-Wincompatible-pointer-types] 25 | ut_assertnonnull(cyclic_register(cyclic_test, 10 * 1000, "cyclic_demo", | ^~~ | | | void (*)(void *) include/test/ut.h:298:29: note: in definition of macro ‘ut_assertnonnull’ [...] Could you please also change the test file accordingly? I'll then try to get this upstream shortly. Whoops, I don't know how I managed to miss that when grepping for users. Sorry about that. Updated version coming shortly. Thanks. Still the new version also fails in the CI build. I'm using MS Azure for this, here the link to the failing build: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=355&view=results Apparently I'm blind, the full definition of 'struct cyclic_info' was not guarded by CONFIG_CYCLIC. Yes, I already "played" a bit here but still got other problems. Could you please make sure that CI fully builds? Is there a way I can trigger that from my side without sending patches? You need to have an azure account and push a branch with your patches into your u-boot repo to trigger the CI build. Gitlab also is possible AFAIK. BTW: Not sure if I still can pull this (updated version) in, since I'm leaving for a 2 week vacation tomorrow morning. NP, I should have been more careful. I'll send an updated version in a moment anyway. Thanks, Stefan
Re: [PATCH v2 3/3] cyclic: make clients embed a struct cyclic_info in their own data structure
On 5/19/24 21:44, Rasmus Villemoes wrote: On 18/05/2024 09.34, Stefan Roese wrote: This introduces some problems when compiling e.g. sandbox: In file included from test/common/cyclic.c:10: test/common/cyclic.c: In function ‘dm_test_cyclic_running’: test/common/cyclic.c:25:42: warning: passing argument 1 of ‘cyclic_register’ from incompatible pointer type [-Wincompatible-pointer-types] 25 | ut_assertnonnull(cyclic_register(cyclic_test, 10 * 1000, "cyclic_demo", | ^~~ | | | void (*)(void *) include/test/ut.h:298:29: note: in definition of macro ‘ut_assertnonnull’ [...] Could you please also change the test file accordingly? I'll then try to get this upstream shortly. Whoops, I don't know how I managed to miss that when grepping for users. Sorry about that. Updated version coming shortly. Thanks. Still the new version also fails in the CI build. I'm using MS Azure for this, here the link to the failing build: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=355&view=results Could you please make sure that CI fully builds? BTW: Not sure if I still can pull this (updated version) in, since I'm leaving for a 2 week vacation tomorrow morning. Thanks, Stefan
Re: [PATCH v2 3/3] cyclic: make clients embed a struct cyclic_info in their own data structure
Hi Rasmus, On 5/16/24 09:53, Rasmus Villemoes wrote: There are of course not a whole lot of examples in-tree yet, but before they appear, let's make this API change: Instead of separately allocating a 'struct cyclic_info', make the users embed such an instance in their own structure, and make the convention that the callback simply receives the 'struct cyclic_info *', from which the clients can get their own data using the container_of() macro. This has a number of advantages. First, it means cyclic_register() simply cannot fail, simplifying the code. The necessary storage will simply be allocated automatically when the client's own structure is allocated (often via uclass_priv_auto or similar). Second, code for which CONFIG_CYCLIC is just an option can more easily be written without #ifdefs, if we just provide an empty struct cyclic_info {}. For example, the nested CONFIG_IS_ENABLED()s in https://lore.kernel.org/u-boot/20240316201416.211480-1-marek.vasut+rene...@mailbox.org/ are mostly due to the existence of the 'struct cyclic_info *' member being guarded by #ifdef CONFIG_CYCLIC. And we do probably want to avoid the extra memory overhead of that member when !CONFIG_CYCLIC. But that is automatic if, instead of a 'struct cyclic_info *', one simply embeds a 'struct cyclic_info', which will have size 0 when !CONFIG_CYCLIC. Also, the no-op cyclic_register() function can just unconditionally be called, and the compiler will see that (1) the callback is referenced, so not emit a warning for a maybe-unused function and (2) see that it can actually never be reached, so not emit any code for it. Reviewed-by: Stefan Roese Signed-off-by: Rasmus Villemoes --- board/Marvell/octeon_nic23/board.c | 9 +--- cmd/cyclic.c | 12 +-- common/cyclic.c| 22 +-- doc/develop/cyclic.rst | 26 ++- drivers/watchdog/wdt-uclass.c | 33 + include/cyclic.h | 34 +++--- 6 files changed, 64 insertions(+), 72 deletions(-) This introduces some problems when compiling e.g. sandbox: In file included from test/common/cyclic.c:10: test/common/cyclic.c: In function ‘dm_test_cyclic_running’: test/common/cyclic.c:25:42: warning: passing argument 1 of ‘cyclic_register’ from incompatible pointer type [-Wincompatible-pointer-types] 25 | ut_assertnonnull(cyclic_register(cyclic_test, 10 * 1000, "cyclic_demo", | ^~~ | | | void (*)(void *) include/test/ut.h:298:29: note: in definition of macro ‘ut_assertnonnull’ 298 | const void *_val = (expr); \ | ^~~~ In file included from test/common/cyclic.c:6: include/cyclic.h:58:42: note: expected ‘struct cyclic_info *’ but argument is of type ‘void (*)(void *)’ 58 | void cyclic_register(struct cyclic_info *cyclic, cyclic_func_t func, | ^~ test/common/cyclic.c:25:55: warning: passing argument 2 of ‘cyclic_register’ makes pointer from integer without a cast [-Wint-conversion] 25 | ut_assertnonnull(cyclic_register(cyclic_test, 10 * 1000, "cyclic_demo", | ^ | | | int Could you please also change the test file accordingly? I'll then try to get this upstream shortly. Many thanks in advance, Stefan diff --git a/board/Marvell/octeon_nic23/board.c b/board/Marvell/octeon_nic23/board.c index bc9332cb74a..74b9c741b7b 100644 --- a/board/Marvell/octeon_nic23/board.c +++ b/board/Marvell/octeon_nic23/board.c @@ -357,10 +357,13 @@ int board_late_init(void) board_configure_qlms(); /* Register cyclic function for PCIe FLR fixup */ - cyclic = cyclic_register(octeon_board_restore_pf, 100, -"pcie_flr_fix", NULL); - if (!cyclic) + cyclic = calloc(1, sizeof(*cyclic)); + if (cyclic) { + cyclic_register(cyclic, octeon_board_restore_pf, 100, + "pcie_flr_fix"); + } else { printf("Registering of cyclic function failed\n"); + } return 0; } diff --git a/cmd/cyclic.c b/cmd/cyclic.c index 40e966de9aa..339dd4a7bce 100644 --- a/cmd/cyclic.c +++ b/cmd/cyclic.c @@ -15,14 +15,16 @@ #include #include #include +#include struct cyclic_demo_info { + struct cyclic_info cyclic; uint delay_us; }; -static void cyclic_demo(void *ctx) +static void cyclic_demo(struct cyclic_info
Re: [PATCH 3/3] cyclic: make clients embed a struct cyclic_info in their own data structure
Hi Rasmus, On 5/9/24 02:47, Rasmus Villemoes wrote: There are of course not a whole lot of examples in-tree yet, but before they appear, let's make this API change: Instead of separately allocating a 'struct cyclic_info', make the users embed such an instance in their own structure, and make the convention that the callback simply receives the 'struct cyclic_info *', from which the clients can get their own data using the container_of() macro. This has a number of advantages. First, it means cyclic_register() simply cannot fail, simplifying the code. The necessary storage will simply be allocated automatically when the client's own structure is allocated (often via uclass_priv_auto or similar). Second, code for which CONFIG_CYCLIC is just an option can more easily be written without #ifdefs, if we just provide an empty struct cyclic_info {}. For example, the nested CONFIG_IS_ENABLED()s in https://lore.kernel.org/u-boot/20240316201416.211480-1-marek.vasut+rene...@mailbox.org/ are mostly due to the existence of the 'struct cyclic_info *' member being guarded by #ifdef CONFIG_CYCLIC. And we do probably want to avoid the extra memory overhead of that member when !CONFIG_CYCLIC. But that is automatic if, instead of a 'struct cyclic_info *', one simply embeds a 'struct cyclic_info', which will have size 0 when !CONFIG_CYCLIC. Also, the no-op cyclic_register() function can just unconditionally be called, and the compiler will see that (1) the callback is referenced, so not emit a warning for a maybe-unused function and (2) see that it can actually never be reached, so not emit any code for it. Signed-off-by: Rasmus Villemoes --- board/Marvell/octeon_nic23/board.c | 9 +--- cmd/cyclic.c | 12 +-- common/cyclic.c| 22 +-- doc/develop/cyclic.rst | 26 ++- drivers/watchdog/wdt-uclass.c | 33 + include/cyclic.h | 34 +++--- 6 files changed, 64 insertions(+), 72 deletions(-) I like this approach. And would like to pull this in as well, perhaps before leaving on a 2 week vacation mid of next week. Unfortunately this patch 3/3 does not apply on TOT any more. Could you please rebase and re-submit? Reviewed-by: Stefan Roese Thanks, Stefan diff --git a/board/Marvell/octeon_nic23/board.c b/board/Marvell/octeon_nic23/board.c index bc9332cb74a..74b9c741b7b 100644 --- a/board/Marvell/octeon_nic23/board.c +++ b/board/Marvell/octeon_nic23/board.c @@ -357,10 +357,13 @@ int board_late_init(void) board_configure_qlms(); /* Register cyclic function for PCIe FLR fixup */ - cyclic = cyclic_register(octeon_board_restore_pf, 100, -"pcie_flr_fix", NULL); - if (!cyclic) + cyclic = calloc(1, sizeof(*cyclic)); + if (cyclic) { + cyclic_register(cyclic, octeon_board_restore_pf, 100, + "pcie_flr_fix"); + } else { printf("Registering of cyclic function failed\n"); + } return 0; } diff --git a/cmd/cyclic.c b/cmd/cyclic.c index ad7fc3b975e..315546515f0 100644 --- a/cmd/cyclic.c +++ b/cmd/cyclic.c @@ -14,14 +14,16 @@ #include #include #include +#include struct cyclic_demo_info { + struct cyclic_info cyclic; uint delay_us; }; -static void cyclic_demo(void *ctx) +static void cyclic_demo(struct cyclic_info *c) { - struct cyclic_demo_info *info = ctx; + struct cyclic_demo_info *info = container_of(c, struct cyclic_demo_info, cyclic); /* Just a small dummy delay here */ udelay(info->delay_us); @@ -31,7 +33,6 @@ static int do_cyclic_demo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { struct cyclic_demo_info *info; - struct cyclic_info *cyclic; uint time_ms; if (argc < 3) @@ -47,10 +48,7 @@ static int do_cyclic_demo(struct cmd_tbl *cmdtp, int flag, int argc, info->delay_us = simple_strtoul(argv[2], NULL, 0); /* Register demo cyclic function */ - cyclic = cyclic_register(cyclic_demo, time_ms * 1000, "cyclic_demo", -info); - if (!cyclic) - printf("Registering of cyclic_demo failed\n"); + cyclic_register(&info->cyclic, cyclic_demo, time_ms * 1000, "cyclic_demo"); printf("Registered function \"%s\" to be executed all %dms\n", "cyclic_demo", time_ms); diff --git a/common/cyclic.c b/common/cyclic.c index c62e7fa7d19..ec38fad6775 100644 --- a/common/cyclic.c +++ b/common/cyclic.c @@ -26,34 +26,22 @@ struct hlist_head *cyclic_get_list(void) return (struct hlist_head *)&gd->cyclic_list; }
Re: [PATCH 07/11] watchdog: Add support for ADI SC5XX-family watchdog peripheral
On 5/15/24 23:57, Greg Malysa wrote: From: Nathan Barrett-Morrison Co-developed-by: Greg Malysa Signed-off-by: Greg Malysa Co-developed-by: Ian Roberts Signed-off-by: Ian Roberts Signed-off-by: Vasileios Bimpikas Signed-off-by: Utsav Agarwal Signed-off-by: Arturs Artamonovs Signed-off-by: Nathan Barrett-Morrison --- MAINTAINERS| 1 + drivers/watchdog/Kconfig | 9 +++ drivers/watchdog/Makefile | 1 + drivers/watchdog/adi_wdt.c | 145 + 4 files changed, 156 insertions(+) create mode 100644 drivers/watchdog/adi_wdt.c Reviewed-by: Stefan Roese Thanks, Stefan diff --git a/MAINTAINERS b/MAINTAINERS index c1685f0352..6feb7e540b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -618,6 +618,7 @@ F: drivers/pinctrl/pinctrl-adi-adsp.c F:drivers/serial/serial_adi_uart4.c F:drivers/timer/adi_sc5xx_timer.c F:drivers/usb/musb-new/sc5xx.c +F: drivers/watchdog/adi_wdt.c F:include/env/adi/ ARM SNAPDRAGON diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 8318fd77a3..5a62000272 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -94,6 +94,15 @@ config WDT_APPLE The watchdog will perform a full SoC reset resulting in a reboot of the entire system. +config WDT_ADI + bool "Analog Devices watchdog timer support" + select WDT + select SPL_WDT if SPL + depends on (SC57X || SC58X || SC59X || SC59X_64) + help + Enable this to support Watchdog Timer on ADI SC57X, SC58X, SC59X, + and SC59X_64 processors + config WDT_ARMADA_37XX bool "Marvell Armada 37xx watchdog timer support" depends on WDT && ARMADA_3700 diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 7b39adcf0f..7ad61b513c 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -50,3 +50,4 @@ obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt.o obj-$(CONFIG_WDT_SUNXI) += sunxi_wdt.o obj-$(CONFIG_WDT_TANGIER) += tangier_wdt.o obj-$(CONFIG_WDT_XILINX) += xilinx_wwdt.o +obj-$(CONFIG_WDT_ADI) += adi_wdt.o diff --git a/drivers/watchdog/adi_wdt.c b/drivers/watchdog/adi_wdt.c new file mode 100644 index 00..67d17dc692 --- /dev/null +++ b/drivers/watchdog/adi_wdt.c @@ -0,0 +1,145 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * (C) Copyright 2022 - Analog Devices, Inc. + * + * Written and/or maintained by Timesys Corporation + * + * Converted to driver model by Nathan Barrett-Morrison + * + * Contact: Nathan Barrett-Morrison + * Contact: Greg Malysa + * + * adi_wtd.c - driver for ADI on-chip watchdog + * + */ + +#include +#include +#include +#include +#include +#include + +#define WDOG_CTL 0x0 +#define WDOG_CNT 0x4 +#define WDOG_STAT 0x8 + +#define RCU_CTL 0x0 +#define RCU_STAT 0x4 + +#define SEC_GCTL 0x0 +#define SEC_FCTL 0x10 +#define SEC_SCTL0 0x800 + +#define WDEN 0x0010 +#define WDDIS 0x0AD0 + +struct adi_wdt_priv { + void __iomem *rcu_base; + void __iomem *sec_base; + void __iomem *wdt_base; + struct clk clock; +}; + +static int adi_wdt_reset(struct udevice *dev) +{ + struct adi_wdt_priv *priv = dev_get_priv(dev); + + writel(0, priv->wdt_base + WDOG_STAT); + + return 0; +} + +static int adi_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) +{ + struct adi_wdt_priv *priv = dev_get_priv(dev); + u32 sctl_val; + + /* Disable SYSCD_RESETb input and clear the RCU0 reset status */ + writel(0xf, priv->rcu_base + RCU_STAT); + writel(0x0, priv->rcu_base + RCU_CTL); + + /* reset the SEC controller */ + writel(0x2, priv->sec_base + SEC_GCTL); + writel(0x2, priv->sec_base + SEC_FCTL); + + udelay(50); + + /* enable SEC fault event */ + writel(0x1, priv->sec_base + SEC_GCTL); + + /* ANOMALY 3614 Spurious External Fault event occurs when FCTL +* is re-programmed when currently active fault is not cleared +*/ + writel(0xc0, priv->sec_base + SEC_FCTL); + writel(0xc1, priv->sec_base + SEC_FCTL); + + /* enable SEC fault source for watchdog0 */ + sctl_val = readl((priv->sec_base + SEC_SCTL0) + 3 * 8) | 0x6; + writel(sctl_val, (priv->sec_base + SEC_SCTL0) + 3 * 8); + + /* Enable SYSCD_RESETb input */ + writel(0x100, priv->rcu_base + RCU_CTL); + + /* enable watchdog0 */ + writel(WDDIS, priv->wdt_base + WDOG_CTL); + + writel(timeout_ms / 1000 * + (clk_get_rate(&priv->clock) / (IS_ENABLED(CONFIG_SC58X) ? 2 : 1)), + priv->wdt_base + WDOG_CNT); + + writel(0, priv->wdt_base + WDOG_STAT); + writel(WDEN, priv->wdt_base + WDOG_CTL); + + return 0; +} + +static int adi_wdt_probe(struct udevice *dev) +{ + struct adi_wdt_priv *priv = dev_get_priv(dev); + int ret;
Re: [PATCH u-boot-mvebu 10/10] arm: mvebu: turris_omnia: Support old DDR3 training, selectable via env var
On 5/15/24 11:24, Marek Behún wrote: On Wed, 15 May 2024 11:10:09 +0200 Stefan Roese wrote: Hi Marek, On 5/15/24 10:59, Marek Behún wrote: On Mon, 6 May 2024 12:03:55 +0200 Stefan Roese wrote: Hi Marek, On 4/15/24 18:30, Marek Behún wrote: Support old DDR3 training code on Turris Omnia, selectable by U-Boot enviroment variable. Users experiencing DDR3 initialization failures or random crashes of the operating system due to incorrect DDR3 configuration can select the old DDR3 training implementation to fix those issues by setting the environment variable env set omnia_ddr3_training old env save Signed-off-by: Marek Behún --- arch/arm/mach-mvebu/Kconfig | 1 + board/CZ.NIC/turris_omnia/Makefile| 1 + board/CZ.NIC/turris_omnia/old_ddr3_training.c | 79 +++ board/CZ.NIC/turris_omnia/turris_omnia.c | 2 +- 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c For turris_omnia_defconfig, this is dropped when compiled: drivers/ddr/marvell/a38x/old/ddr3_debug.c:776:12: warning: 'ddr3_tip_access_atr' declared 'static' but never defined [-Wunused-function] 776 | static int ddr3_tip_access_atr(u32 dev_num, u32 flag_id, u32 value, u32 **ptr); |^~~ And it also seems that there is still something wrong with this old DDR training code port. Some boards still experience random bugs with this, but not with the U-Boot from 2015. :-( Hmmm, strange. How to continue? Are these "old DDR training patches" on hold for now? The first 5 patches should be fine, the "old DDR training" comes in the second half. Is it possible to merge only the first 5? And also the one patch I sent on April 30: arm: mvebu: turris_omnia: Fix ethernet PHY reset gpio FDT fixup Yes, that might be possible. Let me check... Thanks, Stefan
Re: [PATCH 3/3] drivers: misc: Add driver to access ZynqMP efuses
Hi Lukas, On 5/15/24 08:33, Lukas Funke wrote: Hi Stefan, On 15.05.2024 08:12, Stefan Roese wrote: Hi Lukas, On 5/14/24 16:04, lukas.funke-...@weidmueller.com wrote: From: Lukas Funke Add driver to access ZynqMP efuses. This is a u-boot port of [1]. [1] https://lore.kernel.org/all/20240224114516.86365-8-srinivas.kandaga...@linaro.org/ Signed-off-by: Lukas Funke --- drivers/misc/Kconfig | 8 ++ drivers/misc/Makefile | 1 + drivers/misc/zynqmp_efuse.c | 213 3 files changed, 222 insertions(+) create mode 100644 drivers/misc/zynqmp_efuse.c diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 6009d55f400..c07f50c9a76 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -298,6 +298,14 @@ config FSL_SEC_MON Security Monitor can be transitioned on any security failures, like software violations or hardware security violations. +config ZYNQMP_EFUSE + bool "Enable ZynqMP eFUSE Driver" + depends on ZYNQMP_FIRMWARE + help + Enable access to Zynq UltraScale (ZynqMP) eFUSEs thought PMU firmware + interface. ZnyqMP has 256 eFUSEs where some of them are security related + and cannot be read back (i.e. AES key). + choice prompt "Security monitor interaction endianess" depends on FSL_SEC_MON diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index e53d52c47b3..68ba5648eab 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -92,3 +92,4 @@ obj-$(CONFIG_ESM_K3) += k3_esm.o obj-$(CONFIG_ESM_PMIC) += esm_pmic.o obj-$(CONFIG_SL28CPLD) += sl28cpld.o obj-$(CONFIG_SPL_SOCFPGA_DT_REG) += socfpga_dtreg.o +obj-$(CONFIG_ZYNQMP_EFUSE) += zynqmp_efuse.o diff --git a/drivers/misc/zynqmp_efuse.c b/drivers/misc/zynqmp_efuse.c new file mode 100644 index 000..0cfc42a4f39 --- /dev/null +++ b/drivers/misc/zynqmp_efuse.c @@ -0,0 +1,213 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2014 - 2015 Xilinx, Inc. + * Michal Simek + * + * (C) Copyright 2024 Weidmueller Interface GmbH + * Lukas Funke + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define SILICON_REVISION_MASK 0xF +#define P_USER_0_64_UPPER_MASK 0x5FFF +#define P_USER_127_LOWER_4_BIT_MASK 0xF +#define WORD_INBYTES (4) +#define SOC_VER_SIZE (0x4) +#define EFUSE_MEMORY_SIZE (0x177) +#define UNUSED_SPACE (0x8) +#define ZYNQMP_NVMEM_SIZE (SOC_VER_SIZE + UNUSED_SPACE + \ + EFUSE_MEMORY_SIZE) +#define SOC_VERSION_OFFSET (0x0) +#define EFUSE_START_OFFSET (0xC) +#define EFUSE_END_OFFSET (0xFC) +#define EFUSE_PUF_START_OFFSET (0x100) +#define EFUSE_PUF_MID_OFFSET (0x140) +#define EFUSE_PUF_END_OFFSET (0x17F) +#define EFUSE_NOT_ENABLED (29) +#define EFUSE_READ (0) +#define EFUSE_WRITE (1) + +/** + * struct xilinx_efuse - the basic structure + * @src: address of the buffer to store the data to be write/read + * @size: no of words to be read/write + * @offset: offset to be read/write` + * @flag: 0 - represents efuse read and 1- represents efuse write + * @pufuserfuse:0 - represents non-puf efuses, offset is used for read/write + * 1 - represents puf user fuse row number. + * + * this structure stores all the required details to + * read/write efuse memory. + */ +struct xilinx_efuse { + u64 src; + u32 size; + u32 offset; + u32 flag; + u32 pufuserfuse; +}; + +static int zynqmp_efuse_access(struct udevice *dev, unsigned int offset, + void *val, size_t bytes, unsigned int flag, + unsigned int pufflag) +{ + size_t words = bytes / WORD_INBYTES; + ulong dma_addr, dma_buf; + struct xilinx_efuse *efuse; + char *data; + int ret, value; + + if (bytes % WORD_INBYTES != 0) { + dev_err(dev, "Bytes requested should be word aligned\n"); + return -EOPNOTSUPP; + } + + if (pufflag == 0 && offset % WORD_INBYTES) { + dev_err(dev, "Offset requested should be word aligned\n"); + return -EOPNOTSUPP; + } + + if (pufflag == 1 && flag == EFUSE_WRITE) { + memcpy(&value, val, bytes); + if ((offset == EFUSE_PUF_START_OFFSET || + offset == EFUSE_PUF_MID_OFFSET) && + value & P_USER_0_64_UPPER_MASK) { + dev_err(dev, "Only lower 4 bytes are allowed to be programmed in P_USER_0 & P_USER_64\n"); + return -EOPNOTSUPP; + } + + if (offset == EFUSE_PUF_END_OFFSET && + (value & P_USER_127_LOWER_4_BIT_MASK)) { + dev_err(dev, "Only MSB 28 bits are allowed to be programmed for P_USER_127\n"); + return -EOPNOTSUPP; + } + } + + efuse = dma_alloc_coherent(sizeof(struct xilinx_efuse), &dma_addr); + if (!efuse) + return -ENOMEM; + +
Re: [PATCH u-boot-mvebu 10/10] arm: mvebu: turris_omnia: Support old DDR3 training, selectable via env var
Hi Marek, On 5/15/24 10:59, Marek Behún wrote: On Mon, 6 May 2024 12:03:55 +0200 Stefan Roese wrote: Hi Marek, On 4/15/24 18:30, Marek Behún wrote: Support old DDR3 training code on Turris Omnia, selectable by U-Boot enviroment variable. Users experiencing DDR3 initialization failures or random crashes of the operating system due to incorrect DDR3 configuration can select the old DDR3 training implementation to fix those issues by setting the environment variable env set omnia_ddr3_training old env save Signed-off-by: Marek Behún --- arch/arm/mach-mvebu/Kconfig | 1 + board/CZ.NIC/turris_omnia/Makefile| 1 + board/CZ.NIC/turris_omnia/old_ddr3_training.c | 79 +++ board/CZ.NIC/turris_omnia/turris_omnia.c | 2 +- 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c For turris_omnia_defconfig, this is dropped when compiled: drivers/ddr/marvell/a38x/old/ddr3_debug.c:776:12: warning: 'ddr3_tip_access_atr' declared 'static' but never defined [-Wunused-function] 776 | static int ddr3_tip_access_atr(u32 dev_num, u32 flag_id, u32 value, u32 **ptr); |^~~ And it also seems that there is still something wrong with this old DDR training code port. Some boards still experience random bugs with this, but not with the U-Boot from 2015. :-( Hmmm, strange. How to continue? Are these "old DDR training patches" on hold for now? Thanks, Stefan
Re: [PATCH 3/3] drivers: misc: Add driver to access ZynqMP efuses
UPP; + } + } + + efuse = dma_alloc_coherent(sizeof(struct xilinx_efuse), &dma_addr); + if (!efuse) + return -ENOMEM; + + data = dma_alloc_coherent(bytes, &dma_buf); + if (!data) { + dma_free_coherent(efuse); + return -ENOMEM; + } + + if (flag == EFUSE_WRITE) { + memcpy(data, val, bytes); + efuse->flag = EFUSE_WRITE; + } else { + efuse->flag = EFUSE_READ; + } + + efuse->src = dma_buf; + efuse->size = words; + efuse->offset = offset; + efuse->pufuserfuse = pufflag; + + flush_dcache_range((ulong)efuse, (ulong)efuse + + roundup(sizeof(struct xilinx_efuse), ARCH_DMA_MINALIGN)); + flush_dcache_range((ulong)data, (ulong)data + + roundup(sizeof(struct xilinx_efuse), ARCH_DMA_MINALIGN)); efuse and data are allocated via dma_alloc_coherent(). It should not be necessary to use flush the cache here IIUTC. + + zynqmp_pm_efuse_access(dma_addr, (u32 *)&ret); + if (ret != 0) { + if (ret == EFUSE_NOT_ENABLED) { + dev_err(dev, "efuse access is not enabled\n"); + ret = -EOPNOTSUPP; + goto END; + } + dev_err(dev, "Error in efuse read %x\n", ret); + ret = -EPERM; + goto END; + } + + if (flag == EFUSE_READ) + memcpy(val, data, bytes); +END: Nitpicking: Upper case label ist pretty uncommon AFAIK. + + dma_free_coherent(efuse); + dma_free_coherent(data); + + return ret; +} + +static int zynqmp_nvmem_read(struct udevice *dev, int offset, +void *val, int bytes) +{ + int ret, pufflag = 0; + int idcode, version; + + if (offset >= EFUSE_PUF_START_OFFSET && offset <= EFUSE_PUF_END_OFFSET) + pufflag = 1; + + dev_dbg(dev, "reading from offset=0x%x, bytes=%d\n", offset, bytes); + + switch (offset) { + /* Soc version offset is zero */ + case SOC_VERSION_OFFSET: + if (bytes != SOC_VER_SIZE) + return -EOPNOTSUPP; + + ret = zynqmp_pm_get_chipid((u32 *)&idcode, (u32 *)&version); + if (ret < 0) + return ret; + + *(int *)val = version & SILICON_REVISION_MASK; + break; + /* Efuse offset starts from 0xc */ + case EFUSE_START_OFFSET ... EFUSE_END_OFFSET: + case EFUSE_PUF_START_OFFSET ... EFUSE_PUF_END_OFFSET: + ret = zynqmp_efuse_access(dev, offset, val, + bytes, EFUSE_READ, pufflag); + break; + default: + *(u32 *)val = 0xDEADBEEF; + ret = 0; + break; + } + + return ret; +} + +static int zynqmp_nvmem_write(struct udevice *dev, int offset, const void *val, + int bytes) +{ + int pufflag = 0; + + dev_dbg(dev, "writing to offset=0x%x, bytes=%d", offset, bytes); + + if (offset < EFUSE_START_OFFSET || offset > EFUSE_PUF_END_OFFSET) + return -EOPNOTSUPP; + + if (offset >= EFUSE_PUF_START_OFFSET && offset <= EFUSE_PUF_END_OFFSET) + pufflag = 1; + + return zynqmp_efuse_access(dev, offset, + (void *)val, bytes, EFUSE_WRITE, pufflag); +} + +static const struct udevice_id zynqmp_efuse_match[] = { + { .compatible = "xlnx,zynqmp-nvmem-fw", }, + { /* sentinel */ }, +}; + +static const struct misc_ops zynqmp_efuse_ops = { + .read = zynqmp_nvmem_read, + .write = zynqmp_nvmem_write, +}; + +U_BOOT_DRIVER(zynqmp_efuse) = { + .name = "zynqmp_efuse", + .id = UCLASS_MISC, + .of_match = zynqmp_efuse_match, + .ops = &zynqmp_efuse_ops, +}; Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 1/3] firmware: zynqmp: Add support to access efuses
Hi Lukas, On 5/14/24 16:04, lukas.funke-...@weidmueller.com wrote: From: Lukas Funke Add functions to access efuses through PMU firmware interface. Signed-off-by: Lukas Funke --- drivers/firmware/firmware-zynqmp.c | 31 ++ include/zynqmp_firmware.h | 2 ++ 2 files changed, 33 insertions(+) diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c index f99507d86c6..7483f2a8709 100644 --- a/drivers/firmware/firmware-zynqmp.c +++ b/drivers/firmware/firmware-zynqmp.c @@ -210,6 +210,37 @@ int zynqmp_pm_feature(const u32 api_id) return ret_payload[1] & FIRMWARE_VERSION_MASK; } +int zynqmp_pm_get_chipid(u32 *idcode, u32 *version) +{ + int ret; + u32 ret_payload[PAYLOAD_ARG_CNT]; Reverse x-mas tree ordering looks better IMHO. + + if (!idcode || !version) + return -EINVAL; + + ret = xilinx_pm_request(PM_GET_CHIPID, 0, 0, 0, 0, ret_payload); + *idcode = ret_payload[1]; + *version = ret_payload[2]; You don't check ret for an error above but still pass the return values here. Perhaps it makes sense to return with error above instead? + + return ret; +} + +int zynqmp_pm_efuse_access(const u64 address, u32 *out) +{ + int ret; + u32 ret_payload[PAYLOAD_ARG_CNT]; + + if (!out) + return -EINVAL; + + ret = xilinx_pm_request(PM_EFUSE_ACCESS, upper_32_bits(address), + lower_32_bits(address), 0, 0, ret_payload); Same here. Thanks, Stefan + + *out = ret_payload[1]; + + return ret; +} + int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id) { int ret; diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h index 73198a6a6ea..7f18b4d59bf 100644 --- a/include/zynqmp_firmware.h +++ b/include/zynqmp_firmware.h @@ -453,6 +453,8 @@ int xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2, int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value); int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config, u32 value); +int zynqmp_pm_get_chipid(u32 *idcode, u32 *version); +int zynqmp_pm_efuse_access(const u64 address, u32 *out); int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id); int zynqmp_mmio_read(const u32 address, u32 *value); int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value); Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 2/3] wdt-uclass: prevent multiple cyclic_register calls
Hi Rasmus, On 5/13/24 13:09, Rasmus Villemoes wrote: On 13/05/2024 12.40, Stefan Roese wrote: On 5/9/24 02:47, Rasmus Villemoes wrote: Currently, the cyclic_register() done in wdt_start() is not undone in wdt_stop(). Moreover, calling wdt_start multiple times (which is perfectly allowed on an already started device, e.g. to change the timeout value) will result in another struct cyclic_info being registered, referring to the same watchdog device. This can easily be seen on e.g. a wandboard: => cyclic list function: watchdog@20bc000, cpu-time: 22 us, frequency: 1.01 times/s => wdt list watchdog@20bc000 (imx_wdt) => wdt dev watchdog@20bc000 => wdt start 5 WDT: Started watchdog@20bc000 with servicing every 1000ms (50s timeout) => cyclic list function: watchdog@20bc000, cpu-time: 37 us, frequency: 1.03 times/s function: watchdog@20bc000, cpu-time: 241 us, frequency: 1.01 times/s => wdt start 12345 WDT: Started watchdog@20bc000 with servicing every 1000ms (12s timeout) => cyclic list function: watchdog@20bc000, cpu-time: 36 us, frequency: 1.03 times/s function: watchdog@20bc000, cpu-time: 100 us, frequency: 1.04 times/s function: watchdog@20bc000, cpu-time: 299 us, frequency: 1.00 times/s So properly unregister the watchdog device from the cyclic framework in wdt_stop(). In wdt_start(), we cannot just skip the registration, as the (new) timeout value may mean that we have to ask the cyclic framework to call us more often. So if we're already running, first unregister the old cyclic instance. Thanks again for all your valuable work here. I do have a question regarding this patch though. AFAIU, it's a valid use-case to enable 2 different watchdog devices. And this patch will prevent such a setup. Or do I misunderstand this? No, that shouldn't prevent enabling or petting two different watchdogs at all, that should work just as well as today. All the state I'm looking at and modifying belongs to one specific device, it's not wdt-uclass-global state, it's wdt-uclass-per-device state. That's what I was hoping, but was too lazy to figure out myself. But with the existing code, if one calls wdt_start() a second time on an already started device, the existing priv->cyclic pointer is dropped on the floor (it gets unconditionally overwritten by the new cyclic_register() return value), so one gets the situation that the same device has multiple cyclic callbacks registered. Also, we're not unregistering the device from the cyclic framework upon ->stop(). Understood. Today, that's "mostly harmless". It does mean 'cyclic list' becomes cluttered, and is a memory leak, so you could exhaust memory by doing wdt_start in a loop, and cyclic_run() ends up doing extra callbacks to the same device (all but one will be no-ops due to the per-device rate-limiting of ->reset callbacks). In practice there's no chance of memory corruption or other failures. However, that changes with 3/3, where it would be catastrophic to call cyclic_register() with an already registered cyclic_info instance, as the hlist would become corrupt. I think it's worth fixing regardless of whether 3/3 is accepted. Agreed. Reviewed-by: Stefan Roese Thanks, Stefan
Re: [PATCH 2/3] wdt-uclass: prevent multiple cyclic_register calls
On 5/9/24 02:47, Rasmus Villemoes wrote: Currently, the cyclic_register() done in wdt_start() is not undone in wdt_stop(). Moreover, calling wdt_start multiple times (which is perfectly allowed on an already started device, e.g. to change the timeout value) will result in another struct cyclic_info being registered, referring to the same watchdog device. This can easily be seen on e.g. a wandboard: => cyclic list function: watchdog@20bc000, cpu-time: 22 us, frequency: 1.01 times/s => wdt list watchdog@20bc000 (imx_wdt) => wdt dev watchdog@20bc000 => wdt start 5 WDT: Started watchdog@20bc000 with servicing every 1000ms (50s timeout) => cyclic list function: watchdog@20bc000, cpu-time: 37 us, frequency: 1.03 times/s function: watchdog@20bc000, cpu-time: 241 us, frequency: 1.01 times/s => wdt start 12345 WDT: Started watchdog@20bc000 with servicing every 1000ms (12s timeout) => cyclic list function: watchdog@20bc000, cpu-time: 36 us, frequency: 1.03 times/s function: watchdog@20bc000, cpu-time: 100 us, frequency: 1.04 times/s function: watchdog@20bc000, cpu-time: 299 us, frequency: 1.00 times/s So properly unregister the watchdog device from the cyclic framework in wdt_stop(). In wdt_start(), we cannot just skip the registration, as the (new) timeout value may mean that we have to ask the cyclic framework to call us more often. So if we're already running, first unregister the old cyclic instance. Thanks again for all your valuable work here. I do have a question regarding this patch though. AFAIU, it's a valid use-case to enable 2 different watchdog devices. And this patch will prevent such a setup. Or do I misunderstand this? Thanks, Stefan Signed-off-by: Rasmus Villemoes --- drivers/watchdog/wdt-uclass.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c index 417e8d7eef9..caa1567e0c3 100644 --- a/drivers/watchdog/wdt-uclass.c +++ b/drivers/watchdog/wdt-uclass.c @@ -122,10 +122,11 @@ int wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) struct wdt_priv *priv = dev_get_uclass_priv(dev); char str[16]; - priv->running = true; - memset(str, 0, 16); if (IS_ENABLED(CONFIG_WATCHDOG)) { + if (priv->running) + cyclic_unregister(priv->cyclic); + /* Register the watchdog driver as a cyclic function */ priv->cyclic = cyclic_register(wdt_cyclic, priv->reset_period * 1000, @@ -140,6 +141,7 @@ int wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) } } + priv->running = true; printf("WDT: Started %s with%s servicing %s (%ds timeout)\n", dev->name, IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", str, (u32)lldiv(timeout_ms, 1000)); @@ -160,6 +162,9 @@ int wdt_stop(struct udevice *dev) if (ret == 0) { struct wdt_priv *priv = dev_get_uclass_priv(dev); + if (IS_ENABLED(CONFIG_WATCHDOG) && priv->running) + cyclic_unregister(priv->cyclic); + priv->running = false; } Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 1/3] cyclic: stop strdup'ing name in cyclic_register()
On 5/9/24 02:47, Rasmus Villemoes wrote: We are not checking the return value of strdup(), nor freeing the string in cyclic_unregister(). However, all current users either pass a string literal or the dev->name of the client device. So in all cases the name string will live at least as long as the cyclic_info is registered, so just make that a requirement. Signed-off-by: Rasmus Villemoes Reviewed-by: Stefan Roese Thanks, Stefan --- common/cyclic.c | 2 +- include/cyclic.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/cyclic.c b/common/cyclic.c index a49bfc88f5c..c62e7fa7d19 100644 --- a/common/cyclic.c +++ b/common/cyclic.c @@ -40,7 +40,7 @@ struct cyclic_info *cyclic_register(cyclic_func_t func, uint64_t delay_us, /* Store values in struct */ cyclic->func = func; cyclic->ctx = ctx; - cyclic->name = strdup(name); + cyclic->name = name; cyclic->delay_us = delay_us; cyclic->start_time_us = timer_get_us(); hlist_add_head(&cyclic->list, cyclic_get_list()); diff --git a/include/cyclic.h b/include/cyclic.h index 44ad3cb6b80..38946216fb8 100644 --- a/include/cyclic.h +++ b/include/cyclic.h @@ -31,7 +31,7 @@ struct cyclic_info { void (*func)(void *ctx); void *ctx; - char *name; + const char *name; uint64_t delay_us; uint64_t start_time_us; uint64_t cpu_time_us; Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 60/81] serial: Remove and add needed includes
On 02.05.24 03:31, Tom Rini wrote: Remove from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini Tested-by: Stefan Bosch Looks ok, tested on FriendlyElec-Board NanoPC-T2 (s5p4418_nanopi2_defconfig). Thanks a lot! --- Cc: Tom Rini Cc: Simon Glass Cc: Matthias Brugger Cc: Peter Robinson Cc: Alex Nemirovsky Cc: Neil Armstrong Cc: Caleb Connolly Cc: Sumit Garg Cc: This contributor prefers not to receive mails Cc: Stefan Roese Cc: Stefano Babic Cc: Fabio Estevam Cc: "NXP i.MX U-Boot Team" Cc: Manivannan Sadhasivam Cc: Philipp Tomsich Cc: Kever Yang Cc: Stefan Bosch Cc: Sean Anderson Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Kunihiko Hayashi Cc: Dai Okamura Cc: Anastasiia Lukianenko Cc: Oleksandr Andrushchenko Cc: Michal Simek Cc: Rasmus Villemoes Cc: Marek Vasut Cc: Venkatesh Yadav Abbarapu Cc: Maksim Kiselev Cc: Algapally Santosh Sagar Cc: Heinrich Schuchardt Cc: Bin Meng Cc: Peng Fan Cc: "Sébastien Szymanski" Cc: Ye Li Cc: Christophe Leroy Cc: Weijie Gao Cc: Sam Shih Cc: Jim Liu Cc: Lukasz Majewski Cc: Yang Xiwen --- drivers/serial/altera_jtag_uart.c | 1 - drivers/serial/altera_uart.c | 1 - drivers/serial/arm_dcc.c | 1 - drivers/serial/atmel_usart.c | 1 - drivers/serial/ns16550.c | 2 +- drivers/serial/sandbox.c | 1 - drivers/serial/serial-uclass.c| 2 +- drivers/serial/serial.c | 2 +- drivers/serial/serial_ar933x.c| 1 - drivers/serial/serial_arc.c | 1 - drivers/serial/serial_bcm283x_mu.c| 1 - drivers/serial/serial_bcm283x_pl011.c | 1 - drivers/serial/serial_coreboot.c | 1 - drivers/serial/serial_cortina.c | 1 - drivers/serial/serial_efi.c | 1 - drivers/serial/serial_htif.c | 1 - drivers/serial/serial_intel_mid.c | 1 - drivers/serial/serial_linflexuart.c | 1 - drivers/serial/serial_lpuart.c| 1 - drivers/serial/serial_mcf.c | 1 - drivers/serial/serial_meson.c | 1 - drivers/serial/serial_mpc8xx.c| 1 - drivers/serial/serial_msm.c | 1 - drivers/serial/serial_msm_geni.c | 1 - drivers/serial/serial_mtk.c | 2 +- drivers/serial/serial_mvebu_a3700.c | 1 - drivers/serial/serial_mxc.c | 1 - drivers/serial/serial_mxs.c | 1 - drivers/serial/serial_npcm.c | 1 - drivers/serial/serial_ns16550.c | 2 +- drivers/serial/serial_nulldev.c | 1 - drivers/serial/serial_omap.c | 2 +- drivers/serial/serial_owl.c | 1 - drivers/serial/serial_pic32.c | 1 - drivers/serial/serial_pl01x.c | 1 - drivers/serial/serial_rockchip.c | 1 - drivers/serial/serial_s5p4418_pl011.c | 1 - drivers/serial/serial_semihosting.c | 1 - drivers/serial/serial_sifive.c| 1 - drivers/serial/serial_sti_asc.c | 1 - drivers/serial/serial_stm32.c | 1 - drivers/serial/serial_uniphier.c | 1 - drivers/serial/serial_xen.c | 1 - drivers/serial/serial_xuartlite.c | 1 - drivers/serial/serial_zynq.c | 1 - drivers/serial/usbtty.c | 1 - 46 files changed, 6 insertions(+), 46 deletions(-) diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c index 9e39da7dd246..3f706e1839f2 100644 --- a/drivers/serial/altera_jtag_uart.c +++ b/drivers/serial/altera_jtag_uart.c @@ -4,7 +4,6 @@ * Scott McNutt */ -#include #include #include #include diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c index 35920480841a..3c13ef25bb49 100644 --- a/drivers/serial/altera_uart.c +++ b/drivers/serial/altera_uart.c @@ -4,7 +4,6 @@ * Scott McNutt */ -#include #include #include #include diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c index a402a123b6d6..66af136695d0 100644 --- a/drivers/serial/arm_dcc.c +++ b/drivers/serial/arm_dcc.c @@ -15,7 +15,6 @@ * this file might be covered by the GNU General Public License. */ -#include #include #include diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c index 9827c006fa88..7e45a80969e8 100644 --- a/drivers/serial/atmel_usart.c +++ b/drivers/serial/atmel_usart.c @@ -5,7 +5,6 @@ * Modified to support C structur SoC access by * Andreas Bießmann */ -#include #include #include #include diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 6deb1d8ddc56..4963385dc1c1 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c index f6ac3d228526..ec0068e33d34 100644 --- a/drivers/serial/sandbox.c +++ b/drivers/serial/sandbox.c @@ -9,7 +9,6 @@ * U-Boot
Re: [PATCH 51/81] pinctrl: Remove and add needed includes
On 02.05.24 03:31, Tom Rini wrote: Remove from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini Tested-by: Stefan Bosch Looks ok, tested on FriendlyElec-Board NanoPC-T2 (s5p4418_nanopi2_defconfig). Thanks a lot! --- Cc: Ryan Chen Cc: Chia-Wei Wang Cc: Aspeed BMC SW team Cc: Joel Stanley Cc: Tom Rini Cc: Matthias Brugger Cc: Peter Robinson Cc: Ryder Lee Cc: Weijie Gao Cc: Chunfeng Yun Cc: GSS_MTK_Uboot_upstream Cc: Neil Armstrong Cc: Gregory CLEMENT Cc: Lars Povlsen Cc: Horatiu Vultur Cc: Stefan Roese Cc: Stefan Bosch Cc: Mark Kettenis Cc: Sean Anderson Cc: Simon Glass Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Michal Simek Cc: Caleb Connolly Cc: Sumit Garg Cc: Philipp Tomsich Cc: Kever Yang Cc: Thierry Reding Cc: Svyatoslav Ryhel Cc: Kunihiko Hayashi Cc: Dai Okamura Cc: Minkyu Kang Cc: Sam Protsenko Cc: Peng Fan Cc: Stefano Babic Cc: Matthias Schiffer Cc: Quentin Schulz Cc: Jonas Karlman Cc: Volodymyr Babchuk Cc: Robert Marko --- drivers/pinctrl/aspeed/pinctrl_ast2500.c | 1 - drivers/pinctrl/aspeed/pinctrl_ast2600.c | 1 - drivers/pinctrl/ath79/pinctrl_ar933x.c | 1 - drivers/pinctrl/ath79/pinctrl_qca953x.c | 1 - drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 1 - drivers/pinctrl/broadcom/pinctrl-bcm6838.c | 1 - drivers/pinctrl/exynos/pinctrl-exynos.c | 1 - drivers/pinctrl/exynos/pinctrl-exynos7420.c | 1 - drivers/pinctrl/exynos/pinctrl-exynos78x0.c | 1 - drivers/pinctrl/intel/pinctrl.c | 1 - drivers/pinctrl/intel/pinctrl_apl.c | 1 - drivers/pinctrl/mediatek/pinctrl-mtk-common.c| 1 - drivers/pinctrl/meson/pinctrl-meson-a1.c | 1 - drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c| 1 - drivers/pinctrl/meson/pinctrl-meson-axg.c| 1 - drivers/pinctrl/meson/pinctrl-meson-g12a.c | 1 - drivers/pinctrl/meson/pinctrl-meson-gx-pmx.c | 1 - drivers/pinctrl/meson/pinctrl-meson-gxbb.c | 1 - drivers/pinctrl/meson/pinctrl-meson-gxl.c| 1 - drivers/pinctrl/meson/pinctrl-meson.c| 1 - drivers/pinctrl/mscc/mscc-common.c | 1 - drivers/pinctrl/mscc/pinctrl-jr2.c | 1 - drivers/pinctrl/mscc/pinctrl-luton.c | 1 - drivers/pinctrl/mscc/pinctrl-ocelot.c| 1 - drivers/pinctrl/mscc/pinctrl-serval.c| 1 - drivers/pinctrl/mscc/pinctrl-servalt.c | 1 - drivers/pinctrl/mtmips/pinctrl-mt7628.c | 1 - drivers/pinctrl/mtmips/pinctrl-mtmips-common.c | 1 - drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 1 - drivers/pinctrl/mvebu/pinctrl-armada-38x.c | 1 - drivers/pinctrl/mvebu/pinctrl-mvebu.c| 1 - drivers/pinctrl/nexell/pinctrl-nexell.c | 1 - drivers/pinctrl/nexell/pinctrl-s5pxx18.c | 1 - drivers/pinctrl/nxp/pinctrl-imx.c| 1 - drivers/pinctrl/nxp/pinctrl-imx5.c | 1 - drivers/pinctrl/nxp/pinctrl-imx6.c | 1 - drivers/pinctrl/nxp/pinctrl-imx7.c | 1 - drivers/pinctrl/nxp/pinctrl-imx7ulp.c| 1 - drivers/pinctrl/nxp/pinctrl-imx8.c | 1 - drivers/pinctrl/nxp/pinctrl-imx8ulp.c| 1 - drivers/pinctrl/nxp/pinctrl-imxrt.c | 1 - drivers/pinctrl/nxp/pinctrl-mxs.c| 1 - drivers/pinctrl/nxp/pinctrl-scu.c| 1 - drivers/pinctrl/nxp/pinctrl-vf610.c | 1 - drivers/pinctrl/pinctrl-apple.c | 1 - drivers/pinctrl/pinctrl-at91-pio4.c | 1 - drivers/pinctrl/pinctrl-at91.c | 1 - drivers/pinctrl/pinctrl-generic.c| 1 - drivers/pinctrl/pinctrl-k210.c | 1 - drivers/pinctrl/pinctrl-qe-io.c | 1 - drivers/pinctrl/pinctrl-sandbox.c| 1 - drivers/pinctrl/pinctrl-single.c | 1 - drivers/pinctrl/pinctrl-sti.c| 1 - drivers/pinctrl/pinctrl-stmfx.c | 1 - drivers/pinctrl/pinctrl-uclass.c | 1 - drivers/pinctrl/pinctrl-zynqmp.c | 1 - drivers/pinctrl/pinctrl_pic32.c | 1 - drivers/pinctrl/pinctrl_stm32.c | 1 - drivers/pinctrl/qcom/pinctrl-apq8016.c | 1 - drivers/pinctrl/qcom/pinctrl-apq8096.c | 1 - drivers/pinctrl/qcom/pinctrl-ipq4019.c | 1 - drivers/pinctrl/qcom/pinctrl-qcom.c | 1 - drivers/pinctrl/qcom/pinctrl-qcs404.c| 1 - drivers/pinctrl/qcom/pinctrl-sdm845.c| 1 - drivers/pinctrl/rockchip/pinctrl-px30.c | 1 - drivers/pinctrl/rockchip/pinctrl-rk3036.c| 1 - drivers/pinctrl/rockchip/pinctrl-rk3066.c| 1 - drivers/pinctrl/rockchip/pinctrl-rk3128.c| 1 - drivers/pinctrl/rockchip/pinctrl-rk3188.c| 1 - drivers
Re: [PATCH 50/81] phy: Remove and add needed includes
On 02.05.24 03:31, Tom Rini wrote: Remove from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini Tested-by: Stefan Bosch Looks ok, tested on FriendlyElec-Board NanoPC-T2 (s5p4418_nanopi2_defconfig). Thanks a lot! --- Cc: Jagan Teki Cc: Andre Przywara Cc: Tom Rini Cc: Stefan Roese Cc: Neil Armstrong Cc: Stephan Gerhold Cc: Linus Walleij Cc: Mark Kettenis Cc: Ryder Lee Cc: Weijie Gao Cc: Chunfeng Yun Cc: GSS_MTK_Uboot_upstream Cc: Nobuhiro Iwamatsu Cc: Marek Vasut Cc: Patrick Delaunay Cc: Patrice Chotard Cc: Michal Simek Cc: Caleb Connolly Cc: Sumit Garg Cc: Simon Glass Cc: Philipp Tomsich Cc: Kever Yang Cc: Kunihiko Hayashi Cc: Dai Okamura Cc: Sean Anderson Cc: Nishanth Menon Cc: Matthias Schiffer Cc: Stefan Bosch Cc: Eugen Hristev Cc: Igor Prusov Cc: Svyatoslav Ryhel Cc: Tim Harvey Cc: Fabio Estevam Cc: Adam Ford Cc: Jonas Karlman Cc: Johan Jonker Cc: Jon Lin Cc: Ren Jianing Cc: Frank Wang Cc: Siddharth Vadapalli Cc: Ravi Gunasekaran --- drivers/phy/allwinner/phy-sun4i-usb.c | 1 - drivers/phy/bcm6318-usbh-phy.c | 1 - drivers/phy/bcm6348-usbh-phy.c | 1 - drivers/phy/bcm6358-usbh-phy.c | 1 - drivers/phy/bcm6368-usbh-phy.c | 1 - drivers/phy/cadence/phy-cadence-sierra.c | 1 - drivers/phy/cadence/phy-cadence-torrent.c | 1 - drivers/phy/keystone-usb-phy.c | 1 - drivers/phy/marvell/comphy_a3700.c | 1 - drivers/phy/marvell/comphy_core.c | 1 - drivers/phy/marvell/comphy_cp110.c | 2 +- drivers/phy/marvell/comphy_mux.c | 1 - drivers/phy/meson-axg-mipi-dphy.c | 1 - drivers/phy/meson-axg-mipi-pcie-analog.c | 1 - drivers/phy/meson-g12a-usb2.c | 1 - drivers/phy/meson-g12a-usb3-pcie.c | 1 - drivers/phy/meson-gxbb-usb2.c | 1 - drivers/phy/meson-gxl-usb2.c | 1 - drivers/phy/mt76x8-usb-phy.c | 1 - drivers/phy/nop-phy.c | 1 - drivers/phy/omap-usb2-phy.c| 1 - drivers/phy/phy-ab8500-usb.c | 1 - drivers/phy/phy-apple-atc.c| 1 - drivers/phy/phy-bcm-sr-pcie.c | 1 - drivers/phy/phy-core-mipi-dphy.c | 2 +- drivers/phy/phy-da8xx-usb.c| 2 +- drivers/phy/phy-imx8mq-usb.c | 1 - drivers/phy/phy-mtk-tphy.c | 1 - drivers/phy/phy-npcm-usb.c | 1 - drivers/phy/phy-rcar-gen2.c| 1 - drivers/phy/phy-rcar-gen3.c| 1 - drivers/phy/phy-stm32-usbphyc.c| 1 - drivers/phy/phy-ti-am654.c | 1 - drivers/phy/phy-uclass.c | 1 - drivers/phy/phy-zynqmp.c | 1 - drivers/phy/qcom/msm8916-usbh-phy.c| 1 - drivers/phy/qcom/phy-qcom-ipq4019-usb.c| 1 - drivers/phy/qcom/phy-qcom-usb-hs-28nm.c| 1 - drivers/phy/qcom/phy-qcom-usb-ss.c | 1 - drivers/phy/renesas/r8a779f0-ether-serdes.c| 1 - drivers/phy/rockchip/phy-rockchip-naneng-combphy.c | 1 - drivers/phy/rockchip/phy-rockchip-pcie.c | 1 - drivers/phy/rockchip/phy-rockchip-snps-pcie3.c | 1 - drivers/phy/rockchip/phy-rockchip-typec.c | 1 - drivers/phy/rockchip/phy-rockchip-usbdp.c | 1 - drivers/phy/sandbox-phy.c | 1 - drivers/phy/socionext/phy-uniphier-pcie.c | 1 - drivers/phy/socionext/phy-uniphier-usb3.c | 1 - drivers/phy/sti_usb_phy.c | 1 - drivers/phy/ti-pipe3-phy.c | 1 - drivers/phy/ti/phy-j721e-wiz.c | 1 - 51 files changed, 3 insertions(+), 51 deletions(-) diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index 6624e9134f43..b9306c9a8279 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -10,7 +10,6 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include #include #include #include diff --git a/drivers/phy/bcm6318-usbh-phy.c b/drivers/phy/bcm6318-usbh-phy.c index a2fa446cb1c9..d715541bd4cb 100644 --- a/drivers/phy/bcm6318-usbh-phy.c +++ b/drivers/phy/bcm6318-usbh-phy.c @@ -7,7 +7,6 @@ *Copyright 2013 Florian Fainelli */ -#include #include #include #include diff --git a/drivers/phy/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c index 857fb575ef19..ffb37b634a31 100644 --- a/drivers/phy/bcm6348-usbh-phy.c +++ b/drivers/phy/bcm6348-usbh-phy.c @@ -7,7 +7,6 @@ *Copyright 2013
Re: [PATCH 33/81] gpio: Remove and add needed includes
On 02.05.24 03:30, Tom Rini wrote: Remove from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini Tested-by: Stefan Bosch Looks ok, tested on FriendlyElec-Board NanoPC-T2 (s5p4418_nanopi2_defconfig). Thanks a lot! --- Cc: Tom Rini Cc: Matthias Brugger Cc: Peter Robinson Cc: Alex Nemirovsky Cc: Ryan Chen Cc: Chia-Wei Wang Cc: Aspeed BMC SW team Cc: Joel Stanley Cc: Nobuhiro Iwamatsu Cc: Marek Vasut Cc: Kunihiko Hayashi Cc: Dai Okamura Cc: Michal Simek Cc: Eugeniy Paltsev Cc: Gregory CLEMENT Cc: Lars Povlsen Cc: Horatiu Vultur Cc: Caleb Connolly Cc: Neil Armstrong Cc: Sumit Garg Cc: Stefan Roese Cc: Stephan Gerhold Cc: Linus Walleij Cc: Stefan Bosch Cc: Simon Glass Cc: Philipp Tomsich Cc: Kever Yang Cc: Michael Walle Cc: Patrick Delaunay Cc: Patrice Chotard Cc: Thierry Reding Cc: Svyatoslav Ryhel Cc: Sean Anderson Cc: Andre Przywara Cc: Qu Wenruo Cc: Ilias Apalodimas Cc: Heiko Schocher Cc: Peng Fan Cc: Bin Meng Cc: Piotr Wojtaszczyk Cc: Jim Liu Cc: Nishanth Menon Cc: Samuel Holland Cc: Sam Edwards --- drivers/gpio/74x164_gpio.c | 1 - drivers/gpio/altera_pio.c | 1 - drivers/gpio/at91_gpio.c| 1 - drivers/gpio/atmel_pio4.c | 1 - drivers/gpio/axp_gpio.c | 1 - drivers/gpio/bcm2835_gpio.c | 1 - drivers/gpio/bcm6345_gpio.c | 1 - drivers/gpio/cortina_gpio.c | 1 - drivers/gpio/da8xx_gpio.c | 1 - drivers/gpio/ftgpio010.c| 1 - drivers/gpio/gpio-aspeed.c | 1 - drivers/gpio/gpio-fxl6408.c | 1 - drivers/gpio/gpio-rcar.c| 1 - drivers/gpio/gpio-rza1.c| 1 - drivers/gpio/gpio-uclass.c | 1 - drivers/gpio/gpio-uniphier.c| 1 - drivers/gpio/gpio_slg7xl45106.c | 1 - drivers/gpio/hi6220_gpio.c | 1 - drivers/gpio/hsdk-creg-gpio.c | 1 - drivers/gpio/imx_rgpio2p.c | 1 - drivers/gpio/intel_broadwell_gpio.c | 1 - drivers/gpio/intel_gpio.c | 1 - drivers/gpio/intel_ich6_gpio.c | 1 - drivers/gpio/iproc_gpio.c | 1 - drivers/gpio/kw_gpio.c | 1 - drivers/gpio/lpc32xx_gpio.c | 1 - drivers/gpio/max7320_gpio.c | 1 - drivers/gpio/mcp230xx_gpio.c| 1 - drivers/gpio/mpc83xx_spisel_boot.c | 1 - drivers/gpio/mpc8xx_gpio.c | 1 - drivers/gpio/mpc8xxx_gpio.c | 1 - drivers/gpio/mscc_sgpio.c | 1 - drivers/gpio/msm_gpio.c | 1 - drivers/gpio/mt7621_gpio.c | 1 - drivers/gpio/mvebu_gpio.c | 1 - drivers/gpio/mxc_gpio.c | 1 - drivers/gpio/mxs_gpio.c | 1 - drivers/gpio/nmk_gpio.c | 1 - drivers/gpio/npcm_gpio.c| 1 - drivers/gpio/nx_gpio.c | 1 - drivers/gpio/omap_gpio.c| 1 - drivers/gpio/pca953x.c | 3 ++- drivers/gpio/pca953x_gpio.c | 1 - drivers/gpio/pcf8575_gpio.c | 1 - drivers/gpio/pic32_gpio.c | 1 - drivers/gpio/qcom_pmic_gpio.c | 1 - drivers/gpio/qe_gpio.c | 1 - drivers/gpio/rk_gpio.c | 1 - drivers/gpio/s5p_gpio.c | 1 - drivers/gpio/sandbox.c | 1 - drivers/gpio/sandbox_test.c | 1 - drivers/gpio/sh_pfc.c | 1 - drivers/gpio/sifive-gpio.c | 1 - drivers/gpio/sl28cpld-gpio.c| 1 - drivers/gpio/stm32_gpio.c | 1 - drivers/gpio/sunxi_gpio.c | 1 - drivers/gpio/tca642x.c | 2 +- drivers/gpio/tegra186_gpio.c| 1 - drivers/gpio/tegra_gpio.c | 1 - drivers/gpio/vybrid_gpio.c | 1 - drivers/gpio/xilinx_gpio.c | 1 - drivers/gpio/zynq_gpio.c| 1 - drivers/gpio/zynqmp_gpio_modepin.c | 1 - 63 files changed, 3 insertions(+), 63 deletions(-) diff --git a/drivers/gpio/74x164_gpio.c b/drivers/gpio/74x164_gpio.c index 7a7cfe86114b..331428ccdb9a 100644 --- a/drivers/gpio/74x164_gpio.c +++ b/drivers/gpio/74x164_gpio.c @@ -8,7 +8,6 @@ * */ -#include #include #include #include diff --git a/drivers/gpio/altera_pio.c b/drivers/gpio/altera_pio.c index edc5a8093b0c..7ba1595e4ae3 100644 --- a/drivers/gpio/altera_pio.c +++ b/drivers/gpio/altera_pio.c @@ -4,7 +4,6 @@ * Copyright (C) 2011 Missing Link Electronics * Joachim Foerster */ -#include #include #include #include diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index f80f4afd24ff..50a698159075 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -8,7 +8,6 @@ */ #include -#include #include #include #include diff --git a/drivers/gpio/atmel_pio4.c b/drivers/gpio/atmel_pio4.c index be1dd752bf76..65d064b46dfb 100644 --- a/drivers/gpio/atmel_pio4.c +++ b/drivers/gpio/atmel_pio4.c @@ -5,7 +5,6 @@ * Copyright (C
Re: [PATCH 19/81] clk: Remove and add needed includes
On 02.05.24 03:30, Tom Rini wrote: Remove from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini Tested-by: Stefan Bosch Looks ok, tested on FriendlyElec-Board NanoPC-T2 (s5p4418_nanopi2_defconfig). Thanks a lot! --- Cc: Lukasz Majewski Cc: Sean Anderson Cc: Tom Rini Cc: Ryan Chen Cc: Chia-Wei Wang Cc: Aspeed BMC SW team Cc: Joel Stanley Cc: Eugeniy Paltsev Cc: Simon Glass Cc: Michal Simek Cc: Liviu Dudau Cc: Ryder Lee Cc: Weijie Gao Cc: Chunfeng Yun Cc: GSS_MTK_Uboot_upstream Cc: Neil Armstrong Cc: Mario Six Cc: Stefan Roese Cc: Manivannan Sadhasivam Cc: Caleb Connolly Cc: Sumit Garg Cc: Philipp Tomsich Cc: Kever Yang Cc: Patrick Delaunay Cc: Patrice Chotard Cc: Jagan Teki Cc: Andre Przywara Cc: Thierry Reding Cc: Svyatoslav Ryhel Cc: Kunihiko Hayashi Cc: Dai Okamura Cc: Eugen Hristev Cc: Igor Prusov Cc: Stefan Bosch Cc: Francois Berder Cc: Johan Jonker Cc: Minkyu Kang Cc: Chanho Park Cc: Sam Protsenko Cc: Konrad Dybcio Cc: Volodymyr Babchuk Cc: Torsten Duwe Cc: Hal Feng Cc: Leo Yu-Chi Liang Cc: Xingyu Wu Cc: Hoegeun Kwon Cc: Vishal Mahaveer Cc: Nishanth Menon Cc: Bryan Brattlof Cc: Hari Nagalla Cc: Apurva Nandan Cc: Neha Malcom Francis Cc: Udit Kumar --- drivers/clk/altera/clk-agilex.c | 1 - drivers/clk/altera/clk-arria10.c | 1 - drivers/clk/altera/clk-mem-n5x.c | 1 - drivers/clk/altera/clk-n5x.c | 1 - drivers/clk/aspeed/clk_ast2500.c | 1 - drivers/clk/aspeed/clk_ast2600.c | 1 - drivers/clk/at91/clk-generic.c | 1 - drivers/clk/at91/clk-main.c | 1 - drivers/clk/at91/clk-master.c| 1 - drivers/clk/at91/clk-peripheral.c| 1 - drivers/clk/at91/clk-programmable.c | 1 - drivers/clk/at91/clk-sam9x60-pll.c | 1 - drivers/clk/at91/clk-system.c| 1 - drivers/clk/at91/clk-utmi.c | 1 - drivers/clk/at91/compat.c| 2 +- drivers/clk/at91/pmc.c | 1 - drivers/clk/at91/sam9x60.c | 1 - drivers/clk/at91/sama7g5.c | 1 - drivers/clk/at91/sckc.c | 1 - drivers/clk/clk-cdce9xx.c| 1 - drivers/clk/clk-composite.c | 1 - drivers/clk/clk-divider.c| 1 - drivers/clk/clk-fixed-factor.c | 1 - drivers/clk/clk-gate.c | 1 - drivers/clk/clk-hsdk-cgu.c | 1 - drivers/clk/clk-mux.c| 1 - drivers/clk/clk-uclass.c | 1 - drivers/clk/clk-xlnx-clock-wizard.c | 1 - drivers/clk/clk.c| 1 - drivers/clk/clk_bcm6345.c| 1 - drivers/clk/clk_boston.c | 1 - drivers/clk/clk_fixed_factor.c | 1 - drivers/clk/clk_fixed_rate.c | 1 - drivers/clk/clk_k210.c | 1 - drivers/clk/clk_pic32.c | 1 - drivers/clk/clk_sandbox.c| 1 - drivers/clk/clk_sandbox_ccf.c| 1 - drivers/clk/clk_sandbox_test.c | 1 - drivers/clk/clk_scmi.c | 1 - drivers/clk/clk_versaclock.c | 1 - drivers/clk/clk_versal.c | 1 - drivers/clk/clk_vexpress_osc.c | 1 - drivers/clk/clk_zynq.c | 1 - drivers/clk/clk_zynqmp.c | 1 - drivers/clk/exynos/clk-exynos7420.c | 1 - drivers/clk/ics8n3qv01.c | 1 - drivers/clk/imx/clk-composite-8m.c | 1 - drivers/clk/imx/clk-composite-93.c | 1 - drivers/clk/imx/clk-fracn-gppll.c| 1 - drivers/clk/imx/clk-gate-93.c| 1 - drivers/clk/imx/clk-gate2.c | 1 - drivers/clk/imx/clk-imx6q.c | 1 - drivers/clk/imx/clk-imx8.c | 1 - drivers/clk/imx/clk-imx8mm.c | 1 - drivers/clk/imx/clk-imx8mn.c | 1 - drivers/clk/imx/clk-imx8mp.c | 1 - drivers/clk/imx/clk-imx8mq.c | 1 - drivers/clk/imx/clk-imx8qm.c | 1 - drivers/clk/imx/clk-imx8qxp.c| 1 - drivers/clk/imx/clk-imx93.c | 1 - drivers/clk/imx/clk-imxrt1020.c | 1 - drivers/clk/imx/clk-imxrt1050.c | 1 - drivers/clk/imx/clk-imxrt1170.c | 1 - drivers/clk/imx/clk-pfd.c| 1 - drivers/clk/imx/clk-pll14xx.c| 1 - drivers/clk/imx/clk-pllv3.c | 1 - drivers/clk/intel/clk_intel.c| 1 - drivers/clk/mediatek/clk-mt7622.c| 1 - drivers/clk/mediatek/clk-mt7623.c| 1 - drivers/clk/mediatek/clk-mt7629.c| 1 - drivers/clk/mediatek/clk-mt8183.c| 1 - drivers/clk/mediatek/clk-mt8512.c| 1 - drivers/clk/mediatek/clk-mt8516.c| 1 - drivers/clk/mediatek/clk-mt8518.c| 1 - drivers/clk/mediatek/clk-mtk.c | 1 - drivers/clk/meson/a1.c
Re: [PATCH 74/81] video: Remove and add needed includes
On 02.05.24 03:31, Tom Rini wrote: Remove from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini Tested-by: Stefan Bosch Looks ok, tested on FriendlyElec-Board NanoPC-T2 (s5p4418_nanopi2_defconfig). Thanks a lot! --- Cc: Anatolij Gustschin Cc: Tom Rini Cc: Matthias Brugger Cc: Peter Robinson Cc: Liviu Dudau Cc: Stephan Gerhold Cc: Linus Walleij Cc: Neil Armstrong Cc: Stefan Bosch Cc: Simon Glass Cc: Philipp Tomsich Cc: Kever Yang Cc: Michal Simek Cc: Patrick Delaunay Cc: Patrice Chotard Cc: Jagan Teki Cc: Andre Przywara Cc: Thierry Reding Cc: Svyatoslav Ryhel Cc: Johan Jonker --- drivers/video/anx9804.c | 1 - drivers/video/atmel_hlcdfb.c| 1 - drivers/video/atmel_lcdfb.c | 1 - drivers/video/backlight-uclass.c| 1 - drivers/video/backlight_gpio.c | 1 - drivers/video/bcm2835.c | 1 - drivers/video/bmp.c | 1 - drivers/video/bochs.c | 1 - drivers/video/bridge/anx6345.c | 1 - drivers/video/bridge/ps862x.c | 1 - drivers/video/bridge/ptn3460.c | 1 - drivers/video/bridge/ssd2825.c | 1 - drivers/video/bridge/video-bridge-uclass.c | 1 - drivers/video/broadwell_igd.c | 2 +- drivers/video/console_normal.c | 1 - drivers/video/console_rotate.c | 1 - drivers/video/console_truetype.c| 1 - drivers/video/coreboot.c| 1 - drivers/video/display-uclass.c | 1 - drivers/video/dsi-host-uclass.c | 1 - drivers/video/dw_hdmi.c | 3 ++- drivers/video/dw_mipi_dsi.c | 1 - drivers/video/efi.c | 1 - drivers/video/endeavoru-panel.c | 1 - drivers/video/exynos/exynos_dp.c| 1 - drivers/video/exynos/exynos_dp_lowlevel.c | 1 - drivers/video/exynos/exynos_fb.c| 1 - drivers/video/exynos/exynos_mipi_dsi.c | 1 - drivers/video/exynos/exynos_mipi_dsi_common.c | 1 - drivers/video/exynos/exynos_mipi_dsi_lowlevel.c | 1 - drivers/video/himax-hx8394.c| 1 - drivers/video/hitachi_tx18d42vm_lcd.c | 1 - drivers/video/hx8238d.c | 1 - drivers/video/ihs_video_out.c | 1 - drivers/video/imx/ipu_common.c | 2 +- drivers/video/imx/ipu_disp.c| 1 - drivers/video/imx/mxc_ipuv3_fb.c| 1 - drivers/video/ivybridge_igd.c | 1 - drivers/video/lm3533_backlight.c| 1 - drivers/video/logicore_dp_tx.c | 1 - drivers/video/mali_dp.c | 1 - drivers/video/mcde_simple.c | 1 - drivers/video/meson/meson_canvas.c | 1 - drivers/video/meson/meson_dw_hdmi.c | 1 - drivers/video/meson/meson_plane.c | 1 - drivers/video/meson/meson_vclk.c| 1 - drivers/video/meson/meson_venc.c| 1 - drivers/video/meson/meson_vpu.c | 1 - drivers/video/meson/meson_vpu_init.c| 1 - drivers/video/mipi_dsi.c| 1 - drivers/video/mvebu_lcd.c | 1 - drivers/video/mxsfb.c | 1 - drivers/video/nexell/s5pxx18_dp.c | 1 - drivers/video/nexell/s5pxx18_dp_hdmi.c | 1 - drivers/video/nexell/s5pxx18_dp_lvds.c | 2 +- drivers/video/nexell/s5pxx18_dp_mipi.c | 1 - drivers/video/nexell/s5pxx18_dp_rgb.c | 2 +- drivers/video/nexell/soc/s5pxx18_soc_disptop.h | 1 + drivers/video/nexell_display.c | 1 - drivers/video/omap3_dss.c | 1 - drivers/video/orisetech_otm8009a.c | 1 - drivers/video/panel-uclass.c| 1 - drivers/video/pwm_backlight.c | 1 - drivers/video/raydium-rm68200.c | 1 - drivers/video/renesas-r61307.c | 1 - drivers/video/renesas-r69328.c | 1 - drivers/video/rockchip/dw_mipi_dsi_rockchip.c | 1 - drivers/video/rockchip/rk3288_hdmi.c| 1 - drivers/video/rockchip/rk3288_mipi.c| 1 - drivers/video/rockchip/rk3288_vop.c | 1 - drivers/video/rockchip/rk3399_hdmi.c| 1 - drivers/video/rockchip/rk3399_mipi.c| 1 - drivers/video/rockchip/rk3399_vop.c | 1 - drivers/video/rockchip/rk_edp.c | 1 - drivers/video/rockchip/rk_hdmi.c| 1 - drivers/video/rockchip/rk_lvds.c| 1 - drivers/video/rockchip/rk_mipi.c| 1 - drivers
Re: [PATCH 53/81] pwm: Remove and add needed includes
On 02.05.24 03:31, Tom Rini wrote: Remove from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini Tested-by: Stefan Bosch Looks ok, tested on FriendlyElec-Board NanoPC-T2 (s5p4418_nanopi2_defconfig). Thanks a lot! --- Cc: Tom Rini Cc: Ryan Chen Cc: Chia-Wei Wang Cc: Aspeed BMC SW team Cc: Joel Stanley Cc: Michal Simek Cc: Neil Armstrong Cc: Simon Glass Cc: Thierry Reding Cc: Svyatoslav Ryhel Cc: Patrice Chotard Cc: Stefan Bosch Cc: Eugen Hristev Cc: Caleb Connolly Cc: Igor Prusov Cc: Weijie Gao Cc: Johan Jonker --- drivers/pwm/cros_ec_pwm.c | 1 - drivers/pwm/exynos_pwm.c | 1 - drivers/pwm/pwm-aspeed.c | 1 - drivers/pwm/pwm-at91.c| 1 - drivers/pwm/pwm-cadence-ttc.c | 1 - drivers/pwm/pwm-imx.c | 1 - drivers/pwm/pwm-meson.c | 1 - drivers/pwm/pwm-mtk.c | 1 - drivers/pwm/pwm-sifive.c | 1 - drivers/pwm/pwm-ti-ehrpwm.c | 1 - drivers/pwm/pwm-uclass.c | 1 - drivers/pwm/rk_pwm.c | 1 - drivers/pwm/sandbox_pwm.c | 1 - drivers/pwm/sunxi_pwm.c | 1 - drivers/pwm/tegra_pwm.c | 1 - 15 files changed, 15 deletions(-) diff --git a/drivers/pwm/cros_ec_pwm.c b/drivers/pwm/cros_ec_pwm.c index 4a39c319aa2a..b89f00f151b0 100644 --- a/drivers/pwm/cros_ec_pwm.c +++ b/drivers/pwm/cros_ec_pwm.c @@ -1,6 +1,5 @@ // SPDX-License-Identifier: GPL-2.0+ -#include #include #include #include diff --git a/drivers/pwm/exynos_pwm.c b/drivers/pwm/exynos_pwm.c index 609025d680d2..5ded60978f47 100644 --- a/drivers/pwm/exynos_pwm.c +++ b/drivers/pwm/exynos_pwm.c @@ -3,7 +3,6 @@ * Copyright 2016 Google Inc. */ -#include #include #include #include diff --git a/drivers/pwm/pwm-aspeed.c b/drivers/pwm/pwm-aspeed.c index b03472d2345c..ebc9d9a89752 100644 --- a/drivers/pwm/pwm-aspeed.c +++ b/drivers/pwm/pwm-aspeed.c @@ -38,7 +38,6 @@ * This improvement can disable/enable through PWM_ASPEED_CTRL_DUTY_SYNC_DISABLE. */ -#include #include #include #include diff --git a/drivers/pwm/pwm-at91.c b/drivers/pwm/pwm-at91.c index 3ff1fb6d5c30..ffc37180eb42 100644 --- a/drivers/pwm/pwm-at91.c +++ b/drivers/pwm/pwm-at91.c @@ -9,7 +9,6 @@ * Based on drivers/pwm/pwm-atmel.c from Linux. */ #include -#include #include #include #include diff --git a/drivers/pwm/pwm-cadence-ttc.c b/drivers/pwm/pwm-cadence-ttc.c index d9f6736a7aee..767628833bc0 100644 --- a/drivers/pwm/pwm-cadence-ttc.c +++ b/drivers/pwm/pwm-cadence-ttc.c @@ -6,7 +6,6 @@ #define LOG_CATEGORY UCLASS_PWM #include -#include #include #include #include diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c index 8fbb40cc2767..320ea7c4239a 100644 --- a/drivers/pwm/pwm-imx.c +++ b/drivers/pwm/pwm-imx.c @@ -6,7 +6,6 @@ * Basic support for the pwm module on imx6. */ -#include #include #include #include diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 60959720dac8..c2597d8b6698 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -16,7 +16,6 @@ * current period to complete first). */ -#include #include #include #include diff --git a/drivers/pwm/pwm-mtk.c b/drivers/pwm/pwm-mtk.c index ad845ed9662e..9776a41ff48e 100644 --- a/drivers/pwm/pwm-mtk.c +++ b/drivers/pwm/pwm-mtk.c @@ -5,7 +5,6 @@ * Author: Sam Shih */ -#include #include #include #include diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c index b9813a3b6bbe..e9777c71f5e0 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -12,7 +12,6 @@ * - The hardware generates only inverted output. */ -#include #include #include #include diff --git a/drivers/pwm/pwm-ti-ehrpwm.c b/drivers/pwm/pwm-ti-ehrpwm.c index fefa3c65ec45..563109ef0f80 100644 --- a/drivers/pwm/pwm-ti-ehrpwm.c +++ b/drivers/pwm/pwm-ti-ehrpwm.c @@ -7,7 +7,6 @@ * Based on Linux kernel drivers/pwm/pwm-tiehrpwm.c */ -#include #include #include #include diff --git a/drivers/pwm/pwm-uclass.c b/drivers/pwm/pwm-uclass.c index 648d0757ba62..6543db1d623d 100644 --- a/drivers/pwm/pwm-uclass.c +++ b/drivers/pwm/pwm-uclass.c @@ -6,7 +6,6 @@ #define LOG_CATEGORY UCLASS_PWM -#include #include #include diff --git a/drivers/pwm/rk_pwm.c b/drivers/pwm/rk_pwm.c index 1858d5973386..0a64eb01dc2b 100644 --- a/drivers/pwm/rk_pwm.c +++ b/drivers/pwm/rk_pwm.c @@ -4,7 +4,6 @@ * Written by Simon Glass */ -#include #include #include #include diff --git a/drivers/pwm/sandbox_pwm.c b/drivers/pwm/sandbox_pwm.c index 4df15f0a2e8f..0d798609ddaf 100644 --- a/drivers/pwm/sandbox_pwm.c +++ b/drivers/pwm/sandbox_pwm.c @@ -4,7 +4,6 @@ * Written by Simon Glass */ -#include #include #include #include diff --git a/drivers/pwm/sunxi_pwm.c b/drivers/pwm/sunxi_pwm.c index bb1bec05ec34..2140a05b6796 100644 --- a/drivers/pwm
Re: [PATCH 35/81] i2c: Remove and add needed includes
On 02.05.24 03:30, Tom Rini wrote: Remove from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini Tested-by: Stefan Bosch Looks ok, tested on FriendlyElec-Board NanoPC-T2 (s5p4418_nanopi2_defconfig). Thanks a lot! --- Cc: Heiko Schocher Cc: Tom Rini Cc: Ryan Chen Cc: Aspeed BMC SW team Cc: Chia-Wei Wang Cc: Joel Stanley Cc: Michal Simek Cc: Alex Nemirovsky Cc: Liviu Dudau Cc: Neil Armstrong Cc: Stefan Roese Cc: Stefan Bosch Cc: Nobuhiro Iwamatsu Cc: Marek Vasut Cc: Simon Glass Cc: Patrick Delaunay Cc: Patrice Chotard Cc: Thierry Reding Cc: Svyatoslav Ryhel --- drivers/i2c/acpi_i2c.c | 1 - drivers/i2c/ast2600_i2c.c | 1 - drivers/i2c/ast_i2c.c | 1 - drivers/i2c/at91_i2c.c | 1 - drivers/i2c/cros_ec_ldo.c | 1 - drivers/i2c/cros_ec_tunnel.c | 1 - drivers/i2c/davinci_i2c.c | 2 +- drivers/i2c/designware_i2c.c | 1 - drivers/i2c/designware_i2c_pci.c | 1 - drivers/i2c/exynos_hs_i2c.c| 1 - drivers/i2c/fsl_i2c.c | 2 +- drivers/i2c/i2c-cdns.c | 1 - drivers/i2c/i2c-cortina.c | 2 +- drivers/i2c/i2c-emul-uclass.c | 1 - drivers/i2c/i2c-gpio.c | 1 - drivers/i2c/i2c-microchip.c| 1 - drivers/i2c/i2c-uclass.c | 1 - drivers/i2c/i2c-versatile.c| 1 - drivers/i2c/i2c_core.c | 2 +- drivers/i2c/ihs_i2c.c | 1 - drivers/i2c/imx_lpi2c.c| 1 - drivers/i2c/intel_i2c.c| 2 +- drivers/i2c/iproc_i2c.c| 1 - drivers/i2c/lpc32xx_i2c.c | 2 +- drivers/i2c/meson_i2c.c| 1 - drivers/i2c/muxes/i2c-arb-gpio-challenge.c | 2 +- drivers/i2c/muxes/i2c-mux-gpio.c | 1 - drivers/i2c/muxes/i2c-mux-uclass.c | 1 - drivers/i2c/muxes/pca954x.c| 1 - drivers/i2c/mv_i2c.c | 1 - drivers/i2c/mvtwsi.c | 2 +- drivers/i2c/mxc_i2c.c | 2 +- drivers/i2c/nx_i2c.c | 2 +- drivers/i2c/ocores_i2c.c | 1 - drivers/i2c/omap24xx_i2c.c | 1 - drivers/i2c/qup_i2c.c | 1 - drivers/i2c/rcar_i2c.c | 1 - drivers/i2c/rcar_iic.c | 1 - drivers/i2c/rk_i2c.c | 1 - drivers/i2c/s3c24x0_i2c.c | 2 +- drivers/i2c/sandbox_i2c.c | 1 - drivers/i2c/sh_i2c.c | 1 - drivers/i2c/soft_i2c.c | 2 +- drivers/i2c/stm32f7_i2c.c | 1 - drivers/i2c/sun6i_p2wi.c | 1 - drivers/i2c/sun8i_rsb.c| 1 - drivers/i2c/tegra186_bpmp_i2c.c| 1 - drivers/i2c/tegra_i2c.c| 1 - drivers/i2c/xilinx_xiic.c | 1 - 49 files changed, 12 insertions(+), 49 deletions(-) diff --git a/drivers/i2c/acpi_i2c.c b/drivers/i2c/acpi_i2c.c index 142f41178c10..82cb5db5cc8b 100644 --- a/drivers/i2c/acpi_i2c.c +++ b/drivers/i2c/acpi_i2c.c @@ -3,7 +3,6 @@ * Copyright 2019 Google LLC */ -#include #include #include #include diff --git a/drivers/i2c/ast2600_i2c.c b/drivers/i2c/ast2600_i2c.c index e566b01feacf..9d1d70670b95 100644 --- a/drivers/i2c/ast2600_i2c.c +++ b/drivers/i2c/ast2600_i2c.c @@ -2,7 +2,6 @@ /* * Copyright ASPEED Technology Inc. */ -#include #include #include #include diff --git a/drivers/i2c/ast_i2c.c b/drivers/i2c/ast_i2c.c index 1c1d5566dad4..02ee406bbd7d 100644 --- a/drivers/i2c/ast_i2c.c +++ b/drivers/i2c/ast_i2c.c @@ -5,7 +5,6 @@ * Copyright 2017 Google, Inc. */ -#include #include #include #include diff --git a/drivers/i2c/at91_i2c.c b/drivers/i2c/at91_i2c.c index b7a25885e666..cfae36c74d19 100644 --- a/drivers/i2c/at91_i2c.c +++ b/drivers/i2c/at91_i2c.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/i2c/cros_ec_ldo.c b/drivers/i2c/cros_ec_ldo.c index c593540ac138..dfe823c142c5 100644 --- a/drivers/i2c/cros_ec_ldo.c +++ b/drivers/i2c/cros_ec_ldo.c @@ -4,7 +4,6 @@ * Written by Simon Glass */ -#include #include #include #include diff --git a/drivers/i2c/cros_ec_tunnel.c b/drivers/i2c/cros_ec_tunnel.c index 75828b6e7c27..2d610e0a2aa9 100644 --- a/drivers/i2c/cros_ec_tunnel.c +++ b/drivers/i2c/cros_ec_tunnel.c @@ -4,7 +4,6 @@ * Written by Simon Glass */ -#include #include #include #include diff --git a/drivers/i2c/davinci_i2c.c b/drivers/i2c/davinci_i2c.c index 25ef937dc0b3..391327472087 100644 --- a/drivers/i2c/davinci_i2c.c +++ b/drivers/i2c
Re: [PATCH 04/81] arm: nexell: Add missing
On 02.05.24 03:30, Tom Rini wrote: This file has many "Linux" style types in it, add Signed-off-by: Tom Rini Reviewed-by: Stefan Bosch Thanks for your awesome work! --- Cc: Stefan Bosch --- arch/arm/mach-nexell/include/mach/mipi_display.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-nexell/include/mach/mipi_display.h b/arch/arm/mach-nexell/include/mach/mipi_display.h index f3fdec64647c..9183ffdd9c3d 100644 --- a/arch/arm/mach-nexell/include/mach/mipi_display.h +++ b/arch/arm/mach-nexell/include/mach/mipi_display.h @@ -11,6 +11,8 @@ #ifndef MIPI_DISPLAY_H #define MIPI_DISPLAY_H +#include + /* MIPI DSI Processor-to-Peripheral transaction types */ enum { MIPI_DSI_V_SYNC_START = 0x01,
Re: [PATCH 062/149] board: friendlyarm: Remove and add needed includes
On 01.05.24 04:41, Tom Rini wrote: Remove from this board vendor directory and when needed add missing include files directly. Signed-off-by: Tom Rini Reviewed-by: Stefan Bosch Tested-by: Stefan Bosch Looks good, tested on FriendlyElec-Board NanoPC-T2. Thanks a lot! --- Cc: Stefan Bosch Cc: Caleb Connolly Cc: Eugen Hristev Cc: Igor Prusov Cc: Patrice Chotard --- board/friendlyarm/nanopi2/board.c | 1 - board/friendlyarm/nanopi2/hwrev.c | 1 - board/friendlyarm/nanopi2/lcds.c| 1 - board/friendlyarm/nanopi2/onewire.c | 1 - 4 files changed, 4 deletions(-) diff --git a/board/friendlyarm/nanopi2/board.c b/board/friendlyarm/nanopi2/board.c index 393c5a447d6f..c8cbc5a15fa8 100644 --- a/board/friendlyarm/nanopi2/board.c +++ b/board/friendlyarm/nanopi2/board.c @@ -5,7 +5,6 @@ */ #include -#include #include #include #include diff --git a/board/friendlyarm/nanopi2/hwrev.c b/board/friendlyarm/nanopi2/hwrev.c index 585e08c944f9..cd9c2414a320 100644 --- a/board/friendlyarm/nanopi2/hwrev.c +++ b/board/friendlyarm/nanopi2/hwrev.c @@ -5,7 +5,6 @@ */ #include -#include #include #include diff --git a/board/friendlyarm/nanopi2/lcds.c b/board/friendlyarm/nanopi2/lcds.c index 7303e53af925..b37367300cf0 100644 --- a/board/friendlyarm/nanopi2/lcds.c +++ b/board/friendlyarm/nanopi2/lcds.c @@ -4,7 +4,6 @@ */ #include -#include #include #include #include diff --git a/board/friendlyarm/nanopi2/onewire.c b/board/friendlyarm/nanopi2/onewire.c index 4f0b1e33c2df..31cc871330ca 100644 --- a/board/friendlyarm/nanopi2/onewire.c +++ b/board/friendlyarm/nanopi2/onewire.c @@ -5,7 +5,6 @@ */ #include -#include #include #include #include
Re: [PATCH 17/33] arm: nexell: Remove and add needed includes
On 30.04.24 15:35, Tom Rini wrote: Remove from all mach-nexell files and when needed add missing include files directly. Signed-off-by: Tom Rini Reviewed-by: Stefan Bosch Tested-by: Stefan Bosch Looks good, tested on FriendlyElec-Board NanoPC-T2. Thanks a lot! --- Cc: Stefan Bosch --- arch/arm/mach-nexell/clock.c | 2 +- arch/arm/mach-nexell/include/mach/reset.h | 2 ++ arch/arm/mach-nexell/reset.c | 1 - arch/arm/mach-nexell/tieoff.c | 1 - arch/arm/mach-nexell/timer.c | 1 - 5 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-nexell/clock.c b/arch/arm/mach-nexell/clock.c index 59ffa26255f5..3082f6077b73 100644 --- a/arch/arm/mach-nexell/clock.c +++ b/arch/arm/mach-nexell/clock.c @@ -4,8 +4,8 @@ * Hyunseok, Jung */ -#include #include +#include #include #include #include diff --git a/arch/arm/mach-nexell/include/mach/reset.h b/arch/arm/mach-nexell/include/mach/reset.h index e1301d4e53d3..0c6a13043f91 100644 --- a/arch/arm/mach-nexell/include/mach/reset.h +++ b/arch/arm/mach-nexell/include/mach/reset.h @@ -7,6 +7,8 @@ #ifndef __NEXELL_RESET__ #define __NEXELL_RESET__ +#include + #define NUMBER_OF_RESET_MODULE_PIN 69 enum rstcon { diff --git a/arch/arm/mach-nexell/reset.c b/arch/arm/mach-nexell/reset.c index 1f732a3d3732..627f568270b6 100644 --- a/arch/arm/mach-nexell/reset.c +++ b/arch/arm/mach-nexell/reset.c @@ -8,7 +8,6 @@ *FIXME : Not support device tree & reset control driver. *will remove after support device tree & reset control driver. */ -#include #include #include #include diff --git a/arch/arm/mach-nexell/tieoff.c b/arch/arm/mach-nexell/tieoff.c index 5a4744c296a2..51cca6744d6f 100644 --- a/arch/arm/mach-nexell/tieoff.c +++ b/arch/arm/mach-nexell/tieoff.c @@ -4,7 +4,6 @@ * Youngbok, Park */ -#include #include #include #include diff --git a/arch/arm/mach-nexell/timer.c b/arch/arm/mach-nexell/timer.c index 3b311fd22a56..b35c7b1bb33a 100644 --- a/arch/arm/mach-nexell/timer.c +++ b/arch/arm/mach-nexell/timer.c @@ -4,7 +4,6 @@ * Hyunseok, Jung */ -#include #include #include
Re: [PATCH u-boot-mvebu 10/10] arm: mvebu: turris_omnia: Support old DDR3 training, selectable via env var
Hi Marek, On 4/15/24 18:30, Marek Behún wrote: Support old DDR3 training code on Turris Omnia, selectable by U-Boot enviroment variable. Users experiencing DDR3 initialization failures or random crashes of the operating system due to incorrect DDR3 configuration can select the old DDR3 training implementation to fix those issues by setting the environment variable env set omnia_ddr3_training old env save Signed-off-by: Marek Behún --- arch/arm/mach-mvebu/Kconfig | 1 + board/CZ.NIC/turris_omnia/Makefile| 1 + board/CZ.NIC/turris_omnia/old_ddr3_training.c | 79 +++ board/CZ.NIC/turris_omnia/turris_omnia.c | 2 +- 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 board/CZ.NIC/turris_omnia/old_ddr3_training.c For turris_omnia_defconfig, this is dropped when compiled: drivers/ddr/marvell/a38x/old/ddr3_debug.c:776:12: warning: 'ddr3_tip_access_atr' declared 'static' but never defined [-Wunused-function] 776 | static int ddr3_tip_access_atr(u32 dev_num, u32 flag_id, u32 value, u32 **ptr); |^~~ Please take a look. Thanks, Stefan diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index e377e8a48a..4a8328760e 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -149,6 +149,7 @@ config TARGET_TURRIS_OMNIA select SPL_SYS_MALLOC_SIMPLE select SYS_I2C_MVTWSI select ATSHA204A + select ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING config TARGET_TURRIS_MOX bool "Support CZ.NIC's Turris Mox / RIPE Atlas Probe" diff --git a/board/CZ.NIC/turris_omnia/Makefile b/board/CZ.NIC/turris_omnia/Makefile index 341378b4e5..28142cca7e 100644 --- a/board/CZ.NIC/turris_omnia/Makefile +++ b/board/CZ.NIC/turris_omnia/Makefile @@ -3,3 +3,4 @@ # Copyright (C) 2017 Marek Behún obj-y := turris_omnia.o ../turris_atsha_otp.o ../turris_common.o +obj-$(CONFIG_SPL_BUILD)+= old_ddr3_training.o diff --git a/board/CZ.NIC/turris_omnia/old_ddr3_training.c b/board/CZ.NIC/turris_omnia/old_ddr3_training.c new file mode 100644 index 00..f7e89c58d4 --- /dev/null +++ b/board/CZ.NIC/turris_omnia/old_ddr3_training.c @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2024 Marek Behún + */ + +#include +#include +#include + +#include "../drivers/ddr/marvell/a38x/old/ddr3_init.h" + +static struct hws_topology_map board_topology_map_1g = { + 0x1, /* active interfaces */ + /* cs_mask, mirror, dqs_swap, ck_swap X PUPs */ + { { { {0x1, 0, 0, 0}, + {0x1, 0, 0, 0}, + {0x1, 0, 0, 0}, + {0x1, 0, 0, 0}, + {0x1, 0, 0, 0} }, + SPEED_BIN_DDR_1600K,/* speed_bin */ + BUS_WIDTH_16, /* memory_width */ + MEM_4G, /* mem_size */ + DDR_FREQ_800, /* frequency */ + 0, 0, /* cas_l cas_wl */ + HWS_TEMP_NORMAL,/* temperature */ + HWS_TIM_2T} }, /* timing (force 2t) */ + 5, /* Num Of Bus Per Interface*/ + BUS_MASK_32BIT /* Busses mask */ +}; + +static struct hws_topology_map board_topology_map_2g = { + 0x1, /* active interfaces */ + /* cs_mask, mirror, dqs_swap, ck_swap X PUPs */ + { { { {0x1, 0, 0, 0}, + {0x1, 0, 0, 0}, + {0x1, 0, 0, 0}, + {0x1, 0, 0, 0}, + {0x1, 0, 0, 0} }, + SPEED_BIN_DDR_1600K,/* speed_bin */ + BUS_WIDTH_16, /* memory_width */ + MEM_8G, /* mem_size */ + DDR_FREQ_800, /* frequency */ + 0, 0, /* cas_l cas_wl */ + HWS_TEMP_NORMAL,/* temperature */ + HWS_TIM_2T} }, /* timing (force 2t) */ + 5, /* Num Of Bus Per Interface*/ + BUS_MASK_32BIT /* Busses mask */ +}; + +/* defined in turris_omnia.c */ +extern int omnia_get_ram_size_gb(void); + +struct hws_topology_map *ddr3_get_topology_map(void) +{ + if (omnia_get_ram_size_gb() == 2) + return &board_topology_map_2g; + else + return &board_topology_map_1g; +} + +bool board_use_old_ddr3_training(void) +{ + const char *env_val = NULL; + + if (CONFIG_IS_ENABLED(ENV_SUPPORT) && !env_init()) + env_val = env_get("omnia_ddr3_training"); + + if (env_val && !strcmp(env_val, "old")) { + printf("Using old DDR3 training implementation\n"); + return true; + } + + return false; +} + +__weak u32 sys_env_get_topology_update_info(struct topology_update_info *tui) +{ +
Re: [PATCH 010/149] board: Marvell: Remove and add needed includes
On 5/1/24 04:40, Tom Rini wrote: Remove from this board vendor directory and when needed add missing include files directly. Signed-off-by: Tom Rini --- Cc: Stefan Roese Cc: Chris Packham Cc: Tony Dinh Cc: Jason Cooper Cc: Siddarth Gore Cc: Aaron Williams --- arch/arm/mach-kirkwood/include/mach/mpp.h | 2 ++ board/Marvell/db-88f6720/db-88f6720.c | 1 - board/Marvell/db-88f6820-amc/db-88f6820-amc.c | 2 +- board/Marvell/db-88f6820-gp/db-88f6820-gp.c | 2 +- board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c | 1 - board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c | 1 - board/Marvell/dreamplug/dreamplug.c | 1 - board/Marvell/guruplug/guruplug.c | 1 - board/Marvell/mvebu_alleycat-5/board.c| 2 +- board/Marvell/mvebu_armada-37xx/board.c | 2 +- board/Marvell/mvebu_armada-8k/board.c | 2 +- board/Marvell/octeontx2/soc-utils.c | 1 - board/Marvell/openrd/openrd.c | 1 - board/Marvell/sheevaplug/sheevaplug.c | 1 - 14 files changed, 7 insertions(+), 13 deletions(-) Reviewed-by: Stefan Roese Thanks, Stefan diff --git a/arch/arm/mach-kirkwood/include/mach/mpp.h b/arch/arm/mach-kirkwood/include/mach/mpp.h index 4d1f58c0cbdf..e2757942590b 100644 --- a/arch/arm/mach-kirkwood/include/mach/mpp.h +++ b/arch/arm/mach-kirkwood/include/mach/mpp.h @@ -8,6 +8,8 @@ #ifndef __KIRKWOOD_MPP_H #define __KIRKWOOD_MPP_H +#include + #define MPP(_num, _sel, _in, _out, _F6180, _F6190, _F6192, _F6281) ( \ /* MPP number */((_num) & 0xff) | \ /* MPP select value */ (((_sel) & 0xf) << 8) | \ diff --git a/board/Marvell/db-88f6720/db-88f6720.c b/board/Marvell/db-88f6720/db-88f6720.c index 26c30647fbb0..920421366f11 100644 --- a/board/Marvell/db-88f6720/db-88f6720.c +++ b/board/Marvell/db-88f6720/db-88f6720.c @@ -3,7 +3,6 @@ * Copyright (C) 2016 Stefan Roese */ -#include #include #include #include diff --git a/board/Marvell/db-88f6820-amc/db-88f6820-amc.c b/board/Marvell/db-88f6820-amc/db-88f6820-amc.c index 122c63d11f99..0f92cc385bc8 100644 --- a/board/Marvell/db-88f6820-amc/db-88f6820-amc.c +++ b/board/Marvell/db-88f6820-amc/db-88f6820-amc.c @@ -3,7 +3,7 @@ * Copyright (C) 2015 Stefan Roese */ -#include +#include #include #include #include diff --git a/board/Marvell/db-88f6820-gp/db-88f6820-gp.c b/board/Marvell/db-88f6820-gp/db-88f6820-gp.c index 1edc1cb6515c..8f8b2720107a 100644 --- a/board/Marvell/db-88f6820-gp/db-88f6820-gp.c +++ b/board/Marvell/db-88f6820-gp/db-88f6820-gp.c @@ -3,7 +3,7 @@ * Copyright (C) 2015 Stefan Roese */ -#include +#include #include #include #include diff --git a/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c b/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c index 9e1fdecfca4d..6bca1f91a0a4 100644 --- a/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c +++ b/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c @@ -3,7 +3,6 @@ * Copyright (C) 2014 Stefan Roese */ -#include #include #include #include diff --git a/board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c b/board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c index 0abdca1cd210..a7a84798a53b 100644 --- a/board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c +++ b/board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c @@ -3,7 +3,6 @@ * Copyright (C) 2015 Stefan Roese */ -#include #include #include #include diff --git a/board/Marvell/dreamplug/dreamplug.c b/board/Marvell/dreamplug/dreamplug.c index d15faa1cb7ff..381275061318 100644 --- a/board/Marvell/dreamplug/dreamplug.c +++ b/board/Marvell/dreamplug/dreamplug.c @@ -8,7 +8,6 @@ * Written-by: Siddarth Gore */ -#include #include #include #include diff --git a/board/Marvell/guruplug/guruplug.c b/board/Marvell/guruplug/guruplug.c index ea87ded222e6..7c3cea22b936 100644 --- a/board/Marvell/guruplug/guruplug.c +++ b/board/Marvell/guruplug/guruplug.c @@ -5,7 +5,6 @@ * Written-by: Siddarth Gore */ -#include #include #include #include diff --git a/board/Marvell/mvebu_alleycat-5/board.c b/board/Marvell/mvebu_alleycat-5/board.c index 0c4f8e03b859..c1b7cc3b613c 100644 --- a/board/Marvell/mvebu_alleycat-5/board.c +++ b/board/Marvell/mvebu_alleycat-5/board.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ -#include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index 1685b12b8478..df3fb6d21645 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -3,7 +3,7 @@ * Copyright (C) 2016 Stefan Roese */ -#include +#include #include #include #include diff --git a/board/Marvell/mvebu_armada-8k/board.c b/board/Marvell/mvebu_armada-8k/board.c index a8899af6e5af..6d7042117424 100644 --- a/board/Marvell/mvebu_armada-8k/board.c +++ b/board/Marvell/mvebu_armada-8k/board.
[PATCH v1] arm: dts: verdin-imx8mm/imx8mp: use gpio-hog for sleep moci
From: Stefan Eichenberger In Linux, we allow sleep moci to be turned off when the carrier board supports it and the system is in suspend. In U-Boot, however, we want the sleep moci to be always on. So we use a gpio hog and disable the regulator. This change is necessary because we switched to upstream device tree files with commit 23fe2def1edf ("verdin-imx8mm/verdin-imx8mp: move imx verdins to OF_UPSTREAM"). A recent upstream patch removes the gpio hog from the Linux device tree, so we need to add it to the u-boot dtsi. The following patch will remove the gpio hog from the Linux device tree: https://lore.kernel.org/linux-devicetree/20240405160720.5977-1-eich...@gmail.com/ The U-Boot patch can be applied without it and will not break the build. Signed-off-by: Stefan Eichenberger --- arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi | 5 + arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi | 4 2 files changed, 9 insertions(+) diff --git a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi b/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi index 38db56059d..8b397f535c 100644 --- a/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-verdin-wifi-dev-u-boot.dtsi @@ -60,6 +60,11 @@ ctrl-sleep-moci-hog { bootph-pre-ram; + gpio-hog; + output-high; + gpios = <1 GPIO_ACTIVE_HIGH>; + line-name = "CTRL_SLEEP_MOCI#"; + }; }; diff --git a/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi b/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi index 03f211d5f7..7b45a87450 100644 --- a/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi +++ b/arch/arm/dts/imx8mp-verdin-wifi-dev-u-boot.dtsi @@ -58,6 +58,10 @@ ctrl-sleep-moci-hog { bootph-pre-ram; + gpio-hog; + output-high; + gpios = <29 GPIO_ACTIVE_HIGH>; + line-name = "CTRL_SLEEP_MOCI#"; }; }; -- 2.40.1
[PATCH v1] arm: dts: verdin-am62: use gpio-hog for sleep moci
From: Stefan Eichenberger In Linux, we allow sleep moci to be turned off when the carrier board supports it and the system is in suspend. In U-Boot, however, we want the sleep moci to be always on. So we use a gpio hog and disable the regulator. This change is necessary because we switched to upstream device tree files with commit c07bba7a2c7e ("verdin-am62: move verdin am62 to OF_UPSTREAM"). A recent upstream patch removes the gpio hog from the Linux device tree, so we need to add it to the u-boot dtsi. The following patch will remove the gpio hog from the Linux device tree: https://lore.kernel.org/linux-devicetree/20240301084901.16656-1-eich...@gmail.com/ The U-Boot patch can be applied without it and will not break the build. Signed-off-by: Stefan Eichenberger --- arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi b/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi index 7fe7ae4154..9ecb305274 100644 --- a/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi +++ b/arch/arm/dts/k3-am625-verdin-wifi-dev-u-boot.dtsi @@ -91,6 +91,14 @@ &main_gpio0 { bootph-all; + + ctrl-sleep-moci-hog { + bootph-all; + gpio-hog; + gpios = <31 GPIO_ACTIVE_HIGH>; + line-name = "CTRL_SLEEP_MOCI#"; + output-high; + }; }; /* On-module I2C - PMIC_I2C */ @@ -165,10 +173,6 @@ status = "disabled"; }; -&verdin_ctrl_sleep_moci { - bootph-all; -}; - /* Verdin UART_2 */ &wkup_uart0 { bootph-all; -- 2.40.1
Re: [PATCH] arm: dts: kirkwood: Remove DTS files for Kirkwood boards
On 3/26/24 22:12, Tony Dinh wrote: Remove DTS and DTSI files for Kirkwood boards that have upstream supports. This patch depends on "arm: dts: kirkwood: Enable upstream DT on Kirkwood boards" https://patchwork.ozlabs.org/project/uboot/patch/20240322021747.14873-1-mibo...@gmail.com/ Signed-off-by: Tony Dinh Applied to u-boot-marvell/master Thanks, Stefan --- arch/arm/dts/Makefile | 28 +- arch/arm/dts/kirkwood-6192.dtsi | 88 -- arch/arm/dts/kirkwood-6281.dtsi | 90 -- arch/arm/dts/kirkwood-6282.dtsi | 161 arch/arm/dts/kirkwood-98dx4122.dtsi | 53 -- arch/arm/dts/kirkwood-blackarmor-nas220.dts | 172 arch/arm/dts/kirkwood-d2net.dts | 45 - arch/arm/dts/kirkwood-dns325.dts | 63 -- arch/arm/dts/kirkwood-dnskw.dtsi | 235 - arch/arm/dts/kirkwood-dockstar.dts| 110 --- arch/arm/dts/kirkwood-dreamplug.dts | 131 --- arch/arm/dts/kirkwood-ds109.dts | 40 - arch/arm/dts/kirkwood-goflexnet.dts | 190 .../arm/dts/kirkwood-guruplug-server-plus.dts | 133 --- arch/arm/dts/kirkwood-ib62x0.dts | 146 --- arch/arm/dts/kirkwood-iconnect.dts| 195 arch/arm/dts/kirkwood-is2.dts | 40 - arch/arm/dts/kirkwood-lschlv2.dts | 20 - arch/arm/dts/kirkwood-lsxhl.dts | 20 - arch/arm/dts/kirkwood-lsxl.dtsi | 241 - arch/arm/dts/kirkwood-net2big.dts | 63 -- arch/arm/dts/kirkwood-netxbig.dtsi| 232 - arch/arm/dts/kirkwood-ns2-common.dtsi | 97 -- arch/arm/dts/kirkwood-ns2.dts | 40 - arch/arm/dts/kirkwood-ns2lite.dts | 35 - arch/arm/dts/kirkwood-ns2max.dts | 59 -- arch/arm/dts/kirkwood-ns2mini.dts | 60 -- arch/arm/dts/kirkwood-nsa310s.dts | 319 --- arch/arm/dts/kirkwood-nsa325.dts | 231 - arch/arm/dts/kirkwood-nsa3x0-common.dtsi | 157 arch/arm/dts/kirkwood-openrd-base.dts | 39 - arch/arm/dts/kirkwood-openrd-client.dts | 73 -- arch/arm/dts/kirkwood-openrd-ultimate.dts | 55 -- arch/arm/dts/kirkwood-openrd.dtsi | 122 --- arch/arm/dts/kirkwood-pogo_e02.dts| 132 --- arch/arm/dts/kirkwood-pogoplug-series-4.dts | 180 arch/arm/dts/kirkwood-sheevaplug-common.dtsi | 104 --- arch/arm/dts/kirkwood-sheevaplug.dts | 42 - arch/arm/dts/kirkwood-synology.dtsi | 855 -- arch/arm/dts/kirkwood.dtsi| 393 40 files changed, 1 insertion(+), 5488 deletions(-) delete mode 100644 arch/arm/dts/kirkwood-6192.dtsi delete mode 100644 arch/arm/dts/kirkwood-6281.dtsi delete mode 100644 arch/arm/dts/kirkwood-6282.dtsi delete mode 100644 arch/arm/dts/kirkwood-98dx4122.dtsi delete mode 100644 arch/arm/dts/kirkwood-blackarmor-nas220.dts delete mode 100644 arch/arm/dts/kirkwood-d2net.dts delete mode 100644 arch/arm/dts/kirkwood-dns325.dts delete mode 100644 arch/arm/dts/kirkwood-dnskw.dtsi delete mode 100644 arch/arm/dts/kirkwood-dockstar.dts delete mode 100644 arch/arm/dts/kirkwood-dreamplug.dts delete mode 100644 arch/arm/dts/kirkwood-ds109.dts delete mode 100644 arch/arm/dts/kirkwood-goflexnet.dts delete mode 100644 arch/arm/dts/kirkwood-guruplug-server-plus.dts delete mode 100644 arch/arm/dts/kirkwood-ib62x0.dts delete mode 100644 arch/arm/dts/kirkwood-iconnect.dts delete mode 100644 arch/arm/dts/kirkwood-is2.dts delete mode 100644 arch/arm/dts/kirkwood-lschlv2.dts delete mode 100644 arch/arm/dts/kirkwood-lsxhl.dts delete mode 100644 arch/arm/dts/kirkwood-lsxl.dtsi delete mode 100644 arch/arm/dts/kirkwood-net2big.dts delete mode 100644 arch/arm/dts/kirkwood-netxbig.dtsi delete mode 100644 arch/arm/dts/kirkwood-ns2-common.dtsi delete mode 100644 arch/arm/dts/kirkwood-ns2.dts delete mode 100644 arch/arm/dts/kirkwood-ns2lite.dts delete mode 100644 arch/arm/dts/kirkwood-ns2max.dts delete mode 100644 arch/arm/dts/kirkwood-ns2mini.dts delete mode 100644 arch/arm/dts/kirkwood-nsa310s.dts delete mode 100644 arch/arm/dts/kirkwood-nsa325.dts delete mode 100644 arch/arm/dts/kirkwood-nsa3x0-common.dtsi delete mode 100644 arch/arm/dts/kirkwood-openrd-base.dts delete mode 100644 arch/arm/dts/kirkwood-openrd-client.dts delete mode 100644 arch/arm/dts/kirkwood-openrd-ultimate.dts delete mode 100644 arch/arm/dts/kirkwood-openrd.dtsi delete mode 100644 arch/arm/dts/kirkwood-pogo_e02.dts delete mode 100644 arch/arm/dts/kirkwood-pogoplug-series-4.dts delete mode 100644 arch/arm/dts/kirkwood-sheevaplug-common.dtsi delete mode 100644 arch/arm/dts/kirkwood-sheevaplug.dts delete mode 100644 arch/arm/dts/kirkwood-synology.dtsi delete mode 100644 arch/arm/dts/kirkwood.dtsi diff --git a/arch/arm/dts/Makef
Please pull u-boot-marvell/master
Hi Tom, please pull the first batch of mostly Marvell related patches: - kirkwood: Switch to using upstream dts/dtsi files (Tony) - mvebu: Turris Omnia - New board revision support (Marek) Here the Azure build, without any issues: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=343&view=results Thanks, Stefan The following changes since commit cdfcc37428e06f4730ab9a17cc084eeb7676ea1a: Merge tag 'u-boot-dfu-next-20240402' of https://source.denx.de/u-boot/custodians/u-boot-dfu (2024-04-02 22:37:23 -0400) are available in the Git repository at: g...@source.denx.de:u-boot/custodians/u-boot-marvell.git for you to fetch changes up to 53bdcd1e9eacd6992d990b288fd6d48f43d94a0b: arm: mvebu: turris_omnia: Enable rng command in defconfig (2024-04-04 10:45:27 +0200) Marek Behún (18): arm: mvebu: turris_omnia: Enable LTO by default on Turris Omnia arm: mvebu: turris_omnia: Add header containing MCU command interface and use it arm: mvebu: turris_{omnia, mox}: Don't print model two times arm: mvebu: turris_omnia: Update MCU status and features reading arm: mvebu: turris_omnia: Implement getting board information from MCU arm: mvebu: turris_omnia: Print board ECDSA public key if available arm: mvebu: turris_omnia: Disable Atmel SHA node if not present arm: mvebu: spl: Do not build mvebu-reset in SPL arm: mvebu: system-controller: Rework to use UCLASS_SYSCON arm: mvebu: system-controller: Select mvebu-reset if DM_RESET && PCI_MVEBU arm: mvebu: system-controller: Add support for SYSRESET gpio: turris_omnia_mcu: Use byteorder conversion functions gpio: turris_omnia_mcu: Update firmware features reading gpio: turris_omnia_mcu: Add support for system power off via sysreset arm: mvebu: turris_omnia: Enable poweroff command via sysreset in defconfig cmd: rng: Print "Abort" on -EINTR misc: turris_omnia_mcu: Add support for rng provided by MCU arm: mvebu: turris_omnia: Enable rng command in defconfig Tony Dinh (2): arm: dts: kirkwood: Enable upstream DT on Kirkwood boards arm: dts: kirkwood: Remove DTS files for Kirkwood boards arch/arm/dts/Makefile | 28 +- arch/arm/dts/kirkwood-6192.dtsi| 88 --- arch/arm/dts/kirkwood-6281.dtsi| 90 --- arch/arm/dts/kirkwood-6282.dtsi| 161 - arch/arm/dts/kirkwood-98dx4122.dtsi| 53 -- arch/arm/dts/kirkwood-blackarmor-nas220.dts| 172 - arch/arm/dts/kirkwood-d2net.dts| 45 -- arch/arm/dts/kirkwood-dns325.dts | 63 -- arch/arm/dts/kirkwood-dnskw.dtsi | 235 --- arch/arm/dts/kirkwood-dockstar.dts | 110 arch/arm/dts/kirkwood-dreamplug-u-boot.dtsi| 7 + arch/arm/dts/kirkwood-dreamplug.dts| 131 arch/arm/dts/kirkwood-ds109.dts| 40 -- arch/arm/dts/kirkwood-goflexnet.dts| 190 -- arch/arm/dts/kirkwood-guruplug-server-plus.dts | 133 arch/arm/dts/kirkwood-ib62x0.dts | 146 - arch/arm/dts/kirkwood-iconnect.dts | 195 -- arch/arm/dts/kirkwood-is2.dts | 40 -- arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi | 6 +- arch/arm/dts/kirkwood-lschlv2.dts | 20 - arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi| 6 +- arch/arm/dts/kirkwood-lsxhl.dts| 20 - arch/arm/dts/kirkwood-lsxl.dtsi| 241 --- arch/arm/dts/kirkwood-net2big.dts | 63 -- arch/arm/dts/kirkwood-netxbig.dtsi | 232 --- arch/arm/dts/kirkwood-ns2-common.dtsi | 97 --- arch/arm/dts/kirkwood-ns2.dts | 40 -- arch/arm/dts/kirkwood-ns2lite.dts | 35 - arch/arm/dts/kirkwood-ns2max.dts | 59 -- arch/arm/dts/kirkwood-ns2mini.dts | 60 -- arch/arm/dts/kirkwood-nsa310s.dts | 319 - arch/arm/dts/kirkwood-nsa325-u-boot.dtsi | 7 + arch/arm/dts/kirkwood-nsa325.dts | 231 --- arch/arm/dts/kirkwood-nsa3x0-common.dtsi | 157 - arch/arm/dts/kirkwood-openrd-base.dts | 39 -- arch/arm/dts/kirkwood-openrd-client.dts| 73 --- arch/arm/dts/kirkwood-openrd-ultimate.dts | 55 -- arch/arm/dts/kirkwood-openrd.dtsi | 122 arch/arm/dts/kirkwood-pogo_e02.dts | 132 arch/arm/dts/kirkwood-pogoplug-series-4.dts| 180 -- arch/arm/dts/kirkwood-sheevaplug-common.dtsi | 104 --- arch/arm/dts/kirkwood-sheevaplug.dts | 42 -- arch/arm/dts/kirkwood-synology.dtsi| 855 - arch/arm/dts/ki
Re: [PATCH v3] arm: dts: kirkwood: Enable upstream DT on Kirkwood boards
On 4/2/24 00:08, Tony Dinh wrote: Enable OF_UPSTREAM to use upstream DT and add marvell/ prefix to the DEFAULT_DEVICE_TREE for Kirkwood boards. And so we can directly build DTBs from dts/upstream/src/arm/marvell, and including *-u-boot.dtsi files from arch/arm/dts/ directory. Background: The following 2 commands and filters were used in the analysis to determine which upstream DTS and DTSI files can be used as they are, or need to have modified/created *-u-boot.dtsi for u-boot specific implementation, and which board should be opt-out from OF_UPSTREAM. "git grep -li arch_kirkwood configs | xargs grep DEVICE_TREE | cut -d '"' -f2 | xargs -n1 sh -c 'diff -qs arch/arm/dts/$1.dts dts/upstream/src/arm/marvell/$1.dts' sh | grep differ" "diff -qrbu arch/arm/dts/ dts/upstream/src/arm/marvell/ | grep kirkwood | grep ".dtsi "" More detailed information can be found at: https://lore.kernel.org/u-boot/20240328021825.17935-1-mibo...@gmail.com/T/#u I've regression tested this patch with the Zyxel NSA325 (Kirkwood 88F6282) and Zyxel NSA310S (Kirkwood 88F6281). The Zyxel NSA325 board has a USB 3.0 controller attached to the PCIe bus. And the Zyxel NSA310S has an extensive overhaul in bindings and styles in upstream DTS version. Tested-by: Michael Walle # on lschv2 Acked-by: Sumit Garg Reviewed-by: Stefan Roese Signed-off-by: Tony Dinh Applied to u-boot-marvell/master Thanks, Stefan --- Changes in v3: - Collect Reviewed/Tested/Acked-by tags. - Trim the commit description and point to lore.kernel.org for detailed information. - No change from the V2 patch. Changes in v2: Remove unnecessary redefined OF_UPSTREAM and use "imply OF_UPSTREAM" for KW88F6281 and KW88F6192 SoCs. arch/arm/dts/kirkwood-dreamplug-u-boot.dtsi | 7 +++ arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi | 6 -- arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi | 6 -- arch/arm/dts/kirkwood-nsa325-u-boot.dtsi| 7 +++ arch/arm/mach-kirkwood/Kconfig | 2 ++ configs/SBx81LIFKW_defconfig| 1 + configs/SBx81LIFXCAT_defconfig | 1 + configs/d2net_v2_defconfig | 2 +- configs/dns325_defconfig| 2 +- configs/dockstar_defconfig | 2 +- configs/dreamplug_defconfig | 2 +- configs/ds109_defconfig | 2 +- configs/goflexhome_defconfig| 2 +- configs/guruplug_defconfig | 2 +- configs/ib62x0_defconfig| 2 +- configs/iconnect_defconfig | 2 +- configs/inetspace_v2_defconfig | 2 +- configs/lschlv2_defconfig | 2 +- configs/lsxhl_defconfig | 2 +- configs/nas220_defconfig| 2 +- configs/net2big_v2_defconfig| 2 +- configs/netspace_lite_v2_defconfig | 2 +- configs/netspace_max_v2_defconfig | 2 +- configs/netspace_mini_v2_defconfig | 2 +- configs/netspace_v2_defconfig | 2 +- configs/nsa310s_defconfig | 2 +- configs/nsa325_defconfig| 2 +- configs/openrd_base_defconfig | 2 +- configs/openrd_client_defconfig | 2 +- configs/openrd_ultimate_defconfig | 2 +- configs/pogo_e02_defconfig | 2 +- configs/pogo_v4_defconfig | 2 +- configs/sheevaplug_defconfig| 2 +- 33 files changed, 52 insertions(+), 30 deletions(-) create mode 100644 arch/arm/dts/kirkwood-dreamplug-u-boot.dtsi create mode 100644 arch/arm/dts/kirkwood-nsa325-u-boot.dtsi diff --git a/arch/arm/dts/kirkwood-dreamplug-u-boot.dtsi b/arch/arm/dts/kirkwood-dreamplug-u-boot.dtsi new file mode 100644 index 00..59f19a211f --- /dev/null +++ b/arch/arm/dts/kirkwood-dreamplug-u-boot.dtsi @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/ { + aliases { + spi0 = &spi0; + }; +}; diff --git a/arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi b/arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi index 7fc2d7d3b4..cf33ff822e 100644 --- a/arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi +++ b/arch/arm/dts/kirkwood-lschlv2-u-boot.dtsi @@ -1,7 +1,9 @@ // SPDX-License-Identifier: GPL-2.0+ -ð0 { - status = "disabled"; +/ { + aliases { + spi0 = &spi0; + }; }; &hdd_power { diff --git a/arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi b/arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi index 7fc2d7d3b4..cf33ff822e 100644 --- a/arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi +++ b/arch/arm/dts/kirkwood-lsxhl-u-boot.dtsi @@ -1,7 +1,9 @@ // SPDX-License-Identifier: GPL-2.0+ -ð0 { - status = "disabled"; +/ { + aliases { + spi0 = &spi0; + }; }; &hdd_power { diff --git a/arch/arm/dts/kirkwood-nsa325-u-boot.dtsi b/arch/arm/dts/
Re: [PATCH u-boot-mvebu v4 00/18] Turris Omnia - New board revision support
On 4/4/24 09:50, Marek Behún wrote: changes since v3: - added missing files turris_common.c and turris_common.h to patch 05/18 - added comment to patch 11/18 before while (1); as discussed in v3 v1, v2 and v3 at: https://patchwork.ozlabs.org/project/uboot/cover/20240304152148.3847-1-ka...@kernel.org/ https://patchwork.ozlabs.org/project/uboot/cover/20240323180711.5498-1-ka...@kernel.org/ https://patchwork.ozlabs.org/project/uboot/cover/20240327162355.24584-1-ka...@kernel.org/ Marek Behún (18): arm: mvebu: turris_omnia: Enable LTO by default on Turris Omnia arm: mvebu: turris_omnia: Add header containing MCU command interface and use it arm: mvebu: turris_{omnia, mox}: Don't print model two times arm: mvebu: turris_omnia: Update MCU status and features reading arm: mvebu: turris_omnia: Implement getting board information from MCU arm: mvebu: turris_omnia: Print board ECDSA public key if available arm: mvebu: turris_omnia: Disable Atmel SHA node if not present arm: mvebu: spl: Do not build mvebu-reset in SPL arm: mvebu: system-controller: Rework to use UCLASS_SYSCON arm: mvebu: system-controller: Select mvebu-reset if DM_RESET && PCI_MVEBU arm: mvebu: system-controller: Add support for SYSRESET gpio: turris_omnia_mcu: Use byteorder conversion functions gpio: turris_omnia_mcu: Update firmware features reading gpio: turris_omnia_mcu: Add support for system power off via sysreset arm: mvebu: turris_omnia: Enable poweroff command via sysreset in defconfig cmd: rng: Print "Abort" on -EINTR misc: turris_omnia_mcu: Add support for rng provided by MCU arm: mvebu: turris_omnia: Enable rng command in defconfig arch/arm/mach-mvebu/Kconfig | 25 ++ arch/arm/mach-mvebu/Makefile | 3 +- arch/arm/mach-mvebu/cpu.c| 2 + arch/arm/mach-mvebu/system-controller.c | 145 ++-- board/CZ.NIC/turris_atsha_otp.c | 27 +- board/CZ.NIC/turris_common.c | 42 +++ board/CZ.NIC/turris_common.h | 10 + board/CZ.NIC/turris_mox/turris_mox.c | 5 +- board/CZ.NIC/turris_omnia/Makefile | 2 +- board/CZ.NIC/turris_omnia/turris_omnia.c | 310 - cmd/rng.c| 7 +- configs/turris_omnia_defconfig | 6 + drivers/gpio/Kconfig | 7 - drivers/gpio/Makefile| 1 - drivers/gpio/turris_omnia_mcu.c | 316 - drivers/misc/Kconfig | 11 + drivers/misc/Makefile| 1 + drivers/misc/turris_omnia_mcu.c | 411 +++ include/turris-omnia-mcu-interface.h | 248 ++ 19 files changed, 1097 insertions(+), 482 deletions(-) create mode 100644 board/CZ.NIC/turris_common.c create mode 100644 board/CZ.NIC/turris_common.h delete mode 100644 drivers/gpio/turris_omnia_mcu.c create mode 100644 drivers/misc/turris_omnia_mcu.c create mode 100644 include/turris-omnia-mcu-interface.h Applied to u-boot-marvell/master Thanks, Stefan
Re: [PATCH u-boot-mvebu v3 00/18] Turris Omnia - New board revision support
Hi Marek, On 3/27/24 17:23, Marek Behún wrote: Hi Stefan, this is v3 of series adding support for new board revision of Turris Omnia. Changes since v2: - patch 2: updated MCU command interface header - patch 6: fixed bug setting \0 as end of string in src array instead of dst array after bin2hex() call - patch 16: updated commit message (added the bit about ctrl+c) v1 and v2 at: https://patchwork.ozlabs.org/project/uboot/cover/20240304152148.3847-1-ka...@kernel.org/ https://patchwork.ozlabs.org/project/uboot/cover/20240323180711.5498-1-ka...@kernel.org/ After pushing there changes in my current master I get these build errors for "turris_omnia_defconfig": make[1]: *** No rule to make target 'board/CZ.NIC/turris_omnia/../turris_common.o', needed by 'board/CZ.NIC/turris_omnia/built-in.o'. Stop. make[1]: *** Waiting for unfinished jobs board/CZ.NIC/turris_omnia/../turris_atsha_otp.c:14:10: fatal error: turris_common.h: No such file or directory 14 | #include "turris_common.h" | ^ compilation terminated. make[1]: *** [scripts/Makefile.build:257: board/CZ.NIC/turris_omnia/../turris_atsha_otp.o] Error 1 board/CZ.NIC/turris_omnia/turris_omnia.c:36:10: fatal error: ../turris_common.h: No such file or directory 36 | #include "../turris_common.h" | ^~~~ compilation terminated. Available here: https://source.denx.de/u-boot/custodians/u-boot-marvell/-/commits/master?ref_type=heads Could you please have a look? Thanks, Stefan Marek Behún (18): arm: mvebu: turris_omnia: Enable LTO by default on Turris Omnia arm: mvebu: turris_omnia: Add header containing MCU command interface and use it arm: mvebu: turris_{omnia, mox}: Don't print model two times arm: mvebu: turris_omnia: Update MCU status and features reading arm: mvebu: turris_omnia: Implement getting board information from MCU arm: mvebu: turris_omnia: Print board ECDSA public key if available arm: mvebu: turris_omnia: Disable Atmel SHA node if not present arm: mvebu: spl: Do not build mvebu-reset in SPL arm: mvebu: system-controller: Rework to use UCLASS_SYSCON arm: mvebu: system-controller: Select mvebu-reset if DM_RESET && PCI_MVEBU arm: mvebu: system-controller: Add support for SYSRESET gpio: turris_omnia_mcu: Use byteorder conversion functions gpio: turris_omnia_mcu: Update firmware features reading gpio: turris_omnia_mcu: Add support for system power off via sysreset arm: mvebu: turris_omnia: Enable poweroff command via sysreset in defconfig cmd: rng: Print "Abort" on -EINTR misc: turris_omnia_mcu: Add support for rng provided by MCU arm: mvebu: turris_omnia: Enable rng command in defconfig arch/arm/mach-mvebu/Kconfig | 25 ++ arch/arm/mach-mvebu/Makefile | 3 +- arch/arm/mach-mvebu/cpu.c| 2 + arch/arm/mach-mvebu/system-controller.c | 144 ++-- board/CZ.NIC/turris_atsha_otp.c | 27 +- board/CZ.NIC/turris_mox/turris_mox.c | 5 +- board/CZ.NIC/turris_omnia/Makefile | 2 +- board/CZ.NIC/turris_omnia/turris_omnia.c | 310 - cmd/rng.c| 7 +- configs/turris_omnia_defconfig | 6 + drivers/gpio/Kconfig | 7 - drivers/gpio/Makefile| 1 - drivers/gpio/turris_omnia_mcu.c | 316 - drivers/misc/Kconfig | 11 + drivers/misc/Makefile| 1 + drivers/misc/turris_omnia_mcu.c | 411 +++ include/turris-omnia-mcu-interface.h | 248 ++ 17 files changed, 1044 insertions(+), 482 deletions(-) delete mode 100644 drivers/gpio/turris_omnia_mcu.c create mode 100644 drivers/misc/turris_omnia_mcu.c create mode 100644 include/turris-omnia-mcu-interface.h Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 v2 0/3] dt-bindings: arm: bcm: raspberrypi,bcm2835-firmware: Drive-by fixes
Hi Laurent, Am 02.04.24 um 22:08 schrieb Laurent Pinchart: Hello, ... Stefan, I'm quite unfamiliar with the Raspberry Pi upstreaming process (despite having sent patches for ages :-)), do I understand correctly that this patch will go through your tree, or do I need to work with someone else to get it merged upstream ? i'm not the maintainer, but i'm trying to help. Florian is the maintainer, so i would expect this series goes through his tree. So MAINTAINERS file is correct here.
Re: [PATCH v2 0/3] dt-bindings: arm: bcm: raspberrypi,bcm2835-firmware: Drive-by fixes
Am 02.04.24 um 10:58 schrieb Ivan T. Ivanov: Hi, On 2024-03-28 01:37, Laurent Pinchart wrote: On Wed, Mar 27, 2024 at 07:49:38AM +0100, Stefan Wahren wrote: Hi, [add Peter and Ivan] Am 26.03.24 um 20:58 schrieb Laurent Pinchart: > Hello, > > This small series includes a few drive-by fixes for DT validation > errors. > > The first patch has been posted previously in v1 ([1], and now addresses > a small review comment. I think it's good to go. > > The next two patches address the same issue as "[PATCH 1/2] dt-bindings: > arm: bcm: raspberrypi,bcm2835-firmware: Add missing properties" ([2]), > but this time with a (hopefully) correct approach. Patch 2/3 starts by > fixing the raspberrypi-bcm2835-firmware driver, removing the need for DT > properties that are specified in bcm2835-rpi.dtsi but not documented in > the corresponding bindings. Patch 3/3 can then drop those properties, > getting rid of the warnings. since this series drops properties from the device tree, does anyone have the chance to test it with a recent U-Boot? I don't have U-Boot running with my RPi, so I would appreciate if someone could help :-) Sorry for taking me so long to verify this. I think on RPi U-Boot side we are fine. API used when accessing Mbox device do not follow DM model and do not use DMA, but just access device directly using this nice macros phys_to_bus/bus_to_phys. I build new DTB files with this patch included and U-Boot build from the latest sources. No obvious issues on RPi3 and RPi4. Devices boot fine. Thanks you, Laurent and Ivan Reviewed-by: Stefan Wahren Regards, Ivan
Re: [PATCH u-boot-mvebu v3 11/18] arm: mvebu: system-controller: Add support for SYSRESET
On 3/28/24 12:21, Marek Behún wrote: On Thu, 28 Mar 2024 11:04:45 +0100 Stefan Roese wrote: +static int mvebu_sysreset_request(struct udevice *dev, enum sysreset_t type) +{ + struct regmap *regmap = syscon_get_regmap(dev->parent); + uint bit; + + if (type != SYSRESET_COLD) + return -EPROTONOSUPPORT; + + bit = MVEBU_GLOBAL_SOFT_RST_BIT; + + regmap_update_bits(regmap, MVEBU_RSTOUTN_MASK_REG, bit, bit); + regmap_update_bits(regmap, MVEBU_SYS_SOFT_RST_REG, bit, bit); + + while (1) + ; A comment before this endless loop might be helpful here. The code does the same as reset_cpu() in cpu.c, and the while() cycle is not commented there. Sure, other code might suffer this undocumented endless loop as well. And again, this is more a nitpicking comment than a real requirement. But we can add something like /* something has gone wrong if we reach here, so we may as well stay * here */ What do you think? Could you amend the patch? More something like this: /* Loop while waiting for the reset */ while (1) ; And yes, I can fold this into your patchset, if I don't forget about this. Still, if there is need for a v4, then please add it yourself. Thanks, Stefan
Re: [PATCH u-boot-mvebu v3 05/18] arm: mvebu: turris_omnia: Implement getting board information from MCU
On 3/28/24 12:17, Marek Behún wrote: On Thu, 28 Mar 2024 10:56:01 +0100 Stefan Roese wrote: On 3/27/24 17:23, Marek Behún wrote: Implement reading board serial number, first MAC address and board version from MCU. MCU supports board information if the FEAT_BOARD_INFO feature bit is set in MCU features. Prefer getting board information from MCU if supported, fallback to Atmel SHA chip. Signed-off-by: Marek Behún Minor comment below. Other than this: Reviewed-by: Stefan Roese Thanks, Stefan --- board/CZ.NIC/turris_atsha_otp.c | 27 +-- board/CZ.NIC/turris_omnia/Makefile | 2 +- board/CZ.NIC/turris_omnia/turris_omnia.c | 94 +++- 3 files changed, 93 insertions(+), 30 deletions(-) diff --git a/board/CZ.NIC/turris_atsha_otp.c b/board/CZ.NIC/turris_atsha_otp.c index a29fe36231..85eebcdf18 100644 --- a/board/CZ.NIC/turris_atsha_otp.c +++ b/board/CZ.NIC/turris_atsha_otp.c @@ -11,6 +11,7 @@ #include #include "turris_atsha_otp.h" +#include "turris_common.h" #define TURRIS_ATSHA_OTP_VERSION 0 #define TURRIS_ATSHA_OTP_SERIAL 1 @@ -32,26 +33,6 @@ static struct udevice *get_atsha204a_dev(void) return dev; } -static void increment_mac(u8 *mac) -{ - int i; - - for (i = 5; i >= 3; i--) { - mac[i] += 1; - if (mac[i]) - break; - } -} - -static void set_mac_if_invalid(int i, u8 *mac) -{ - u8 oldmac[6]; - - if (is_valid_ethaddr(mac) && - !eth_env_get_enetaddr_by_index("eth", i, oldmac)) - eth_env_set_enetaddr_by_index("eth", i, mac); -} - int turris_atsha_otp_init_mac_addresses(int first_idx) { struct udevice *dev = get_atsha204a_dev(); @@ -84,11 +65,7 @@ int turris_atsha_otp_init_mac_addresses(int first_idx) mac[4] = mac1[2]; mac[5] = mac1[3]; - set_mac_if_invalid((first_idx + 0) % 3, mac); - increment_mac(mac); - set_mac_if_invalid((first_idx + 1) % 3, mac); - increment_mac(mac); - set_mac_if_invalid((first_idx + 2) % 3, mac); + turris_init_mac_addresses(first_idx, mac); return 0; } diff --git a/board/CZ.NIC/turris_omnia/Makefile b/board/CZ.NIC/turris_omnia/Makefile index dc39b44ae1..341378b4e5 100644 --- a/board/CZ.NIC/turris_omnia/Makefile +++ b/board/CZ.NIC/turris_omnia/Makefile @@ -2,4 +2,4 @@ # # Copyright (C) 2017 Marek Behún -obj-y := turris_omnia.o ../turris_atsha_otp.o +obj-y := turris_omnia.o ../turris_atsha_otp.o ../turris_common.o diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 6dfde5ee7a..f63640ad64 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -25,12 +26,14 @@ #include #include #include +#include #include #include #include "../drivers/ddr/marvell/a38x/ddr3_init.h" #include <../serdes/a38x/high_speed_env_spec.h> #include "../turris_atsha_otp.h" +#include "../turris_common.h" DECLARE_GLOBAL_DATA_PTR; @@ -186,6 +189,70 @@ static bool omnia_mcu_has_feature(u32 feature) return feature & features; } +static u32 omnia_mcu_crc32(const void *p, size_t len) +{ + u32 val, crc = 0; + + compiletime_assert(!(len % 4), "length has to be a multiple of 4"); + + while (len) { + val = bitrev32(get_unaligned_le32(p)); + crc = crc32(crc, (void *)&val, 4); + p += 4; + len -= 4; + } + + return ~bitrev32(crc); +} + +/* Can only be called after relocation, since it needs cleared BSS */ +static int omnia_mcu_board_info(char *serial, u8 *mac, char *version) +{ + static u8 reply[17]; + static bool cached; + + if (!cached) { + u8 csum; + int ret; + + ret = omnia_mcu_read(CMD_BOARD_INFO_GET, reply, sizeof(reply)); + if (ret) + return ret; + + if (reply[0] != 16) + return -EBADMSG; + + csum = reply[16]; + reply[16] = 0; + + if ((omnia_mcu_crc32(&reply[1], 16) & 0xff) != csum) + return -EBADMSG; + + cached = true; + } + + if (serial) { + const char *serial_env; + + serial_env = env_get("serial#"); + if (serial_env && strlen(serial_env) == 16) { + strcpy(serial, serial_env); Usage of strcpy() is discouraged AFAIK. Yeah, it would make sense to use strncpy, but the potential leak is prevented by strlen() check. strncpy is also not optimal. Please see here if
Re: [PATCH u-boot-mvebu v3 18/18] arm: mvebu: turris_omnia: Enable rng command in defconfig
On 3/27/24 17:23, Marek Behún wrote: Now that Turris Omnia has a rng driver provided in the MCU driver, enable the rng command in defconfig. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- configs/turris_omnia_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index 4c21635ec9..f2b39115fe 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -73,6 +73,7 @@ CONFIG_CMD_WDT=y CONFIG_CMD_TFTPPUT=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y +CONFIG_CMD_RNG=y CONFIG_CMD_AES=y CONFIG_CMD_HASH=y CONFIG_CMD_BTRFS=y Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-mvebu v3 17/18] misc: turris_omnia_mcu: Add support for rng provided by MCU
On 3/27/24 17:23, Marek Behún wrote: Add support for true random number generator provided by the MCU on Turris Omnia. The MCU firmware supports TRNG if the FEAT_TRNG bit is set in features. In that case we bind the rng driver. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- configs/turris_omnia_defconfig | 1 + drivers/misc/Kconfig| 1 + drivers/misc/turris_omnia_mcu.c | 57 + 3 files changed, 59 insertions(+) diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index 0df0f3c90b..4c21635ec9 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -107,6 +107,7 @@ CONFIG_NVME_PCI=y CONFIG_PCI_MVEBU=y CONFIG_PINCTRL=y CONFIG_PINCTRL_ARMADA_38X=y +CONFIG_DM_RNG=y CONFIG_DM_RTC=y CONFIG_RTC_ARMADA38X=y CONFIG_SERIAL_PROBE_ALL=y diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 844a21be47..a08f02196f 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -509,6 +509,7 @@ config TURRIS_OMNIA_MCU bool "Enable Turris Omnia MCU driver" depends on DM_I2C depends on DM_GPIO + depends on DM_RNG depends on SYSRESET default y if TARGET_TURRIS_OMNIA help diff --git a/drivers/misc/turris_omnia_mcu.c b/drivers/misc/turris_omnia_mcu.c index 77a0424d61..6b2f17c000 100644 --- a/drivers/misc/turris_omnia_mcu.c +++ b/drivers/misc/turris_omnia_mcu.c @@ -5,15 +5,20 @@ */ #include +#include #include #include #include +#include #include #include #include #include +#include #include +#define CMD_TRNG_MAX_ENTROPY_LEN 64 + struct turris_omnia_mcu_info { u32 features; }; @@ -282,6 +287,49 @@ U_BOOT_DRIVER(turris_omnia_mcu_sysreset) = { .ops= &omnia_sysreset_ops, }; +static int omnia_rng_read(struct udevice *dev, void *data, size_t count) +{ + u8 buf[1 + CMD_TRNG_MAX_ENTROPY_LEN]; + size_t len; + int ret; + + while (count) { + ret = dm_i2c_read(dev->parent, CMD_TRNG_COLLECT_ENTROPY, buf, + sizeof(buf)); + if (ret) + return ret; + + len = min_t(size_t, buf[0], + min_t(size_t, CMD_TRNG_MAX_ENTROPY_LEN, count)); + + if (!len) { + /* wait 500ms (fail if interrupted), then try again */ + for (int i = 0; i < 5; ++i) { + mdelay(100); + if (ctrlc()) + return -EINTR; + } + continue; + } + + memcpy(data, &buf[1], len); + data += len; + count -= len; + } + + return 0; +} + +static const struct dm_rng_ops omnia_rng_ops = { + .read = omnia_rng_read, +}; + +U_BOOT_DRIVER(turris_omnia_mcu_trng) = { + .name = "turris-omnia-mcu-trng", + .id = UCLASS_RNG, + .ops= &omnia_rng_ops, +}; + static int turris_omnia_mcu_bind(struct udevice *dev) { /* bind MCU GPIOs as a child device */ @@ -336,6 +384,15 @@ static int turris_omnia_mcu_probe(struct udevice *dev) return ret; } + /* bind rng if trng is supported */ + if (info->features & FEAT_TRNG) { + ret = device_bind_driver_to_node(dev, "turris-omnia-mcu-trng", +"turris-omnia-mcu-trng", +dev_ofnode(dev), NULL); + if (ret < 0) + return ret; + } + return 0; } Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-mvebu v3 16/18] cmd: rng: Print "Abort" on -EINTR
On 3/27/24 17:23, Marek Behún wrote: In the rng command, print Abort instead of Reading RNG failed if the error number is -EINTR, which can happen if the user pressed CTRL-C. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- cmd/rng.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/rng.c b/cmd/rng.c index 52f722c7af..48ba67061b 100644 --- a/cmd/rng.c +++ b/cmd/rng.c @@ -17,7 +17,7 @@ static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) u8 buf[64]; int devnum; struct udevice *dev; - int ret = CMD_RET_SUCCESS; + int ret = CMD_RET_SUCCESS, err; switch (argc) { case 1: @@ -46,8 +46,9 @@ static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) n = min(n, sizeof(buf)); - if (dm_rng_read(dev, buf, n)) { - printf("Reading RNG failed\n"); + err = dm_rng_read(dev, buf, n); + if (err) { + puts(err == -EINTR ? "Abort\n" : "Reading RNG failed\n"); ret = CMD_RET_FAILURE; } else { print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, n); Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-mvebu v3 15/18] arm: mvebu: turris_omnia: Enable poweroff command via sysreset in defconfig
On 3/27/24 17:23, Marek Behún wrote: Enable support for the poweroff command via sysreset for Turris Omnia. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- configs/turris_omnia_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index 9d5171c6a8..0df0f3c90b 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -65,6 +65,7 @@ CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_MTD=y CONFIG_CMD_PCI=y +CONFIG_CMD_POWEROFF=y CONFIG_CMD_SATA=y CONFIG_CMD_SPI=y CONFIG_CMD_USB=y @@ -114,6 +115,7 @@ CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y CONFIG_KIRKWOOD_SPI=y CONFIG_SYSRESET=y +CONFIG_SYSRESET_CMD_POWEROFF=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-mvebu v3 14/18] gpio: turris_omnia_mcu: Add support for system power off via sysreset
On 3/27/24 17:23, Marek Behún wrote: Add support for system power off via UCLASS_SYSRESET. Newer versions of Turris Omnia MCU firmware can power off the board (MCU will disable almost all voltage regulators and go into low power mode). Move the MCU driver into drivers/misc and register it under UCLASS_MISC. The sysreset and gpio device are bound as child devices of the MCU device. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- configs/turris_omnia_defconfig| 1 + drivers/gpio/Kconfig | 7 - drivers/gpio/Makefile | 1 - drivers/misc/Kconfig | 10 ++ drivers/misc/Makefile | 1 + drivers/{gpio => misc}/turris_omnia_mcu.c | 150 -- 6 files changed, 120 insertions(+), 50 deletions(-) rename drivers/{gpio => misc}/turris_omnia_mcu.c (60%) diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index 39e15043df..9d5171c6a8 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -113,6 +113,7 @@ CONFIG_SPL_DEBUG_UART_BASE=0xd0012000 CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y CONFIG_KIRKWOOD_SPI=y +CONFIG_SYSRESET=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 2df3dc42d0..020c6ae74c 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -662,13 +662,6 @@ config SLG7XL45106_I2C_GPO 8-bit gpo expander, all gpo lines are controlled by writing value into data register. -config TURRIS_OMNIA_MCU - bool "Turris Omnia MCU GPIO driver" - depends on DM_GPIO - default y if TARGET_TURRIS_OMNIA - help - Support for GPIOs on MCU connected to Turris Omnia via i2c. - config FTGPIO010 bool "Faraday Technology FTGPIO010 driver" depends on DM_GPIO diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index da3da5da2b..d637895c7a 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -73,7 +73,6 @@ obj-$(CONFIG_$(SPL_)MAX77663_GPIO)+= max77663_gpio.o obj-$(CONFIG_SL28CPLD_GPIO) += sl28cpld-gpio.o obj-$(CONFIG_ZYNQMP_GPIO_MODEPIN) += zynqmp_gpio_modepin.o obj-$(CONFIG_SLG7XL45106_I2C_GPO) += gpio_slg7xl45106.o -obj-$(CONFIG_$(SPL_TPL_)TURRIS_OMNIA_MCU) += turris_omnia_mcu.o obj-$(CONFIG_FTGPIO010) += ftgpio010.o obj-$(CONFIG_ADP5585_GPIO)+= adp5585_gpio.o obj-$(CONFIG_RZG2L_GPIO) += rzg2l-gpio.o diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index f11ce72525..844a21be47 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -505,6 +505,16 @@ config TEST_DRV model. This should only be enabled for testing as it is not useful for anything else. +config TURRIS_OMNIA_MCU + bool "Enable Turris Omnia MCU driver" + depends on DM_I2C + depends on DM_GPIO + depends on SYSRESET + default y if TARGET_TURRIS_OMNIA + help + This enables support for Turris Omnia MCU connected GPIOs and + board power off. + config USB_HUB_USB251XB tristate "USB251XB Hub Controller Configuration Driver" depends on I2C diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 0432db6ed1..3cd8e2fd48 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -81,6 +81,7 @@ obj-$(CONFIG_SYS_DPAA_QBMAN) += fsl_portals.o obj-$(CONFIG_TEGRA186_BPMP) += tegra186_bpmp.o obj-$(CONFIG_TEGRA_CAR) += tegra_car.o obj-$(CONFIG_TEST_DRV) += test_drv.o +obj-$(CONFIG_$(SPL_TPL_)TURRIS_OMNIA_MCU) += turris_omnia_mcu.o obj-$(CONFIG_TWL4030_LED) += twl4030_led.o obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress_config.o obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o diff --git a/drivers/gpio/turris_omnia_mcu.c b/drivers/misc/turris_omnia_mcu.c similarity index 60% rename from drivers/gpio/turris_omnia_mcu.c rename to drivers/misc/turris_omnia_mcu.c index 40ced261e3..77a0424d61 100644 --- a/drivers/gpio/turris_omnia_mcu.c +++ b/drivers/misc/turris_omnia_mcu.c @@ -1,9 +1,14 @@ // SPDX-License-Identifier: GPL-2.0+ -// (C) 2022 Pali Rohár +/* + * Copyright (C) 2022 Pali Rohár + * Copyright (C) 2024 Marek Behún + */ #include #include +#include #include +#include #include #include #include @@ -13,9 +18,9 @@ struct turris_omnia_mcu_info { u32 features; }; -static int turris_omnia_mcu_get_function(struct udevice *dev, uint offset) +static int omnia_gpio_get_function(struct udevice *dev, uint offset) { - struct turris_omnia_mcu_info *info = dev_get_plat(dev); + struct turris_omnia_mcu_info *info = dev_get_priv(dev->parent); switch (offset) { /* bank 0 */ @@ -49,9 +54,9 @@ static int turris_omnia_mcu_get_function(struct udevice *dev, uint offset) } } -static int turris_omn
Re: [PATCH u-boot-mvebu v3 13/18] gpio: turris_omnia_mcu: Update firmware features reading
On 3/27/24 17:23, Marek Behún wrote: Update firmware features reading to try reading 32 bits of features and fallback to reading 16 bits. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- drivers/gpio/turris_omnia_mcu.c | 32 ++-- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/turris_omnia_mcu.c b/drivers/gpio/turris_omnia_mcu.c index c441d07d69..40ced261e3 100644 --- a/drivers/gpio/turris_omnia_mcu.c +++ b/drivers/gpio/turris_omnia_mcu.c @@ -10,7 +10,7 @@ #include struct turris_omnia_mcu_info { - u16 features; + u32 features; }; static int turris_omnia_mcu_get_function(struct udevice *dev, uint offset) @@ -228,25 +228,37 @@ static int turris_omnia_mcu_probe(struct udevice *dev) { struct turris_omnia_mcu_info *info = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); - u16 val; + u32 dword; + u16 word; int ret; - ret = dm_i2c_read(dev, CMD_GET_STATUS_WORD, (void *)&val, sizeof(val)); + ret = dm_i2c_read(dev, CMD_GET_STATUS_WORD, (void *)&word, sizeof(word)); if (ret < 0) { printf("Error: turris_omnia_mcu CMD_GET_STATUS_WORD failed: %d\n", ret); return ret; } - if (le16_to_cpu(val) & STS_FEATURES_SUPPORTED) { - ret = dm_i2c_read(dev, CMD_GET_FEATURES, (void *)&val, - sizeof(val)); + if (le16_to_cpu(word) & STS_FEATURES_SUPPORTED) { + /* try read 32-bit features */ + ret = dm_i2c_read(dev, CMD_GET_FEATURES, (void *)&dword, + sizeof(dword)); if (ret < 0) { - printf("Error: turris_omnia_mcu CMD_GET_FEATURES failed: %d\n", - ret); - return ret; + /* try read 16-bit features */ + ret = dm_i2c_read(dev, CMD_GET_FEATURES, (void *)&word, + sizeof(word)); + if (ret < 0) { + printf("Error: turris_omnia_mcu CMD_GET_FEATURES failed: %d\n", + ret); + return ret; + } + + info->features = le16_to_cpu(word); + } else { + info->features = le32_to_cpu(dword); + if (info->features & FEAT_FROM_BIT_16_INVALID) + info->features &= GENMASK(15, 0); } - info->features = le16_to_cpu(val); } uc_priv->bank_name = "mcu_"; Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-mvebu v3 12/18] gpio: turris_omnia_mcu: Use byteorder conversion functions
On 3/27/24 17:23, Marek Behún wrote: Use byteorder conversion function instead of manually assembling data from/to MCU. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- drivers/gpio/turris_omnia_mcu.c | 80 +++-- 1 file changed, 46 insertions(+), 34 deletions(-) diff --git a/drivers/gpio/turris_omnia_mcu.c b/drivers/gpio/turris_omnia_mcu.c index da9a6efe6d..c441d07d69 100644 --- a/drivers/gpio/turris_omnia_mcu.c +++ b/drivers/gpio/turris_omnia_mcu.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -51,27 +52,31 @@ static int turris_omnia_mcu_get_function(struct udevice *dev, uint offset) static int turris_omnia_mcu_get_value(struct udevice *dev, uint offset) { struct turris_omnia_mcu_info *info = dev_get_plat(dev); - u8 val16[2]; - u8 val32[4]; + u32 val32; + u16 val16; int ret; switch (offset) { /* bank 0 */ case 0 ... 15: - ret = dm_i2c_read(dev, CMD_GET_STATUS_WORD, val16, 2); + ret = dm_i2c_read(dev, CMD_GET_STATUS_WORD, (void *)&val16, + sizeof(val16)); if (ret) return ret; - return u16)val16[1] << 8) | val16[0]) >> offset) & 0x1; + + return !!(le16_to_cpu(val16) & BIT(offset)); /* bank 1 - supported only when FEAT_EXT_CMDS is set */ case (16 + 0) ... (16 + 31): if (!(info->features & FEAT_EXT_CMDS)) return -EINVAL; - ret = dm_i2c_read(dev, CMD_GET_EXT_STATUS_DWORD, val32, 4); + + ret = dm_i2c_read(dev, CMD_GET_EXT_STATUS_DWORD, (void *)&val32, + sizeof(val32)); if (ret) return ret; - return u32)val32[3] << 24) | ((u32)val32[2] << 16) | -((u32)val32[1] << 8) | val32[0]) >> (offset - 16)) & 0x1; + + return !!(le32_to_cpu(val32) & BIT(offset - 16)); /* bank 2 - supported only when FEAT_EXT_CMDS and FEAT_PERIPH_MCU is set */ case (16 + 32 + 0) ... (16 + 32 + 15): @@ -79,10 +84,13 @@ static int turris_omnia_mcu_get_value(struct udevice *dev, uint offset) return -EINVAL; if (!(info->features & FEAT_PERIPH_MCU)) return -EINVAL; - ret = dm_i2c_read(dev, CMD_GET_EXT_CONTROL_STATUS, val16, 2); + + ret = dm_i2c_read(dev, CMD_GET_EXT_CONTROL_STATUS, + (void *)&val16, sizeof(val16)); if (ret) return ret; - return u16)val16[1] << 8) | val16[0]) >> (offset - 16 - 32)) & 0x1; + + return !!(le16_to_cpu(val16) & BIT(offset - 16 - 32)); default: return -EINVAL; @@ -92,30 +100,33 @@ static int turris_omnia_mcu_get_value(struct udevice *dev, uint offset) static int turris_omnia_mcu_set_value(struct udevice *dev, uint offset, int value) { struct turris_omnia_mcu_info *info = dev_get_plat(dev); - u8 val16[2]; - u8 val32[4]; + u16 valmask16[2]; + u8 valmask8[2]; switch (offset) { /* bank 0 */ case 0 ... 15: switch (offset) { case ilog2(STS_USB30_PWRON): - val16[1] = CTL_USB30_PWRON; + valmask8[1] = CTL_USB30_PWRON; break; case ilog2(STS_USB31_PWRON): - val16[1] = CTL_USB31_PWRON; + valmask8[1] = CTL_USB31_PWRON; break; case ilog2(STS_ENABLE_4V5): - val16[1] = CTL_ENABLE_4V5; + valmask8[1] = CTL_ENABLE_4V5; break; case ilog2(STS_BUTTON_MODE): - val16[1] = CTL_BUTTON_MODE; + valmask8[1] = CTL_BUTTON_MODE; break; default: return -EINVAL; } - val16[0] = value ? val16[1] : 0; - return dm_i2c_write(dev, CMD_GENERAL_CONTROL, val16, sizeof(val16)); + + valmask8[0] = value ? valmask8[1] : 0; + + return dm_i2c_write(dev, CMD_GENERAL_CONTROL, valmask8, + sizeof(valmask8)); /* bank 2 - supported only when FEAT_EXT_CMDS and FEAT_PERIPH_MCU is set */ case (16 + 32 + 0) ... (16 + 32 + 15): @@ -123,11 +134,12 @@ static int turris_omnia_mcu_set_value(struct udevice *dev, uint offset, int valu return -EINVAL; if (!(info->features & FEAT_PERIPH_MCU)) return -EINVA
Re: [PATCH u-boot-mvebu v3 11/18] arm: mvebu: system-controller: Add support for SYSRESET
On 3/27/24 17:23, Marek Behún wrote: Add driver model support for sysreset via mvebu system controller. This is currently only available for U-Boot proper. Signed-off-by: Marek Behún Only a minor comment below. Other than this: Reviewed-by: Stefan Roese Thanks, Stefan --- arch/arm/mach-mvebu/Kconfig | 18 +- arch/arm/mach-mvebu/Makefile| 2 +- arch/arm/mach-mvebu/cpu.c | 2 + arch/arm/mach-mvebu/system-controller.c | 74 +++-- 4 files changed, 89 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 623432a60e..f15d3cc5ed 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -19,6 +19,7 @@ config ARMADA_32BIT select SPL_SYS_NO_VECTOR_TABLE if SPL select ARCH_VERY_EARLY_INIT select ARMADA_32BIT_SYSCON_RESET if DM_RESET && PCI_MVEBU + select ARMADA_32BIT_SYSCON_SYSRESET if SYSRESET # ARMv7 SoCs... config ARMADA_375 @@ -457,16 +458,29 @@ config SF_DEFAULT_MODE default 0x0 depends on MVEBU_SPL_BOOT_DEVICE_SPI +config ARMADA_32BIT_SYSCON + bool + depends on ARMADA_32BIT + select REGMAP + select SYSCON + config ARMADA_32BIT_SYSCON_RESET bool "Support Armada XP/375/38x/39x reset controller" depends on ARMADA_32BIT depends on DM_RESET - select REGMAP - select SYSCON + select ARMADA_32BIT_SYSCON help Build support for Armada XP/375/38x/39x reset controller. This is needed for PCIe support. +config ARMADA_32BIT_SYSCON_SYSRESET + bool "Support Armada XP/375/38x/39x sysreset via driver model" + depends on ARMADA_32BIT + depends on SYSRESET + select ARMADA_32BIT_SYSCON + help + Build support for Armada XP/375/38x/39x system reset via driver model. + source "board/solidrun/clearfog/Kconfig" source "board/kobol/helios4/Kconfig" diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index d44ca3a0df..329c2e4915 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile @@ -28,7 +28,7 @@ obj-$(CONFIG_ARMADA_38X) += ../../../drivers/ddr/marvell/a38x/xor.o obj-$(CONFIG_ARMADA_XP) += ../../../drivers/ddr/marvell/axp/xor.o obj-$(CONFIG_ARMADA_MSYS) += ../../../drivers/ddr/marvell/axp/xor.o -obj-$(CONFIG_ARMADA_32BIT_SYSCON_RESET) += system-controller.o +obj-$(CONFIG_ARMADA_32BIT_SYSCON) += system-controller.o ifdef CONFIG_ARMADA_38X obj-$(CONFIG_MVEBU_EFUSE) += efuse.o diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c index 8e0de93538..7c62a5dbb6 100644 --- a/arch/arm/mach-mvebu/cpu.c +++ b/arch/arm/mach-mvebu/cpu.c @@ -52,6 +52,7 @@ void lowlevel_init(void) */ } +#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_ARMADA_32BIT_SYSCON_SYSRESET) void reset_cpu(void) { struct mvebu_system_registers *reg = @@ -62,6 +63,7 @@ void reset_cpu(void) while (1) ; } +#endif u32 get_boot_device(void) { diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c index c5c05922f2..b5f8afb96d 100644 --- a/arch/arm/mach-mvebu/system-controller.c +++ b/arch/arm/mach-mvebu/system-controller.c @@ -10,11 +10,24 @@ #include #include #include +#include #include -#define MVEBU_SOC_CONTROL_1_REG 0x4 +#define MVEBU_SOC_CONTROL_1_REG0x4 -#define MVEBU_PCIE_ID 0 +#if defined(CONFIG_ARMADA_375) +# define MVEBU_RSTOUTN_MASK_REG0x54 +# define MVEBU_SYS_SOFT_RST_REG0x58 +#else +# define MVEBU_RSTOUTN_MASK_REG0x60 +# define MVEBU_SYS_SOFT_RST_REG0x64 +#endif + +#define MVEBU_GLOBAL_SOFT_RST_BIT BIT(0) + +#define MVEBU_PCIE_ID 0 + +#if IS_ENABLED(CONFIG_ARMADA_32BIT_SYSCON_RESET) static int mvebu_reset_of_xlate(struct reset_ctl *rst, struct ofnode_phandle_args *args) @@ -90,11 +103,64 @@ U_BOOT_DRIVER(mvebu_reset) = { .ops = &mvebu_reset_ops, }; +#endif /* IS_ENABLED(CONFIG_ARMADA_32BIT_SYSCON_RESET) */ + +#if IS_ENABLED(CONFIG_ARMADA_32BIT_SYSCON_SYSRESET) + +static int mvebu_sysreset_request(struct udevice *dev, enum sysreset_t type) +{ + struct regmap *regmap = syscon_get_regmap(dev->parent); + uint bit; + + if (type != SYSRESET_COLD) + return -EPROTONOSUPPORT; + + bit = MVEBU_GLOBAL_SOFT_RST_BIT; + + regmap_update_bits(regmap, MVEBU_RSTOUTN_MASK_REG, bit, bit); + regmap_update_bits(regmap, MVEBU_SYS_SOFT_RST_REG, bit, bit); + + while (1) + ; A comment before this endless loop might be helpful here. + + return 0; +} + +static struct sysreset_ops mvebu_sysreset_ops = { + .request = mvebu_sysreset_request, +}; + +U_BOOT_DRI
Re: [PATCH u-boot-mvebu v3 10/18] arm: mvebu: system-controller: Select mvebu-reset if DM_RESET && PCI_MVEBU
On 3/27/24 17:23, Marek Behún wrote: The mvebu-reset driver is only needed by the mvebu PCIe driver, but currently it is automatically selected if DM_RESET is enabled. Add the condition of PCI_MVEBU also being enabled for mvebu-reset to be selected. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- arch/arm/mach-mvebu/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 62a2bc5958..623432a60e 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -18,7 +18,7 @@ config ARMADA_32BIT select TOOLS_KWBIMAGE if SPL select SPL_SYS_NO_VECTOR_TABLE if SPL select ARCH_VERY_EARLY_INIT - select ARMADA_32BIT_SYSCON_RESET if DM_RESET + select ARMADA_32BIT_SYSCON_RESET if DM_RESET && PCI_MVEBU # ARMv7 SoCs... config ARMADA_375 Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-mvebu v3 09/18] arm: mvebu: system-controller: Rework to use UCLASS_SYSCON
On 3/27/24 17:23, Marek Behún wrote: The system-controller driver for 32-bit Armada is currently registered as UCLASS_RESET, since it only provides enabling/disabling PCIe ports. Rework it as UCLASS_SYSCON and bind mvebu-reset as a child device. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- arch/arm/mach-mvebu/Kconfig | 11 arch/arm/mach-mvebu/Makefile| 2 +- arch/arm/mach-mvebu/system-controller.c | 76 ++--- 3 files changed, 54 insertions(+), 35 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 2058c95ca2..62a2bc5958 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -18,6 +18,7 @@ config ARMADA_32BIT select TOOLS_KWBIMAGE if SPL select SPL_SYS_NO_VECTOR_TABLE if SPL select ARCH_VERY_EARLY_INIT + select ARMADA_32BIT_SYSCON_RESET if DM_RESET # ARMv7 SoCs... config ARMADA_375 @@ -456,6 +457,16 @@ config SF_DEFAULT_MODE default 0x0 depends on MVEBU_SPL_BOOT_DEVICE_SPI +config ARMADA_32BIT_SYSCON_RESET + bool "Support Armada XP/375/38x/39x reset controller" + depends on ARMADA_32BIT + depends on DM_RESET + select REGMAP + select SYSCON + help + Build support for Armada XP/375/38x/39x reset controller. This is + needed for PCIe support. + source "board/solidrun/clearfog/Kconfig" source "board/kobol/helios4/Kconfig" diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index ef790d97fe..d44ca3a0df 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile @@ -28,7 +28,7 @@ obj-$(CONFIG_ARMADA_38X) += ../../../drivers/ddr/marvell/a38x/xor.o obj-$(CONFIG_ARMADA_XP) += ../../../drivers/ddr/marvell/axp/xor.o obj-$(CONFIG_ARMADA_MSYS) += ../../../drivers/ddr/marvell/axp/xor.o -obj-$(CONFIG_DM_RESET) += system-controller.o +obj-$(CONFIG_ARMADA_32BIT_SYSCON_RESET) += system-controller.o ifdef CONFIG_ARMADA_38X obj-$(CONFIG_MVEBU_EFUSE) += efuse.o diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c index 7cdde11cbd..c5c05922f2 100644 --- a/arch/arm/mach-mvebu/system-controller.c +++ b/arch/arm/mach-mvebu/system-controller.c @@ -1,19 +1,21 @@ // SPDX-License-Identifier: GPL-2.0+ -// (C) 2021 Pali Rohár +/* + * Copyright (C) 2021 Pali Rohár + * Copyright (C) 2024 Marek Behún + */ #include #include +#include +#include #include +#include #include #define MVEBU_SOC_CONTROL_1_REG 0x4 #define MVEBU_PCIE_ID 0 -struct mvebu_reset_data { - void *base; -}; - static int mvebu_reset_of_xlate(struct reset_ctl *rst, struct ofnode_phandle_args *args) { @@ -46,46 +48,33 @@ static int mvebu_reset_free(struct reset_ctl *rst) static int mvebu_reset_assert(struct reset_ctl *rst) { - struct mvebu_reset_data *data = dev_get_priv(rst->dev); + struct regmap *regmap = syscon_get_regmap(rst->dev->parent); - clrbits_32(data->base + MVEBU_SOC_CONTROL_1_REG, BIT(rst->data)); - return 0; + return regmap_update_bits(regmap, MVEBU_SOC_CONTROL_1_REG, + BIT(rst->data), 0); } static int mvebu_reset_deassert(struct reset_ctl *rst) { - struct mvebu_reset_data *data = dev_get_priv(rst->dev); + struct regmap *regmap = syscon_get_regmap(rst->dev->parent); - setbits_32(data->base + MVEBU_SOC_CONTROL_1_REG, BIT(rst->data)); - return 0; + return regmap_update_bits(regmap, MVEBU_SOC_CONTROL_1_REG, + BIT(rst->data), BIT(rst->data)); } static int mvebu_reset_status(struct reset_ctl *rst) { - struct mvebu_reset_data *data = dev_get_priv(rst->dev); + struct regmap *regmap = syscon_get_regmap(rst->dev->parent); + uint val; + int ret; - return !(readl(data->base + MVEBU_SOC_CONTROL_1_REG) & BIT(rst->data)); -} - -static int mvebu_reset_of_to_plat(struct udevice *dev) -{ - struct mvebu_reset_data *data = dev_get_priv(dev); + ret = regmap_read(regmap, MVEBU_SOC_CONTROL_1_REG, &val); + if (ret < 0) + return ret; - data->base = dev_read_addr_ptr(dev); - if (!data->base) - return -EINVAL; - - return 0; + return !(val & BIT(rst->data)); } -static const struct udevice_id mvebu_reset_of_match[] = { - { .compatible = "marvell,armada-370-xp-system-controller" }, - { .compatible = "marvell,armada-375-system-controller" }, - { .compatible = "marvell,armada-380-system-controller" }, - { .compatible = "marvell,armada-390-system-controller" }, - { }, -}; - static const struct reset_ops mvebu_reset_ops =
Re: [PATCH u-boot-mvebu v3 08/18] arm: mvebu: spl: Do not build mvebu-reset in SPL
On 3/27/24 17:23, Marek Behún wrote: Commit 35e29e89a386 ("arm: mvebu: Implement simple mvebu-reset driver for enabling/disabling PCIe ports") made it so that the mvebu reset driver for enabling/disabling PCIe ports is build if CONFIG_DM_RESET is enabled. This is because PCI_MVEBU depends on DM_RESET. But the driver should not be built for SPL. Indeed the PCI_MVEBU driver is not supported in SPL now, and so the mvebu-reset driver is not needed. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- arch/arm/mach-mvebu/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index 0584ed2be5..ef790d97fe 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile @@ -22,13 +22,14 @@ else # CONFIG_ARCH_KIRKWOOD obj-y = cpu.o obj-y += dram.o obj-y += lowlevel.o -obj-$(CONFIG_DM_RESET) += system-controller.o ifndef CONFIG_SPL_BUILD obj-$(CONFIG_ARMADA_375) += ../../../drivers/ddr/marvell/axp/xor.o obj-$(CONFIG_ARMADA_38X) += ../../../drivers/ddr/marvell/a38x/xor.o obj-$(CONFIG_ARMADA_XP) += ../../../drivers/ddr/marvell/axp/xor.o obj-$(CONFIG_ARMADA_MSYS) += ../../../drivers/ddr/marvell/axp/xor.o +obj-$(CONFIG_DM_RESET) += system-controller.o + ifdef CONFIG_ARMADA_38X obj-$(CONFIG_MVEBU_EFUSE) += efuse.o endif Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-mvebu v3 07/18] arm: mvebu: turris_omnia: Disable Atmel SHA node if not present
On 3/27/24 17:23, Marek Behún wrote: If the FEAT_CRYPTO feature bit is present in MCU features, the board crypto is implemented by MCU and the Atmel SHA chip is not present. Disable Atmel SHA device-tree node in that case. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- board/CZ.NIC/turris_omnia/turris_omnia.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index b2f0088e5e..3b7a71bdad 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -1007,6 +1007,25 @@ static int fixup_mcu_gpio_in_eth_wan_node(void *blob) return 0; } +static void fixup_atsha_node(void *blob) +{ + int node; + + if (!omnia_mcu_has_feature(FEAT_CRYPTO)) + return; + + node = fdt_node_offset_by_compatible(blob, -1, "atmel,atsha204a"); + if (node < 0) { + printf("Cannot find ATSHA204A node!\n"); + return; + } + + if (fdt_status_disabled(blob, node) < 0) + printf("Cannot disable ATSHA204A node!\n"); + else + debug("Disabled ATSHA204A node\n"); +} + #endif #if IS_ENABLED(CONFIG_OF_BOARD_FIXUP) @@ -1020,6 +1039,8 @@ int board_fix_fdt(void *blob) fixup_msata_port_nodes(blob); fixup_wwan_port_nodes(blob); + fixup_atsha_node(blob); + return 0; } #endif @@ -1211,6 +1232,8 @@ int ft_board_setup(void *blob, struct bd_info *bd) fixup_msata_port_nodes(blob); fixup_wwan_port_nodes(blob); + fixup_atsha_node(blob); + return 0; } #endif Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-mvebu v3 06/18] arm: mvebu: turris_omnia: Print board ECDSA public key if available
On 3/27/24 17:23, Marek Behún wrote: If MCU supports the FEAT_CRYPTO feature, read board ECDSA public key from MCU and print it. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- board/CZ.NIC/turris_omnia/turris_omnia.c | 25 +++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index f63640ad64..b2f0088e5e 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -253,6 +253,24 @@ static int omnia_mcu_board_info(char *serial, u8 *mac, char *version) return 0; } +static int omnia_mcu_get_board_public_key(char pub_key[static 67]) +{ + u8 reply[34]; + int ret; + + ret = omnia_mcu_read(CMD_CRYPTO_GET_PUBLIC_KEY, reply, sizeof(reply)); + if (ret) + return ret; + + if (reply[0] != 33) + return -EBADMSG; + + bin2hex(pub_key, &reply[1], 33); + pub_key[66] = '\0'; + + return 0; +} + static void enable_a385_watchdog(unsigned int timeout_minutes) { struct sar_freq_modes sar_freq; @@ -1032,7 +1050,7 @@ int board_late_init(void) int checkboard(void) { - char serial[17], version[4]; + char serial[17], version[4], pub_key[67]; bool has_version; int err; @@ -1051,6 +1069,11 @@ int checkboard(void) printf(" Board version: %s\n", has_version ? version : "unknown"); printf(" Serial Number: %s\n", !err ? serial : "unknown"); + if (omnia_mcu_has_feature(FEAT_CRYPTO)) { + err = omnia_mcu_get_board_public_key(pub_key); + printf(" ECDSA Public Key: %s\n", !err ? pub_key : "unknown"); + } + return 0; } Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-mvebu v3 05/18] arm: mvebu: turris_omnia: Implement getting board information from MCU
On 3/27/24 17:23, Marek Behún wrote: Implement reading board serial number, first MAC address and board version from MCU. MCU supports board information if the FEAT_BOARD_INFO feature bit is set in MCU features. Prefer getting board information from MCU if supported, fallback to Atmel SHA chip. Signed-off-by: Marek Behún Minor comment below. Other than this: Reviewed-by: Stefan Roese Thanks, Stefan --- board/CZ.NIC/turris_atsha_otp.c | 27 +-- board/CZ.NIC/turris_omnia/Makefile | 2 +- board/CZ.NIC/turris_omnia/turris_omnia.c | 94 +++- 3 files changed, 93 insertions(+), 30 deletions(-) diff --git a/board/CZ.NIC/turris_atsha_otp.c b/board/CZ.NIC/turris_atsha_otp.c index a29fe36231..85eebcdf18 100644 --- a/board/CZ.NIC/turris_atsha_otp.c +++ b/board/CZ.NIC/turris_atsha_otp.c @@ -11,6 +11,7 @@ #include #include "turris_atsha_otp.h" +#include "turris_common.h" #define TURRIS_ATSHA_OTP_VERSION 0 #define TURRIS_ATSHA_OTP_SERIAL 1 @@ -32,26 +33,6 @@ static struct udevice *get_atsha204a_dev(void) return dev; } -static void increment_mac(u8 *mac) -{ - int i; - - for (i = 5; i >= 3; i--) { - mac[i] += 1; - if (mac[i]) - break; - } -} - -static void set_mac_if_invalid(int i, u8 *mac) -{ - u8 oldmac[6]; - - if (is_valid_ethaddr(mac) && - !eth_env_get_enetaddr_by_index("eth", i, oldmac)) - eth_env_set_enetaddr_by_index("eth", i, mac); -} - int turris_atsha_otp_init_mac_addresses(int first_idx) { struct udevice *dev = get_atsha204a_dev(); @@ -84,11 +65,7 @@ int turris_atsha_otp_init_mac_addresses(int first_idx) mac[4] = mac1[2]; mac[5] = mac1[3]; - set_mac_if_invalid((first_idx + 0) % 3, mac); - increment_mac(mac); - set_mac_if_invalid((first_idx + 1) % 3, mac); - increment_mac(mac); - set_mac_if_invalid((first_idx + 2) % 3, mac); + turris_init_mac_addresses(first_idx, mac); return 0; } diff --git a/board/CZ.NIC/turris_omnia/Makefile b/board/CZ.NIC/turris_omnia/Makefile index dc39b44ae1..341378b4e5 100644 --- a/board/CZ.NIC/turris_omnia/Makefile +++ b/board/CZ.NIC/turris_omnia/Makefile @@ -2,4 +2,4 @@ # # Copyright (C) 2017 Marek Behún -obj-y := turris_omnia.o ../turris_atsha_otp.o +obj-y := turris_omnia.o ../turris_atsha_otp.o ../turris_common.o diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 6dfde5ee7a..f63640ad64 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -25,12 +26,14 @@ #include #include #include +#include #include #include #include "../drivers/ddr/marvell/a38x/ddr3_init.h" #include <../serdes/a38x/high_speed_env_spec.h> #include "../turris_atsha_otp.h" +#include "../turris_common.h" DECLARE_GLOBAL_DATA_PTR; @@ -186,6 +189,70 @@ static bool omnia_mcu_has_feature(u32 feature) return feature & features; } +static u32 omnia_mcu_crc32(const void *p, size_t len) +{ + u32 val, crc = 0; + + compiletime_assert(!(len % 4), "length has to be a multiple of 4"); + + while (len) { + val = bitrev32(get_unaligned_le32(p)); + crc = crc32(crc, (void *)&val, 4); + p += 4; + len -= 4; + } + + return ~bitrev32(crc); +} + +/* Can only be called after relocation, since it needs cleared BSS */ +static int omnia_mcu_board_info(char *serial, u8 *mac, char *version) +{ + static u8 reply[17]; + static bool cached; + + if (!cached) { + u8 csum; + int ret; + + ret = omnia_mcu_read(CMD_BOARD_INFO_GET, reply, sizeof(reply)); + if (ret) + return ret; + + if (reply[0] != 16) + return -EBADMSG; + + csum = reply[16]; + reply[16] = 0; + + if ((omnia_mcu_crc32(&reply[1], 16) & 0xff) != csum) + return -EBADMSG; + + cached = true; + } + + if (serial) { + const char *serial_env; + + serial_env = env_get("serial#"); + if (serial_env && strlen(serial_env) == 16) { + strcpy(serial, serial_env); Usage of strcpy() is discouraged AFAIK. + } else { + sprintf(serial, "%016llX", + get_unaligned_le64(&reply[1])); + env_set("serial#", serial); + } + } + + if (mac) +
Re: [PATCH u-boot-mvebu v3 04/18] arm: mvebu: turris_omnia: Update MCU status and features reading
On 3/27/24 17:23, Marek Behún wrote: Refactor MCU status word and MCU firmware features reading to make it simpler to use. Try reading 32 bits of features, if that fails, read 16 bits. Older MCU firmware supports only 16-bit wide features, and if more bytes are read, either 0xff is sent or I2C transaction fails. Handle both cases. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- board/CZ.NIC/turris_omnia/turris_omnia.c | 100 +++ 1 file changed, 68 insertions(+), 32 deletions(-) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 87e33d88c4..6dfde5ee7a 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -133,6 +133,59 @@ static int omnia_mcu_write(u8 cmd, const void *buf, int len) return dm_i2c_write(chip, cmd, buf, len); } +static int omnia_mcu_get_sts_and_features(u16 *psts, u32 *pfeatures) +{ + u16 sts, feat16; + int ret; + + ret = omnia_mcu_read(CMD_GET_STATUS_WORD, &sts, sizeof(sts)); + if (ret) + return ret; + + if (psts) + *psts = sts; + + if (!pfeatures) + return 0; + + if (sts & STS_FEATURES_SUPPORTED) { + /* try read 32-bit features */ + ret = omnia_mcu_read(CMD_GET_FEATURES, pfeatures, +sizeof(*pfeatures)); + if (ret) { + /* try read 16-bit features */ + ret = omnia_mcu_read(CMD_GET_FEATURES, &feat16, +sizeof(&feat16)); + if (ret) + return ret; + + *pfeatures = feat16; + } else { + if (*pfeatures & FEAT_FROM_BIT_16_INVALID) + *pfeatures &= GENMASK(15, 0); + } + } else { + *pfeatures = 0; + } + + return 0; +} + +static int omnia_mcu_get_sts(u16 *sts) +{ + return omnia_mcu_get_sts_and_features(sts, NULL); +} + +static bool omnia_mcu_has_feature(u32 feature) +{ + u32 features; + + if (omnia_mcu_get_sts_and_features(NULL, &features)) + return false; + + return feature & features; +} + static void enable_a385_watchdog(unsigned int timeout_minutes) { struct sar_freq_modes sar_freq; @@ -194,7 +247,7 @@ static bool disable_mcu_watchdog(void) static bool omnia_detect_sata(const char *msata_slot) { int ret; - u16 stsword; + u16 sts; puts("MiniPCIe/mSATA card detection... "); @@ -210,24 +263,24 @@ static bool omnia_detect_sata(const char *msata_slot) } } - ret = omnia_mcu_read(CMD_GET_STATUS_WORD, &stsword, sizeof(stsword)); + ret = omnia_mcu_get_sts(&sts); if (ret) { printf("omnia_mcu_read failed: %i, defaulting to MiniPCIe card\n", ret); return false; } - if (!(stsword & STS_CARD_DET)) { + if (!(sts & STS_CARD_DET)) { puts("none\n"); return false; } - if (stsword & STS_MSATA_IND) + if (sts & STS_MSATA_IND) puts("mSATA\n"); else puts("MiniPCIe\n"); - return stsword & STS_MSATA_IND; + return sts & STS_MSATA_IND; } static bool omnia_detect_wwan_usb3(const char *wwan_slot) @@ -355,14 +408,14 @@ static int omnia_get_ram_size_gb(void) static const char * const omnia_get_mcu_type(void) { static char result[] = "xxx (with peripheral resets)"; - u16 stsword, features; + u16 sts; int ret; - ret = omnia_mcu_read(CMD_GET_STATUS_WORD, &stsword, sizeof(stsword)); + ret = omnia_mcu_get_sts(&sts); if (ret) return "unknown"; - switch (stsword & STS_MCU_TYPE_MASK) { + switch (sts & STS_MCU_TYPE_MASK) { case STS_MCU_TYPE_STM32: strcpy(result, "STM32"); break; @@ -377,11 +430,8 @@ static const char * const omnia_get_mcu_type(void) break; } - if (stsword & STS_FEATURES_SUPPORTED) { - ret = omnia_mcu_read(CMD_GET_FEATURES, &features, sizeof(features)); - if (ret == 0 && (features & FEAT_PERIPH_MCU)) - strcat(result, " (with peripheral resets)"); - } + if (omnia_mcu_has_feature(FEAT_PERIPH_MCU)) + strcat(result, " (with peripheral resets)"); return result; } @@ -660,9 +710,6 @@ int board_early_init_f(void) void spl_board_init(void) { - u16 val; - int ret; - /*
Re: [PATCH u-boot-mvebu v3 03/18] arm: mvebu: turris_{omnia, mox}: Don't print model two times
On 3/27/24 17:23, Marek Behún wrote: Since commit 8cd4bf7dc9ba ("turris: Use checkboard() instead of show_board_info()") the model is show two times during boot: Model: Turris Omnia Model: Turris Omnia This is because the common function show_board_info() shows it, and Turris' checkboard() also does. Remove the second print. Fixes: 8cd4bf7dc9ba ("turris: Use checkboard() instead of show_board_info()") Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- board/CZ.NIC/turris_mox/turris_mox.c | 5 + board/CZ.NIC/turris_omnia/turris_omnia.c | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c index 3489bdd74b..1a2f60e3d1 100644 --- a/board/CZ.NIC/turris_mox/turris_mox.c +++ b/board/CZ.NIC/turris_mox/turris_mox.c @@ -565,13 +565,10 @@ static void handle_reset_button(void) int checkboard(void) { int i, ret, board_version, ram_size, is_sd; - const char *pub_key, *model; + const char *pub_key; const u8 *topology; u64 serial_number; - model = fdt_getprop(gd->fdt_blob, 0, "model", NULL); - printf("Model: %s\n", model); - ret = mbox_sp_get_board_info(&serial_number, NULL, NULL, &board_version, &ram_size, NULL); if (ret < 0) { diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 6c2d7da528..87e33d88c4 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -933,7 +933,6 @@ int checkboard(void) int err; err = turris_atsha_otp_get_serial_number(serial); - printf("Model: Turris Omnia\n"); printf(" MCU type: %s\n", omnia_get_mcu_type()); printf(" MCU version: %s\n", omnia_get_mcu_version()); printf(" RAM size: %i MiB\n", omnia_get_ram_size_gb() * 1024); Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 u-boot-mvebu v3 02/18] arm: mvebu: turris_omnia: Add header containing MCU command interface and use it
On 3/27/24 17:23, Marek Behún wrote: Add header containing all MCU command definitions and use it in board code and in MCU driver. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- board/CZ.NIC/turris_omnia/turris_omnia.c | 81 +++- drivers/gpio/turris_omnia_mcu.c | 54 + include/turris-omnia-mcu-interface.h | 248 +++ 3 files changed, 272 insertions(+), 111 deletions(-) create mode 100644 include/turris-omnia-mcu-interface.h diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index adeb69a205..6c2d7da528 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -59,46 +60,6 @@ DECLARE_GLOBAL_DATA_PTR; #define A385_WD_RSTOUT_UNMASK MVEBU_REGISTER(0x20704) #define A385_WD_RSTOUT_UNMASK_GLOBALBIT(8) -enum mcu_commands { - CMD_GET_STATUS_WORD = 0x01, - CMD_GET_RESET = 0x09, - CMD_GET_FW_VERSION_APP = 0x0a, - CMD_WATCHDOG_STATE = 0x0b, - CMD_GET_FW_VERSION_BOOT = 0x0e, - - /* available if STS_FEATURES_SUPPORTED bit set in status word */ - CMD_GET_FEATURES= 0x10, - - /* available if EXT_CMD bit set in features */ - CMD_EXT_CONTROL = 0x12, -}; - -enum status_word_bits { - STS_MCU_TYPE_MASK = GENMASK(1, 0), - STS_MCU_TYPE_STM32 = 0, - STS_MCU_TYPE_GD32 = 1, - STS_MCU_TYPE_MKL= 2, - STS_MCU_TYPE_UNKN = 3, - STS_FEATURES_SUPPORTED = BIT(2), - CARD_DET_STSBIT = 0x0010, - MSATA_IND_STSBIT= 0x0020, -}; - -/* CMD_GET_FEATURES */ -enum features_e { - FEAT_PERIPH_MCU = BIT(0), - FEAT_EXT_CMDS = BIT(1), -}; - -/* CMD_EXT_CONTROL */ -enum ext_ctl_e { - EXT_CTL_nRES_LAN= BIT(1), - EXT_CTL_nRES_PHY= BIT(2), - EXT_CTL_nPERST0 = BIT(3), - EXT_CTL_nPERST1 = BIT(4), - EXT_CTL_nPERST2 = BIT(5), -}; - /* * Those values and defines are taken from the Marvell U-Boot version * "u-boot-2013.01-2014_T3.0" @@ -219,7 +180,7 @@ static bool disable_mcu_watchdog(void) puts("Disabling MCU watchdog... "); - ret = omnia_mcu_write(CMD_WATCHDOG_STATE, "\x00", 1); + ret = omnia_mcu_write(CMD_SET_WATCHDOG_STATE, "\x00", 1); if (ret) { printf("omnia_mcu_write failed: %i\n", ret); return false; @@ -256,17 +217,17 @@ static bool omnia_detect_sata(const char *msata_slot) return false; } - if (!(stsword & CARD_DET_STSBIT)) { + if (!(stsword & STS_CARD_DET)) { puts("none\n"); return false; } - if (stsword & MSATA_IND_STSBIT) + if (stsword & STS_MSATA_IND) puts("mSATA\n"); else puts("MiniPCIe\n"); - return stsword & MSATA_IND_STSBIT ? true : false; + return stsword & STS_MSATA_IND; } static bool omnia_detect_wwan_usb3(const char *wwan_slot) @@ -393,18 +354,7 @@ static int omnia_get_ram_size_gb(void) static const char * const omnia_get_mcu_type(void) { - static const char * const mcu_types[] = { - [STS_MCU_TYPE_STM32] = "STM32", - [STS_MCU_TYPE_GD32] = "GD32", - [STS_MCU_TYPE_MKL] = "MKL", - [STS_MCU_TYPE_UNKN] = "unknown", - }; - static const char * const mcu_types_with_perip_resets[] = { - [STS_MCU_TYPE_STM32] = "STM32 (with peripheral resets)", - [STS_MCU_TYPE_GD32] = "GD32 (with peripheral resets)", - [STS_MCU_TYPE_MKL] = "MKL (with peripheral resets)", - [STS_MCU_TYPE_UNKN] = "unknown (with peripheral resets)", - }; + static char result[] = "xxx (with peripheral resets)"; u16 stsword, features; int ret; @@ -412,13 +362,28 @@ static const char * const omnia_get_mcu_type(void) if (ret) return "unknown"; + switch (stsword & STS_MCU_TYPE_MASK) { + case STS_MCU_TYPE_STM32: + strcpy(result, "STM32"); + break; + case STS_MCU_TYPE_GD32: + strcpy(result, "GD32"); + break; + case STS_MCU_TYPE_MKL: + strcpy(result, "MKL"); + break; + default: + strcpy(result, "unknown"); + break; + } + if (stsword & STS_FEATURES_SUPPORTED) { ret = omnia_mcu_read(CMD_GET_FEATU
Re: [PATCH u-boot-mvebu v3 01/18] arm: mvebu: turris_omnia: Enable LTO by default on Turris Omnia
On 3/27/24 17:23, Marek Behún wrote: U-Boot builds for Turris Omnia are approaching the limit of 0xf bytes, which is the size of the U-Boot partition on Omnia. Enable LTO to get more size optimized binaries. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan --- configs/turris_omnia_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index 29148402a1..39e15043df 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -31,6 +31,7 @@ CONFIG_AHCI=y CONFIG_OF_BOARD_FIXUP=y CONFIG_SYS_MEMTEST_START=0x0080 CONFIG_SYS_MEMTEST_END=0x00ff +CONFIG_LTO=y CONFIG_HAS_BOARD_SIZE_LIMIT=y CONFIG_BOARD_SIZE_LIMIT=983040 CONFIG_FIT=y Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter 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 v2] arm: dts: kirkwood: Enable upstream DT on Kirkwood boards
Hi Tony, On 3/28/24 08:41, Michael Walle wrote: Hi, On Thu Mar 28, 2024 at 3:18 AM CET, Tony Dinh wrote: Enable OF_UPSTREAM to use upstream DT and add marvell/ prefix to the DEFAULT_DEVICE_TREE for Kirkwood boards. And so we can directly build DTBs from dts/upstream/src/arm/marvell, and including *-u-boot.dtsi files from arch/arm/dts/ directory. Background: Hi Stefan, Hi Michael, I did a survey and we currently have 28 Kirkwood boards. Using some commands and filters, here are the finding. git grep -li arch_kirkwood configs | xargs grep DEVICE_TREE | cut -d '"' -f2 | xargs -n1 sh -c 'diff -qs arch/arm/dts/$1.dts dts/upstream/src/arm/marvell/$1.dts' sh | grep differ diff: dts/upstream/src/arm/marvell/kirkwood-atl-sbx81lifkw.dts: No such file or directory diff: dts/upstream/src/arm/marvell/kirkwood-atl-sbx81lifxcat.dts: No such file or directory ... Are you sure you want to have all this text in the commit log? This is also my concern. Even though I love descriptive commit messages, this seems to be a bit too much IMHO. Not sure if and how to get these findings of yours archived otherwise. You seem to have forgotten my tag: Tested-by: Michael Walle # on lschv2 Tony, many thanks to work on this consolidation. Very impressive results. I can't test anything of this though, but my plan would be to pull this in the upcoming merge window, if nobody complains. Reviewed-by: Stefan Roese Thanks, Stefan
Re: [PATCH v2 0/3] dt-bindings: arm: bcm: raspberrypi,bcm2835-firmware: Drive-by fixes
Hi, [add Peter and Ivan] Am 26.03.24 um 20:58 schrieb Laurent Pinchart: Hello, This small series includes a few drive-by fixes for DT validation errors. The first patch has been posted previously in v1 ([1], and now addresses a small review comment. I think it's good to go. The next two patches address the same issue as "[PATCH 1/2] dt-bindings: arm: bcm: raspberrypi,bcm2835-firmware: Add missing properties" ([2]), but this time with a (hopefully) correct approach. Patch 2/3 starts by fixing the raspberrypi-bcm2835-firmware driver, removing the need for DT properties that are specified in bcm2835-rpi.dtsi but not documented in the corresponding bindings. Patch 3/3 can then drop those properties, getting rid of the warnings. since this series drops properties from the device tree, does anyone have the chance to test it with a recent U-Boot? [1] https://lore.kernel.org/linux-arm-kernel/20240326004902.17054-3-laurent.pinch...@ideasonboard.com/ [2] https://lore.kernel.org/linux-arm-kernel/20240326004902.17054-2-laurent.pinch...@ideasonboard.com/ Laurent Pinchart (3): dt-bindings: arm: bcm: raspberrypi,bcm2835-firmware: Add gpio child node firmware: raspberrypi: Use correct device for DMA mappings ARM: dts: bcm283x: Drop unneeded properties in the bcm2835-firmware node .../arm/bcm/raspberrypi,bcm2835-firmware.yaml | 30 +++ .../gpio/raspberrypi,firmware-gpio.txt| 30 --- arch/arm/boot/dts/broadcom/bcm2835-rpi.dtsi | 4 --- drivers/firmware/raspberrypi.c| 7 +++-- 4 files changed, 34 insertions(+), 37 deletions(-) delete mode 100644 Documentation/devicetree/bindings/gpio/raspberrypi,firmware-gpio.txt
Please pull u-boot-marvell/master
Hi Tom, please pull this next batch of mostly Marvell related patches: - net: mv88e6xxx: fix missing SMI address initialization (Marek) - mvebu: turris_omnia: Enable networking via ethernet switch (Marek) - mvebu: helios-4: add config fragment for spi booting et al (Josua) - rng: Add Turris Mox rTWM RNG driver (Max) Here the Azure build, without any issues: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=341&view=results Thanks, Stefan The following changes since commit 773cb2bca7743406e34ab4f441fc0a8a0d200a19: Merge tag 'u-boot-imx-master-20240304' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx (2024-03-04 15:41:38 -0500) are available in the Git repository at: g...@source.denx.de:u-boot/custodians/u-boot-marvell.git for you to fetch changes up to d61b485dbd766970816ae9da09004dc4b30f8395: rng: Add Turris Mox rTWM RNG driver (2024-03-05 08:27:59 +0100) Josua Mayer (3): arm: dts: armada-38x-solidrun-microsom: configure i2c0 bus arm: mvebu: helios4_defconfig: enable setexpr command board: helios-4: add config fragment for spi booting Marek Mojík (2): net: mv88e6xxx: fix missing SMI address initialization arm: mvebu: turris_omnia: Enable networking via ethernet switch Max Resch (1): rng: Add Turris Mox rTWM RNG driver arch/arm/dts/armada-385-turris-omnia-u-boot.dtsi | 51 ++ arch/arm/dts/armada-38x-solidrun-microsom.dtsi | 5 + board/kobol/helios4/spiboot.config | 4 + configs/helios4_defconfig| 1 - configs/turris_omnia_defconfig | 2 + drivers/net/mv88e6xxx.c | 8 ++ drivers/rng/Kconfig | 8 ++ drivers/rng/Makefile | 1 + drivers/rng/turris_rwtm_rng.c| 123 +++ 9 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 board/kobol/helios4/spiboot.config create mode 100644 drivers/rng/turris_rwtm_rng.c
Re: [PATCH v5] rng: Add Turris Mox rTWM RNG driver
On 2/15/24 17:57, Max Resch wrote: A RNG driver for Armada 3720 boards running the Turris Mox rWTM firmware from CZ.NIC in the secure processor. Signed-off-by: Max Resch Applied to u-boot-marvell/master Thanks, Stefan --- Changes in v5: - check return code turris_rwtm_rng_fill_entropy - remove empty line Changes in v4: - wrongful/missing git rebase Changes in v3: - More meaningful variable names in accordance with review Changes in v2: - Removed ring buffer implementation drivers/rng/Kconfig | 8 +++ drivers/rng/Makefile | 1 + drivers/rng/turris_rwtm_rng.c | 123 ++ 3 files changed, 132 insertions(+) create mode 100644 drivers/rng/turris_rwtm_rng.c diff --git a/drivers/rng/Kconfig b/drivers/rng/Kconfig index a89c899568..cd72852a47 100644 --- a/drivers/rng/Kconfig +++ b/drivers/rng/Kconfig @@ -105,4 +105,12 @@ config RNG_JH7110 help Enable True Random Number Generator in StarFive JH7110 SoCs. +config RNG_TURRIS_RWTM + bool "Turris Mox TRNG in Secure Processor" + depends on DM_RNG && ARMADA_3700 + help + Use TRNG in Turris Mox Secure Processor Firmware. Can be used + on other Armada-3700 devices (like EspressoBin) if Secure + Firmware from CZ.NIC is used. + endif diff --git a/drivers/rng/Makefile b/drivers/rng/Makefile index 7e64c4cdfc..ecae1a3da3 100644 --- a/drivers/rng/Makefile +++ b/drivers/rng/Makefile @@ -17,3 +17,4 @@ obj-$(CONFIG_RNG_SMCCC_TRNG) += smccc_trng.o obj-$(CONFIG_RNG_ARM_RNDR) += arm_rndr.o obj-$(CONFIG_TPM_RNG) += tpm_rng.o obj-$(CONFIG_RNG_JH7110) += jh7110_rng.o +obj-$(CONFIG_RNG_TURRIS_RWTM) += turris_rwtm_rng.o diff --git a/drivers/rng/turris_rwtm_rng.c b/drivers/rng/turris_rwtm_rng.c new file mode 100644 index 00..ca808c4579 --- /dev/null +++ b/drivers/rng/turris_rwtm_rng.c @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause +/* + * Copyright (c) 2024, Max Resch + */ + +#include +#include +#include +#include +#include +#include + +/* size of entropy buffer */ +#define RNG_BUFFER_SIZE128U + +struct turris_rwtm_rng_priv { + phys_addr_t buffer; +}; + +static int turris_rwtm_rng_fill_entropy(phys_addr_t entropy, size_t size) +{ + u32 args[3] = { 1, (u32)entropy, size }; + int ret; + + /* flush data cache */ + flush_dcache_range(entropy, entropy + size); + + /* +* get entropy +* args[0] = 1 copies BYTES array in args[1] of length args[2] +*/ + ret = mbox_do_cmd(MBOX_CMD_GET_RANDOM, args, 3, NULL, 0); + if (ret < 0) + return ret; + + /* invalidate data cache */ + invalidate_dcache_range(entropy, entropy + size); + + return 0; +} + +static int turris_rwtm_rng_random_read(struct udevice *dev, void *data, size_t count) +{ + struct turris_rwtm_rng_priv *priv = dev_get_priv(dev); + phys_addr_t phys; + size_t size; + int ret; + + phys = priv->buffer; + + while (count) { + size = min_t(size_t, RNG_BUFFER_SIZE, count); + + ret = turris_rwtm_rng_fill_entropy(phys, size); + if (ret < 0) + return ret; + + memcpy(data, (void *)phys, size); + count -= size; + data = (u8 *)data + size; + } + + return 0; +} + +static int turris_rwtm_rng_probe(struct udevice *dev) +{ + struct turris_rwtm_rng_priv *priv = dev_get_priv(dev); + u32 args[] = { 0 }; + int ret; + + /* +* check if the random command is supported +* args[0] = 0 would copy 16 DWORDS entropy to out but we ignore them +*/ + ret = mbox_do_cmd(MBOX_CMD_GET_RANDOM, args, ARRAY_SIZE(args), NULL, 0); + if (ret < 0) + return ret; + + /* entropy buffer */ + priv->buffer = 0; + + /* buffer address need to be aligned */ + dma_alloc_coherent(RNG_BUFFER_SIZE, (unsigned long *)&priv->buffer); + if (!priv->buffer) + return -ENOMEM; + + return 0; +} + +static int turris_rwtm_rng_remove(struct udevice *dev) +{ + struct turris_rwtm_rng_priv *priv = dev_get_priv(dev); + phys_addr_t phys = priv->buffer; + + dma_free_coherent((void *)phys); + + return 0; +} + +static const struct dm_rng_ops turris_rwtm_rng_ops = { + .read = turris_rwtm_rng_random_read, +}; + +/* + * only Turris MOX firmware has the RNG but allow all probable devices to be + * probed the default firmware will just reject the probe + */ +static const struct udevice_id turris_rwtm_rng_match[] = { + { .compatible = "cznic,turris-mox-rwtm" }, + { .compatible = "marvell,armada-3700-rwtm-firmware" }, + {}, +}; + +U_BOOT_DRIVER(turris_rwtm_rng) = { + .name = "turris-rwtm-rng", + .