Re: [PATCH v3 00/15] ARM: at91: skov-arm9cpu (SAM9263) first stage support

2024-02-15 Thread Sam Ravnborg
Hi Ahmad, On Thu, Feb 15, 2024 at 05:29:54PM +0100, Ahmad Fatoum wrote: > SDRAM setup and SD-Card chainloading support were previously added[1] > by Sam as well as a WIP patch to enable them for Skov ARM9CPU. > > I reworked his final WIP patch and fixed some smaller and bigger issues > that I ran

Re: [PATCH v3 11/15] ARM: at91: skov-arm9cpu: Add SD-Card xload support

2024-02-15 Thread Sam Ravnborg
Hi Ahmad, On Thu, Feb 15, 2024 at 05:30:05PM +0100, Ahmad Fatoum wrote: > From: Sam Ravnborg > > This updates skov-arm9cpu with xload support, and we can now > use barebox as a replacement for at91bootstrap > > Only boot via SD card is supported. > > Signed-off-by: Sam Ravnborg > Signed-off-b

[PATCH v3 15/15] usb: ohci-at91: fix possible hang chainloading barebox

2024-02-15 Thread Ahmad Fatoum
barebox, like Linux, will consider disabling parents when disabling a child clock. In the AT91 OHCI driver ported to barebox from Linux, this leads to the USB clock shutdown during device shutdown to propagate up to PLLB, which is also disabled. On probe of the kernel driver, the USB clock rate is

[PATCH v3 13/15] ARM: at91: skov-arm9cpu: configure more appropriate hostname

2024-02-15 Thread Ahmad Fatoum
The default logic would set the hostname to arm9-cpu, which isn't very descriptive. Set our own hostname that contains the vendor name. Signed-off-by: Ahmad Fatoum --- v3: - new patch --- arch/arm/boards/skov-arm9cpu/board.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boards

[PATCH v3 11/15] ARM: at91: skov-arm9cpu: Add SD-Card xload support

2024-02-15 Thread Ahmad Fatoum
From: Sam Ravnborg This updates skov-arm9cpu with xload support, and we can now use barebox as a replacement for at91bootstrap Only boot via SD card is supported. Signed-off-by: Sam Ravnborg Signed-off-by: Ahmad Fatoum --- v2 -> v3: - rename skov-arm9cpu-xload.img to skov-arm9cpu-xload-mmc.

[PATCH v3 12/15] ARM: at91: skov-arm9cpu: configure SMC for NOR flash use

2024-02-15 Thread Ahmad Fatoum
Deployed ARM9CPU's boots from NOR, not NAND. Replace the EBI NAND configuration taken from the EK with one appropriate for the NOR chip we have. As this needs to happen earlier than the cfi-flash driver probe, we also move the board code to coredevice initlevel. Signed-off-by: Ahmad Fatoum --- v

[PATCH v3 14/15] ARM: AT91: skov-arm9cpu: support environment on SD-Card

2024-02-15 Thread Ahmad Fatoum
barebox is meant to boot from SD-Card on this platform, so support a barebox environment in this case for easier handling. Signed-off-by: Ahmad Fatoum --- v3: - new patch --- arch/arm/boards/skov-arm9cpu/board.c | 8 arch/arm/dts/at91-skov-arm9cpu.dts | 6 ++ 2 files changed, 14

[PATCH v3 10/15] ARM: dts: AT91: skov-arm9cpu: remove barebox environment on NOR

2024-02-15 Thread Ahmad Fatoum
The NOR-Flash for ARM9CPUs in the field has U-Boot, so it's not a good idea to overwrite its environment with barebox'. We'll add a SD-Card environment for barebox in recovery case in a later commit, but for now remove the NOR flash environment footgun. Signed-off-by: Ahmad Fatoum --- v3: - new

[PATCH v3 05/15] ARM: at91: implement SAM9_ENTRY_FUNCTION

2024-02-15 Thread Ahmad Fatoum
An On-chip SRAM is available at address 0x0030 on all SAM9x variants, so let's define a macro that sets up the stack to grow down from its end. This will be useful for first stage barebox running without previously setup stack. Signed-off-by: Ahmad Fatoum --- v3: - new patch --- include/ma

