[PATCH v2 0/7] Enable Cubieboard A10 boot SPL from SD card

Strahinja Jankovic posted 7 patches 1 year, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20221218211918.3592-1-strahinja.p.jankovic@gmail.com
Maintainers: Beniamino Galvani <b.galvani@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Niek Linnenbank <nieklinnenbank@gmail.com>
There is a newer version of this series
docs/system/arm/cubieboard.rst        |   1 +
docs/system/arm/orangepi.rst          |   1 +
hw/arm/Kconfig                        |   5 +
hw/arm/allwinner-a10.c                |  40 +++
hw/arm/allwinner-h3.c                 |  11 +-
hw/arm/cubieboard.c                   |  11 +
hw/i2c/Kconfig                        |   4 +
hw/i2c/allwinner-i2c.c                | 459 ++++++++++++++++++++++++++
hw/i2c/meson.build                    |   1 +
hw/i2c/trace-events                   |   5 +
hw/misc/Kconfig                       |  10 +
hw/misc/allwinner-a10-ccm.c           | 224 +++++++++++++
hw/misc/allwinner-a10-dramc.c         | 179 ++++++++++
hw/misc/allwinner-axp-209.c           | 238 +++++++++++++
hw/misc/meson.build                   |   3 +
hw/misc/trace-events                  |   5 +
include/hw/arm/allwinner-a10.h        |  27 ++
include/hw/arm/allwinner-h3.h         |   3 +
include/hw/i2c/allwinner-i2c.h        |  55 +++
include/hw/misc/allwinner-a10-ccm.h   |  67 ++++
include/hw/misc/allwinner-a10-dramc.h |  68 ++++
21 files changed, 1416 insertions(+), 1 deletion(-)
create mode 100644 hw/i2c/allwinner-i2c.c
create mode 100644 hw/misc/allwinner-a10-ccm.c
create mode 100644 hw/misc/allwinner-a10-dramc.c
create mode 100644 hw/misc/allwinner-axp-209.c
create mode 100644 include/hw/i2c/allwinner-i2c.h
create mode 100644 include/hw/misc/allwinner-a10-ccm.h
create mode 100644 include/hw/misc/allwinner-a10-dramc.h
[PATCH v2 0/7] Enable Cubieboard A10 boot SPL from SD card
Posted by Strahinja Jankovic 1 year, 4 months ago
This patch series adds missing Allwinner A10 modules needed for
successful SPL boot:
- Clock controller module
- DRAM controller
- I2C0 controller (added also for Allwinner H3 since it is the same)
- AXP-209 connected to I2C0 bus

It also updates Allwinner A10 emulation so SPL is copied from attached
SD card if `-kernel` parameter is not passed when starting QEMU
(approach adapted from Allwinner H3 implementation).

Boot from SD card has been tested with Cubieboard Armbian SD card image and custom
Yocto image built for Cubieboard.
Example usage for Armbian image:
qemu-system-arm -M cubieboard -nographic -sd ~/Armbian_22.11.0-trunk_Cubieboard_kinetic_edge_6.0.7.img

v2 from v1:
* replaced DB_PRINTF with tracing functions
* removed .init function in AXP209 since .reset covers functionality
* moved defines to allwinner_i2c.c from header file
* updated docs with information about TWI
* minor code style fixes

Strahinja Jankovic (7):
  hw/misc: Allwinner-A10 Clock Controller Module Emulation
  hw/misc: Allwinner A10 DRAM Controller Emulation
  hw/i2c: Allwinner TWI/I2C Emulation
  hw/misc: Allwinner AXP-209 Emulation
  hw/arm: Add AXP-209 to Cubieboard
  hw/arm: Allwinner A10 enable SPL load from MMC
  docs/system/arm: Update Allwinner with TWI (I2C)

 docs/system/arm/cubieboard.rst        |   1 +
 docs/system/arm/orangepi.rst          |   1 +
 hw/arm/Kconfig                        |   5 +
 hw/arm/allwinner-a10.c                |  40 +++
 hw/arm/allwinner-h3.c                 |  11 +-
 hw/arm/cubieboard.c                   |  11 +
 hw/i2c/Kconfig                        |   4 +
 hw/i2c/allwinner-i2c.c                | 459 ++++++++++++++++++++++++++
 hw/i2c/meson.build                    |   1 +
 hw/i2c/trace-events                   |   5 +
 hw/misc/Kconfig                       |  10 +
 hw/misc/allwinner-a10-ccm.c           | 224 +++++++++++++
 hw/misc/allwinner-a10-dramc.c         | 179 ++++++++++
 hw/misc/allwinner-axp-209.c           | 238 +++++++++++++
 hw/misc/meson.build                   |   3 +
 hw/misc/trace-events                  |   5 +
 include/hw/arm/allwinner-a10.h        |  27 ++
 include/hw/arm/allwinner-h3.h         |   3 +
 include/hw/i2c/allwinner-i2c.h        |  55 +++
 include/hw/misc/allwinner-a10-ccm.h   |  67 ++++
 include/hw/misc/allwinner-a10-dramc.h |  68 ++++
 21 files changed, 1416 insertions(+), 1 deletion(-)
 create mode 100644 hw/i2c/allwinner-i2c.c
 create mode 100644 hw/misc/allwinner-a10-ccm.c
 create mode 100644 hw/misc/allwinner-a10-dramc.c
 create mode 100644 hw/misc/allwinner-axp-209.c
 create mode 100644 include/hw/i2c/allwinner-i2c.h
 create mode 100644 include/hw/misc/allwinner-a10-ccm.h
 create mode 100644 include/hw/misc/allwinner-a10-dramc.h