[PATCH v3 02/15] mci: atmel_mci: fix zeroing of block length on AT91SAM9263

2024-02-15 Thread Ahmad Fatoum
We don't read back ATMCI_MR, but instead set up the value once and keep writing it on every reset. On the SAM9263, but not on the later SAM9x5, the ATMCI_MR register also includes a field for the block length. Not taking that into account means that we zero the block length on every reset. While t

[PATCH v3 07/15] ARM: at91: sam9263_ll: pass AT91_PMC_LL_AT91SAM9263 to PMC functions

2024-02-15 Thread Ahmad Fatoum
The low level PMC driver does things differently according to its flags parameter that encodes what SoC is being used. The default case of flags == 0 is appropriate for the AT91SAM9263, but we have a AT91_PMC_LL_AT91SAM9263 macro that expands to 0, which makes apparent that we take the necessary pr

[PATCH v3 09/15] ARM: at91: sam9263_ll: support configuration of PLLB

2024-02-15 Thread Ahmad Fatoum
PLLB may be used as input to derive the USB's 48 MHz clock. PLLA is already being setup by currently unused sam9263_lowlevel_init(), so add an extra parameter for PLLB as well. While at it, we change the API of sam9263_lowlevel_init(): AT91Bootstrap code has PLLA_SETTINGS and PLLB_SETTINGS as hex

[PATCH v3 08/15] ARM: at91: sam9263_ll: refactor MCK switch to PLLA for clarity

2024-02-15 Thread Ahmad Fatoum
Duplicating the bits being written to configure the MCK harms readability, so factor that out into a new variable to make clear the bits that change between the two calls to at91_pmc_cfg_mck(). Signed-off-by: Ahmad Fatoum --- v3: - new patch --- arch/arm/mach-at91/sam9263_ll.c | 14 ---

[PATCH v3 04/15] ARM: at91: use AT91 header instead of generic barebox ARM's

2024-02-15 Thread Ahmad Fatoum
Prior to the multi-arch (really multi-platform) rework, ENTRY_FUNCTION used to be overrideable according to selected machine/SoC family. Now that there is no single selected family, board code needs to be explicit in choosing the SoC-appropriate ENTRY_FUNCTION. This was done for nearly all AT91 boa

[PATCH v3 00/15] ARM: at91: skov-arm9cpu (SAM9263) first stage support

2024-02-15 Thread Ahmad Fatoum
SDRAM setup and SD-Card chainloading support were previously added[1] by Sam as well as a WIP patch to enable them for Skov ARM9CPU. I reworked his final WIP patch and fixed some smaller and bigger issues that I ran into. Now barebox can replace at91bootstrap on this platform when booted from SD.

[PATCH v3 01/15] mci: atmel_mci: disable power save mode

2024-02-15 Thread Ahmad Fatoum
Power saving mode will clock down the MCI clock according to the value of the PWSDIV (Power Saving Divider) field of the mode register. No where in Linux or barebox do we set a value for PWSDIV however, so the safe thing to do is disabling power saving mode. This aligns barebox with what AT91Boot

[PATCH v3 03/15] ARM: replace ENTRY_FUNCTION_HEAD with ENTRY_FUNCTION_WITHSTACK_HEAD

2024-02-15 Thread Ahmad Fatoum
To allow SoC-specific entry functions that don't replicate the code in ENTRY_FUNCTION, we provide a helper macro that support specifying a custom HEAD, but only on arm32. Make this macro private by prefixing with __ and implement the superset ENTRY_FUNCTION_WITHSTACK_HEAD for both arm32 and arm64 t

[PATCH v3 06/15] ARM: at91: sam9263_ll: drop PLL charge pump initialization

2024-02-15 Thread Ahmad Fatoum
The datasheet[1] described the PLL Charge Pump Current Register in 27.9.17 very sparingly by mandating that 0x10001 is to be written into it. In the 28-Jan-16 revision of the datasheet the access mode for the register was changed from Write-only to Read/Write. Indeed reading the register is possib

Re: barebox environment raw partition on beaglebone black

2024-02-15 Thread Lars Pedersen
Hi Ahmad On Thu, 15 Feb 2024 at 14:47, Ahmad Fatoum wrote: > > Hi Lars, > > On 15.02.24 14:01, Lars Pedersen wrote: > > Hi. > > > > I'm trying to create a barebox environment by using af emmc a raw > > partition offset on the beaglebone black. > > > > For testing I appended the following into am3

Re: barebox environment raw partition on beaglebone black

2024-02-15 Thread Ahmad Fatoum
Hi Lars, On 15.02.24 14:01, Lars Pedersen wrote: > Hi. > > I'm trying to create a barebox environment by using af emmc a raw > partition offset on the beaglebone black. > > For testing I appended the following into am33x-boneblack.dts. > > / { > chosen { > environment { >

barebox environment raw partition on beaglebone black

2024-02-15 Thread Lars Pedersen
Hi. I'm trying to create a barebox environment by using af emmc a raw partition offset on the beaglebone black. For testing I appended the following into am33x-boneblack.dts. / { chosen { environment { compatible = "barebox,environment"; device-path = &environ

Re: [PATCH 0/7] Detect partition changes at runtime

2024-02-15 Thread Marco Felsch
Hi Sascha, On 24-02-15, Sascha Hauer wrote: > With this series barebox can detect partition table changes at runtime > and reparse the partition table in that case. With this it's possible > for example to write an image to a SD card and mount partitions directly > afterwards without restarting ba

Re: [PATCH 4/7] block: reparse partition table when necessary

2024-02-15 Thread Marco Felsch
On 24-02-15, Sascha Hauer wrote: > Call reparse_partition_table() when the partition table may have > changed. We detect this by recording if the block device has been > written to in the area where the partition table is. > > Signed-off-by: Sascha Hauer > --- > common/block.c | 30

Re: [PATCH 7/7] fastboot: evaluate fastboot partitions when used

2024-02-15 Thread Marco Felsch
On 24-02-15, Sascha Hauer wrote: > So far we have evaluated the fastboot partition description during > initialization of the fastboot gadget. Let's make this more flexible > and parse it when actually needed. > This gives us the possibility to first write an image including a > partition table to

[PATCH 0/3] clk: at91: sync drivers with Linux

2024-02-15 Thread Ahmad Fatoum
During bug hunt of a clocking issue that ultimately turned out to be unrelated, I resynced AT91 clk support with Linux. The changes look more extensive than they really are, because I first imported the clock drivers before a major overhaul of the barebox clock framework to be more compatible with

[PATCH 2/3] clk: define empty stub for clk_hw_unregister

2024-02-15 Thread Ahmad Fatoum
We don't do clk unregistration and thus define clk_unregister as empty stub. Let's do likewise for clk_hw_unregister. Signed-off-by: Ahmad Fatoum --- include/linux/clk.h | 4 1 file changed, 4 insertions(+) diff --git a/include/linux/clk.h b/include/linux/clk.h index d76f175bbd49..25bba3e9

[PATCH 1/3] clk: add dummy definitions for CLK_SET_RATE_GATE, CLK_SET_PARENT_GATE

2024-02-15 Thread Ahmad Fatoum
CLK_SET_RATE_GATE and CLK_SET_PARENT_GATE mean that the clk itself or its parent, respectively, needs to be gated before attempting a set rate. If this is not the case, the operation would fail in Linux with -EBUSY. The usual way this is ported to barebox is by just omitting the flag, because a we

[PATCH 1/1] mci: bcm2835: support 8bit bus width

2024-02-15 Thread Pierre-Olivier Huard
Using Raspberry Pi CM4s target generate a warning: WARNING: bcm2835_mci fe34@7e34.of: Unsupported width received: 3 mmc0: mci_send_ext_csd failed with -5 Adding the support of 8 bits bus width resolve the issue. Signed-off-by: Pierre-Olivier Huard --- drivers/mci/mci-bcm2835.c | 7

[PATCH 1/1] ARM: dts: rpi4: add DT for CM4S