-- 
2.30.2
Re: [PATCH v2 0/7] Enable Cubieboard A10 boot SPL from SD card
Posted by Philippe Mathieu-Daudé 1 year, 4 months ago
On 18/12/22 22:19, Strahinja Jankovic wrote:
> This patch series adds missing Allwinner A10 modules needed for
> successful SPL boot:
> - Clock controller module
> - DRAM controller
> - I2C0 controller (added also for Allwinner H3 since it is the same)
> - AXP-209 connected to I2C0 bus
> 
> It also updates Allwinner A10 emulation so SPL is copied from attached
> SD card if `-kernel` parameter is not passed when starting QEMU
> (approach adapted from Allwinner H3 implementation).
> 
> Boot from SD card has been tested with Cubieboard Armbian SD card image and custom
> Yocto image built for Cubieboard.
> Example usage for Armbian image:
> qemu-system-arm -M cubieboard -nographic -sd ~/Armbian_22.11.0-trunk_Cubieboard_kinetic_edge_6.0.7.img

As a follow-up, could you add a test similar to
test_arm_orangepi_bionic_20_08() in tests/avocado/boot_linux_console.py?

This test could be refactored as do_test_arm_allwinner_armbian(), called
for orangepi and cubieboard with the corresponding url / hash.
Re: [PATCH v2 0/7] Enable Cubieboard A10 boot SPL from SD card
Posted by Strahinja Jankovic 1 year, 4 months ago
Hi,


On Sun, Dec 18, 2022 at 11:17 PM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> On 18/12/22 22:19, Strahinja Jankovic wrote:
> > This patch series adds missing Allwinner A10 modules needed for
> > successful SPL boot:
> > - Clock controller module
> > - DRAM controller
> > - I2C0 controller (added also for Allwinner H3 since it is the same)
> > - AXP-209 connected to I2C0 bus
> >
> > It also updates Allwinner A10 emulation so SPL is copied from attached
> > SD card if `-kernel` parameter is not passed when starting QEMU
> > (approach adapted from Allwinner H3 implementation).
> >
> > Boot from SD card has been tested with Cubieboard Armbian SD card image and custom
> > Yocto image built for Cubieboard.
> > Example usage for Armbian image:
> > qemu-system-arm -M cubieboard -nographic -sd ~/Armbian_22.11.0-trunk_Cubieboard_kinetic_edge_6.0.7.img
>
> As a follow-up, could you add a test similar to
> test_arm_orangepi_bionic_20_08() in tests/avocado/boot_linux_console.py?
>
> This test could be refactored as do_test_arm_allwinner_armbian(), called
> for orangepi and cubieboard with the corresponding url / hash.

I was planning to do it (I already have a patch for cubieboard), but
there is a problem with finding a stable-enough image for cubieboard
for automated testing.
Unfortunately, Cubieboard does not have supported Armbian images as
OrangePi-PC has (it only has weekly builds). From the images that can
be found on archive.armbian.com, there is only one bionic image
(21.02) and it won't boot because it hangs due to the musb issue (I
tried both with my patches and without, by extracting
kernel/dtb/initrd). Other images are focal, but for some reason, in
those images it is impossible to interrupt U-Boot (tested with 21.08),
so I could not append to bootcmd to make boot process more verbose and
easier to monitor for automated testing.

That is why, for now, I would suggest not updating the SPL/SD boot
test for Cubieboard.

Best regards,
Strahinja
Re: [PATCH v2 0/7] Enable Cubieboard A10 boot SPL from SD card
Posted by Strahinja Jankovic 1 year, 4 months ago
Hi,

I just looked around a bit more. Would OpenWrt image be acceptable?
It looks like there are releases for cubieboard that are kept for a
longer time, and I just checked that they work properly, so I could
add them to the acceptance test.

Best regards,
Strahinja