2024-02-15 Thread Pierre-Olivier Huard
CM4S is close to the CM4, and thus is herited from it, with some minor changes: * The uart1 node (mini UART) does not need the clock to be forced to 500MHz. * The compatible field needs to be updated to match the CM4S There is still an issue with the dwc2 driver in timeout. Boot log: Board: Ra

Re: [PATCH 3/7] partition: allow to reparse a partition table

2024-02-15 Thread Marco Felsch
On 24-02-15, Sascha Hauer wrote: > The partition table of a block device may change when it is written to. > Allow to reparse the partition table when this happens. > This is easy when none of the partitions is opened, in that case just > remove the old partitions and call parse_partition_table() a

[PATCH 2/3] drivers: drop simple bus remove in favor of common implementation

2024-02-15 Thread Ahmad Fatoum
Now that driver core will call dev->driver->remove if dev->bus->remove is NULL, we cann remove all bus_type::remove functions that do the same. This has the welcome side effect that devices that device_remove will return false when called on a device the neither has a bus remove or driver remove f

[PATCH 1/3] driver: make CONFIG_DEBUG_PROBES more useful for removal

2024-02-15 Thread Ahmad Fatoum
When CONFIG_DEBUG_PROBES is enabled, barebox will print a message on every device probe and removal. Unfortunately, the removal prints are not very useful, because the removal happens in the bus remove function, which is often a no-op, but that's not known to driver core. To make this a bit more u

[PATCH 3/3] firmware: arm_scmi: call device driver remove if defined

2024-02-15 Thread Ahmad Fatoum
We don't have SCMI driver remove callbacks like Linux does, so scmi_bus_type.remove is just an empty function. As no SCMI driver in barebox populates its remove callback, we can just replace this empty implementation by the default one of calling driver::remove. This has the added benefit that the

Re: [PATCH 0/6] implement i.MX93 AHAB secure boot

2024-02-15 Thread Marco Felsch
On 24-02-15, Sascha Hauer wrote: > On Wed, Feb 14, 2024 at 07:09:16PM +0100, Ahmad Fatoum wrote: > > Hello Sascha, > > > > On 13.02.24 16:17, Sascha Hauer wrote: > > > This adds support for AHAB based secure boot on i.MX93. The user > > > interface is integrated into the existing hab command used

Re: [PATCH 0/6] implement i.MX93 AHAB secure boot

2024-02-15 Thread Sascha Hauer
On Thu, Feb 15, 2024 at 09:29:38AM +0100, Ahmad Fatoum wrote: > Hello Sascha, > > On 15.02.24 09:17, Sascha Hauer wrote: > > On Wed, Feb 14, 2024 at 07:09:16PM +0100, Ahmad Fatoum wrote: > >> Could you make the signing inside the barebox build system optional > >> for HAB? Then we could have a pro

Re: [PATCH 0/7] Detect partition changes at runtime

2024-02-15 Thread Ahmad Fatoum
Hello Sascha, On 15.02.24 08:47, Sascha Hauer wrote: > With this series barebox can detect partition table changes at runtime > and reparse the partition table in that case. With this it's possible > for example to write an image to a SD card and mount partitions directly > afterwards without rest

Re: [PATCH 0/6] implement i.MX93 AHAB secure boot

2024-02-15 Thread Ahmad Fatoum
Hello Sascha, On 15.02.24 09:17, Sascha Hauer wrote: > On Wed, Feb 14, 2024 at 07:09:16PM +0100, Ahmad Fatoum wrote: >> Could you make the signing inside the barebox build system optional >> for HAB? Then we could have a prompt symbol that depends on HABv4, e.g. >> CONFIG_HAB_SIGN_IMAGES or someth

Re: [PATCH 0/6] implement i.MX93 AHAB secure boot

2024-02-15 Thread Sascha Hauer
On Wed, Feb 14, 2024 at 07:09:16PM +0100, Ahmad Fatoum wrote: > Hello Sascha, > > On 13.02.24 16:17, Sascha Hauer wrote: > > This adds support for AHAB based secure boot on i.MX93. The user > > interface is integrated into the existing hab command used for ealier > > i.MX variants. On i.MX93 the h