On Sun, Dec 18, 2022 at 11:34 PM Strahinja Jankovic
<strahinjapjankovic@gmail.com> wrote:
>
> Hi,
>
>
> On Sun, Dec 18, 2022 at 11:17 PM Philippe Mathieu-Daudé
> <philmd@linaro.org> wrote:
> >
> > On 18/12/22 22:19, Strahinja Jankovic wrote:
> > > This patch series adds missing Allwinner A10 modules needed for
> > > successful SPL boot:
> > > - Clock controller module
> > > - DRAM controller
> > > - I2C0 controller (added also for Allwinner H3 since it is the same)
> > > - AXP-209 connected to I2C0 bus
> > >
> > > It also updates Allwinner A10 emulation so SPL is copied from attached
> > > SD card if `-kernel` parameter is not passed when starting QEMU
> > > (approach adapted from Allwinner H3 implementation).
> > >
> > > Boot from SD card has been tested with Cubieboard Armbian SD card image and custom
> > > Yocto image built for Cubieboard.
> > > Example usage for Armbian image:
> > > qemu-system-arm -M cubieboard -nographic -sd ~/Armbian_22.11.0-trunk_Cubieboard_kinetic_edge_6.0.7.img
> >
> > As a follow-up, could you add a test similar to
> > test_arm_orangepi_bionic_20_08() in tests/avocado/boot_linux_console.py?
> >
> > This test could be refactored as do_test_arm_allwinner_armbian(), called
> > for orangepi and cubieboard with the corresponding url / hash.
>
> I was planning to do it (I already have a patch for cubieboard), but
> there is a problem with finding a stable-enough image for cubieboard
> for automated testing.
> Unfortunately, Cubieboard does not have supported Armbian images as
> OrangePi-PC has (it only has weekly builds). From the images that can
> be found on archive.armbian.com, there is only one bionic image
> (21.02) and it won't boot because it hangs due to the musb issue (I
> tried both with my patches and without, by extracting
> kernel/dtb/initrd). Other images are focal, but for some reason, in
> those images it is impossible to interrupt U-Boot (tested with 21.08),
> so I could not append to bootcmd to make boot process more verbose and
> easier to monitor for automated testing.
>
> That is why, for now, I would suggest not updating the SPL/SD boot
> test for Cubieboard.
>
> Best regards,
> Strahinja
Re: [PATCH v2 0/7] Enable Cubieboard A10 boot SPL from SD card
Posted by Philippe Mathieu-Daudé 1 year, 4 months ago
On 18/12/22 23:57, Strahinja Jankovic wrote:
> Hi,
> 
> I just looked around a bit more. Would OpenWrt image be acceptable?

Sure.

> It looks like there are releases for cubieboard that are kept for a
> longer time, and I just checked that they work properly, so I could
> add them to the acceptance test.
> 
> Best regards,
> Strahinja
> 
> On Sun, Dec 18, 2022 at 11:34 PM Strahinja Jankovic
> <strahinjapjankovic@gmail.com> wrote:
>>
>> Hi,
>>
>>
>> On Sun, Dec 18, 2022 at 11:17 PM Philippe Mathieu-Daudé
>> <philmd@linaro.org> wrote:
>>>
>>> On 18/12/22 22:19, Strahinja Jankovic wrote:
>>>> This patch series adds missing Allwinner A10 modules needed for
>>>> successful SPL boot:
>>>> - Clock controller module
>>>> - DRAM controller
>>>> - I2C0 controller (added also for Allwinner H3 since it is the same)
>>>> - AXP-209 connected to I2C0 bus
>>>>
>>>> It also updates Allwinner A10 emulation so SPL is copied from attached
>>>> SD card if `-kernel` parameter is not passed when starting QEMU
>>>> (approach adapted from Allwinner H3 implementation).
>>>>
>>>> Boot from SD card has been tested with Cubieboard Armbian SD card image and custom
>>>> Yocto image built for Cubieboard.
>>>> Example usage for Armbian image:
>>>> qemu-system-arm -M cubieboard -nographic -sd ~/Armbian_22.11.0-trunk_Cubieboard_kinetic_edge_6.0.7.img
>>>
>>> As a follow-up, could you add a test similar to
>>> test_arm_orangepi_bionic_20_08() in tests/avocado/boot_linux_console.py?
>>>
>>> This test could be refactored as do_test_arm_allwinner_armbian(), called
>>> for orangepi and cubieboard with the corresponding url / hash.
>>
>> I was planning to do it (I already have a patch for cubieboard), but
>> there is a problem with finding a stable-enough image for cubieboard
>> for automated testing.
>> Unfortunately, Cubieboard does not have supported Armbian images as
>> OrangePi-PC has (it only has weekly builds).

Developers shouldn't worry about that but focus on the testing. The
QEMU project doesn't have dedicated sysadmin / storage, but if it had
it should be their problem, not yours. Meanwhile such a test is still
useful. Artifacts come with their hash, so can be uploaded elsewhere
later.

>> From the images that can
>> be found on archive.armbian.com, there is only one bionic image
>> (21.02) and it won't boot because it hangs due to the musb issue (I
>> tried both with my patches and without, by extracting
>> kernel/dtb/initrd).

Similar approach:
https://lore.kernel.org/qemu-devel/20201018205551.1537927-4-f4bug@amsat.org/

>> Other images are focal, but for some reason, in
>> those images it is impossible to interrupt U-Boot (tested with 21.08),
>> so I could not append to bootcmd to make boot process more verbose and
>> easier to monitor for automated testing.
>>
>> That is why, for now, I would suggest not updating the SPL/SD boot
>> test for Cubieboard.

Niek can tell how many times his tests catched regressions for his
OrangePi machine; I remember at least 3 occasions :)

Regards,

Phil.

Re: [PATCH v2 0/7] Enable Cubieboard A10 boot SPL from SD card
Posted by Strahinja Jankovic 1 year, 4 months ago
Hi,

On Mon, Dec 19, 2022 at 8:11 AM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> On 18/12/22 23:57, Strahinja Jankovic wrote:
> > Hi,
> >
> > I just looked around a bit more. Would OpenWrt image be acceptable?
>
> Sure.
>
> > It looks like there are releases for cubieboard that are kept for a
> > longer time, and I just checked that they work properly, so I could
> > add them to the acceptance test.
> >
> > Best regards,
> > Strahinja
> >
> > On Sun, Dec 18, 2022 at 11:34 PM Strahinja Jankovic
> > <strahinjapjankovic@gmail.com> wrote:
> >>
> >> Hi,
> >>
> >>
> >> On Sun, Dec 18, 2022 at 11:17 PM Philippe Mathieu-Daudé
> >> <philmd@linaro.org> wrote:
> >>>
> >>> On 18/12/22 22:19, Strahinja Jankovic wrote:
> >>>> This patch series adds missing Allwinner A10 modules needed for
> >>>> successful SPL boot:
> >>>> - Clock controller module
> >>>> - DRAM controller
> >>>> - I2C0 controller (added also for Allwinner H3 since it is the same)
> >>>> - AXP-209 connected to I2C0 bus
> >>>>
> >>>> It also updates Allwinner A10 emulation so SPL is copied from attached
> >>>> SD card if `-kernel` parameter is not passed when starting QEMU
> >>>> (approach adapted from Allwinner H3 implementation).
> >>>>
> >>>> Boot from SD card has been tested with Cubieboard Armbian SD card image and custom
> >>>> Yocto image built for Cubieboard.
> >>>> Example usage for Armbian image:
> >>>> qemu-system-arm -M cubieboard -nographic -sd ~/Armbian_22.11.0-trunk_Cubieboard_kinetic_edge_6.0.7.img
> >>>
> >>> As a follow-up, could you add a test similar to
> >>> test_arm_orangepi_bionic_20_08() in tests/avocado/boot_linux_console.py?
> >>>
> >>> This test could be refactored as do_test_arm_allwinner_armbian(), called
> >>> for orangepi and cubieboard with the corresponding url / hash.
> >>
> >> I was planning to do it (I already have a patch for cubieboard), but
> >> there is a problem with finding a stable-enough image for cubieboard
> >> for automated testing.
> >> Unfortunately, Cubieboard does not have supported Armbian images as
> >> OrangePi-PC has (it only has weekly builds).
>
> Developers shouldn't worry about that but focus on the testing. The
> QEMU project doesn't have dedicated sysadmin / storage, but if it had
> it should be their problem, not yours. Meanwhile such a test is still
> useful. Artifacts come with their hash, so can be uploaded elsewhere
> later.
>
> >> From the images that can
> >> be found on archive.armbian.com, there is only one bionic image
> >> (21.02) and it won't boot because it hangs due to the musb issue (I
> >> tried both with my patches and without, by extracting
> >> kernel/dtb/initrd).
>
> Similar approach:
> https://lore.kernel.org/qemu-devel/20201018205551.1537927-4-f4bug@amsat.org/
>
> >> Other images are focal, but for some reason, in
> >> those images it is impossible to interrupt U-Boot (tested with 21.08),
> >> so I could not append to bootcmd to make boot process more verbose and
> >> easier to monitor for automated testing.
> >>
> >> That is why, for now, I would suggest not updating the SPL/SD boot
> >> test for Cubieboard.
>
> Niek can tell how many times his tests catched regressions for his
> OrangePi machine; I remember at least 3 occasions :)

Thanks for the suggestions, I will add the SPL boot test and use
OpenWrt image for it.

Best regards,
Strahinja

>
> Regards,
>
> Phil.