Enable Cubieboard A10 boot SPL from SD card
Subsystems (2)
v2 cover Enable Cubieboard A10 boot SPL from SD card
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
Signature · 1 line
2.30.2
PATCH v2 1/7 hw/misc: Allwinner-A10 Clock Controller Module Emulation
During SPL boot several Clock Controller Module (CCM) registers are read, most important are PLL and Tuning, as well as divisor registers.
This patch adds these registers and initializes reset values from user's guide.
--- hw/arm/Kconfig | 1 + hw/arm/allwinner-a10.c | 7 + hw/misc/Kconfig | 3 + hw/misc/allwinner-a10-ccm.c | 224 ++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + include/hw/arm/allwinner-a10.h | 2 + include/hw/misc/allwinner-a10-ccm.h | 67 +++++++++ 7 files changed, 305 insertions(+) create mode 100644 hw/misc/allwinner-a10-ccm.c create mode 100644 include/hw/misc/allwinner-a10-ccm.h
hw/arm/Kconfig +1 -0
@@ -319,6 +319,7 @@ config ALLWINNER_A10 select AHCI select ALLWINNER_A10_PIT select ALLWINNER_A10_PIC + select ALLWINNER_A10_CCM select ALLWINNER_EMAC select SERIAL select UNIMP
hw/arm/allwinner-a10.c +7 -0
@@ -26,6 +26,7 @@#include "hw/usb/hcd-ohci.h" #define AW_A10_MMC0_BASE 0x01c0f000 +#define AW_A10_CCM_BASE 0x01c20000#define AW_A10_PIC_REG_BASE 0x01c20400#define AW_A10_PIT_REG_BASE 0x01c20c00#define AW_A10_UART0_REG_BASE 0x01c28000
@@ -46,6 +47,8 @@ static void aw_a10_init(Object *obj)object_initialize_child (obj,"timer" , &s->timer,TYPE_AW_A10_PIT ); +object_initialize_child (obj,"ccm" , &s->ccm,TYPE_AW_A10_CCM ); +object_initialize_child (obj,"emac" , &s->emac,TYPE_AW_EMAC );object_initialize_child (obj,"sata" , &s->sata,TYPE_ALLWINNER_AHCI );
@@ -103,6 +106,10 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)memory_region_add_subregion (get_system_memory (),0x00000000 , &s->sram_a);create_unimplemented_device ("a10-sram-ctrl" ,0x01c00000 ,4 * KiB); +/* Clock Control Module */ +sysbus_realize (SYS_BUS_DEVICE (&s->ccm), &error_fatal); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->ccm),0 ,AW_A10_CCM_BASE ); +/* FIXME use qdev NIC properties instead of nd_table[] */ if (nd_table[0 ].used) {qemu_check_nic_model (&nd_table[0 ],TYPE_AW_EMAC );
hw/misc/Kconfig +3 -0
@@ -174,4 +174,7 @@ config VIRT_CTRL config LASI bool +config ALLWINNER_A10_CCM + bool + source macio/Kconfig
hw/misc/allwinner-a10-ccm.c new file +224 -0
224 lines not on this page · raw message
hw/misc/meson.build +1 -0
@@ -38,6 +38,7 @@ subdir('macio') softmmu_ss.add(when: 'CONFIG_IVSHMEM_DEVICE', if_true: files('ivshmem.c')) +softmmu_ss.add(when: 'CONFIG_ALLWINNER_A10_CCM', if_true: files('allwinner-a10-ccm.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-ccu.c')) specific_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-cpucfg.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-dramc.c'))
include/hw/arm/allwinner-a10.h +2 -0
@@ -12,6 +12,7 @@#include "hw/usb/hcd-ohci.h" #include "hw/usb/hcd-ehci.h" #include "hw/rtc/allwinner-rtc.h" +#include "hw/misc/allwinner-a10-ccm.h" #include "target/arm/cpu.h" #include "qom/object.h"
@@ -30,6 +31,7 @@ struct AwA10State {/*< public >*/ ARMCPU cpu; +AwA10ClockCtlState ccm;AwA10PITState timer;AwA10PICState intc;AwEmacState emac;
include/hw/misc/allwinner-a10-ccm.h new file +67 -0
67 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v2 2/7 hw/misc: Allwinner A10 DRAM Controller Emulation
In reply to Strahinja JankovicDuring SPL boot several DRAM Controller registers are used. Most important registers are those related to DRAM initialization and calibration, where SPL initiates process and waits until certain bit is set/cleared.
This patch adds these registers, initializes reset values from user's guide and updates state of registers as SPL expects it.
--- hw/arm/Kconfig | 1 + hw/arm/allwinner-a10.c | 7 + hw/misc/Kconfig | 3 + hw/misc/allwinner-a10-dramc.c | 179 ++++++++++++++++++++++++++ hw/misc/meson.build | 1 + include/hw/arm/allwinner-a10.h | 2 + include/hw/misc/allwinner-a10-dramc.h | 68 ++++++++++ 7 files changed, 261 insertions(+) create mode 100644 hw/misc/allwinner-a10-dramc.c create mode 100644 include/hw/misc/allwinner-a10-dramc.h
hw/arm/Kconfig +1 -0
@@ -320,6 +320,7 @@ config ALLWINNER_A10 select ALLWINNER_A10_PIT select ALLWINNER_A10_PIC select ALLWINNER_A10_CCM + select ALLWINNER_A10_DRAMC select ALLWINNER_EMAC select SERIAL select UNIMP
hw/arm/allwinner-a10.c +7 -0
@@ -25,6 +25,7 @@#include "hw/boards.h" #include "hw/usb/hcd-ohci.h" +#define AW_A10_DRAMC_BASE 0x01c01000#define AW_A10_MMC0_BASE 0x01c0f000#define AW_A10_CCM_BASE 0x01c20000#define AW_A10_PIC_REG_BASE 0x01c20400
@@ -49,6 +50,8 @@ static void aw_a10_init(Object *obj)object_initialize_child (obj,"ccm" , &s->ccm,TYPE_AW_A10_CCM ); +object_initialize_child (obj,"dramc" , &s->dramc,TYPE_AW_A10_DRAMC ); +object_initialize_child (obj,"emac" , &s->emac,TYPE_AW_EMAC );object_initialize_child (obj,"sata" , &s->sata,TYPE_ALLWINNER_AHCI );
@@ -110,6 +113,10 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)sysbus_realize (SYS_BUS_DEVICE (&s->ccm), &error_fatal);sysbus_mmio_map (SYS_BUS_DEVICE (&s->ccm),0 ,AW_A10_CCM_BASE ); +/* DRAM Control Module */ +sysbus_realize (SYS_BUS_DEVICE (&s->dramc), &error_fatal); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->dramc),0 ,AW_A10_DRAMC_BASE ); +/* FIXME use qdev NIC properties instead of nd_table[] */ if (nd_table[0 ].used) {qemu_check_nic_model (&nd_table[0 ],TYPE_AW_EMAC );
hw/misc/Kconfig +3 -0
@@ -177,4 +177,7 @@ config LASI config ALLWINNER_A10_CCM bool +config ALLWINNER_A10_DRAMC + bool + source macio/Kconfig
hw/misc/allwinner-a10-dramc.c new file +179 -0
179 lines not on this page · raw message
hw/misc/meson.build +1 -0
@@ -39,6 +39,7 @@ subdir('macio') softmmu_ss.add(when: 'CONFIG_IVSHMEM_DEVICE', if_true: files('ivshmem.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_A10_CCM', if_true: files('allwinner-a10-ccm.c')) +softmmu_ss.add(when: 'CONFIG_ALLWINNER_A10_DRAMC', if_true: files('allwinner-a10-dramc.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-ccu.c')) specific_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-cpucfg.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-dramc.c'))
include/hw/arm/allwinner-a10.h +2 -0
@@ -13,6 +13,7 @@#include "hw/usb/hcd-ehci.h" #include "hw/rtc/allwinner-rtc.h" #include "hw/misc/allwinner-a10-ccm.h" +#include "hw/misc/allwinner-a10-dramc.h" #include "target/arm/cpu.h" #include "qom/object.h"
@@ -32,6 +33,7 @@ struct AwA10State {ARMCPU cpu;AwA10ClockCtlState ccm; +AwA10DramControllerState dramc;AwA10PITState timer;AwA10PICState intc;AwEmacState emac;
include/hw/misc/allwinner-a10-dramc.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v2 3/7 hw/i2c: Allwinner TWI/I2C Emulation
In reply to Strahinja JankovicThis patch implements Allwinner TWI/I2C controller emulation. Only master-mode functionality is implemented.
The SPL boot for Cubieboard expects AXP209 PMIC on TWI0/I2C0 bus, so this is first part enabling the TWI/I2C bus operation.
Since both Allwinner A10 and H3 use the same module, it is added for both boards.
--- hw/arm/Kconfig | 2 + hw/arm/allwinner-a10.c | 8 + hw/arm/allwinner-h3.c | 11 +- hw/i2c/Kconfig | 4 + hw/i2c/allwinner-i2c.c | 459 +++++++++++++++++++++++++++++++++ hw/i2c/meson.build | 1 + hw/i2c/trace-events | 5 + include/hw/arm/allwinner-a10.h | 2 + include/hw/arm/allwinner-h3.h | 3 + include/hw/i2c/allwinner-i2c.h | 55 ++++ 10 files changed, 549 insertions(+), 1 deletion(-) create mode 100644 hw/i2c/allwinner-i2c.c create mode 100644 include/hw/i2c/allwinner-i2c.h
hw/arm/Kconfig +2 -0
@@ -322,6 +322,7 @@ config ALLWINNER_A10 select ALLWINNER_A10_CCM select ALLWINNER_A10_DRAMC select ALLWINNER_EMAC + select ALLWINNER_I2C select SERIAL select UNIMP
@@ -329,6 +330,7 @@ config ALLWINNER_H3 bool select ALLWINNER_A10_PIT select ALLWINNER_SUN8I_EMAC + select ALLWINNER_I2C select SERIAL select ARM_TIMER select ARM_GIC
hw/arm/allwinner-a10.c +8 -0
@@ -36,6 +36,7 @@#define AW_A10_OHCI_BASE 0x01c14400#define AW_A10_SATA_BASE 0x01c18000#define AW_A10_RTC_BASE 0x01c20d00 +#define AW_A10_I2C0_BASE 0x01c2ac00static void aw_a10_init (Object *obj) {
@@ -56,6 +57,8 @@ static void aw_a10_init(Object *obj)object_initialize_child (obj,"sata" , &s->sata,TYPE_ALLWINNER_AHCI ); +object_initialize_child (obj,"i2c0" , &s->i2c0,TYPE_AW_I2C ); +if (machine_usb (current_machine)) {int i;
@@ -176,6 +179,11 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)/* RTC */ sysbus_realize (SYS_BUS_DEVICE (&s->rtc), &error_fatal);sysbus_mmio_map_overlap (SYS_BUS_DEVICE (&s->rtc),0 ,AW_A10_RTC_BASE ,10 ); + +/* I2C */ +sysbus_realize (SYS_BUS_DEVICE (&s->i2c0), &error_fatal); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->i2c0),0 ,AW_A10_I2C0_BASE ); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->i2c0),0 ,qdev_get_gpio_in (dev,7 )); }static void aw_a10_class_init (ObjectClass *oc,void *data)
hw/arm/allwinner-h3.c +10 -1
@@ -53,6 +53,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_DEV_UART1] = 0x01c28400, [AW_H3_DEV_UART2] = 0x01c28800, [AW_H3_DEV_UART3] = 0x01c28c00, + [AW_H3_DEV_TWI0] = 0x01c2ac00, [AW_H3_DEV_EMAC] = 0x01c30000, [AW_H3_DEV_DRAMCOM] = 0x01c62000, [AW_H3_DEV_DRAMCTL] = 0x01c63000,
@@ -106,7 +107,6 @@ struct AwH3Unimplemented { { "uart1", 0x01c28400, 1 * KiB }, { "uart2", 0x01c28800, 1 * KiB }, { "uart3", 0x01c28c00, 1 * KiB }, - { "twi0", 0x01c2ac00, 1 * KiB }, { "twi1", 0x01c2b000, 1 * KiB }, { "twi2", 0x01c2b400, 1 * KiB }, { "scr", 0x01c2c400, 1 * KiB },
@@ -150,6 +150,7 @@ enum {AW_H3_GIC_SPI_UART1 =1 ,AW_H3_GIC_SPI_UART2 =2 ,AW_H3_GIC_SPI_UART3 =3 , +AW_H3_GIC_SPI_TWI0 =6 ,AW_H3_GIC_SPI_TIMER0 =18 ,AW_H3_GIC_SPI_TIMER1 =19 , AW_H3_GIC_SPI_MMC0 = 60,
@@ -225,6 +226,8 @@ static void allwinner_h3_init(Object *obj) "ram-size");object_initialize_child (obj,"rtc" , &s->rtc,TYPE_AW_RTC_SUN6I ); + +object_initialize_child (obj,"twi0" , &s->i2c0,TYPE_AW_I2C ); }static void allwinner_h3_realize (DeviceState *dev,Error **errp)
@@ -423,6 +426,12 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp)sysbus_realize (SYS_BUS_DEVICE (&s->rtc), &error_fatal);sysbus_mmio_map (SYS_BUS_DEVICE (&s->rtc),0 , s->memmap[AW_H3_DEV_RTC ]); +/* I2C */ +sysbus_realize (SYS_BUS_DEVICE (&s->i2c0), &error_fatal); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->i2c0),0 , s->memmap[AW_H3_DEV_TWI0 ]); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->i2c0),0 , +qdev_get_gpio_in (DEVICE (&s->gic),AW_H3_GIC_SPI_TWI0 )); +/* Unimplemented devices */ for (i =0 ; i <ARRAY_SIZE (unimplemented); i++) { create_unimplemented_device(unimplemented[i].device_name,
hw/i2c/Kconfig +4 -0
@@ -34,6 +34,10 @@ config MPC_I2C bool select I2C +config ALLWINNER_I2C + bool + select I2C + config PCA954X bool select I2C
hw/i2c/allwinner-i2c.c new file +459 -0
459 lines not on this page · raw message
hw/i2c/meson.build +1 -0
@@ -8,6 +8,7 @@ i2c_ss.add(when: 'CONFIG_BITBANG_I2C', if_true: files('bitbang_i2c.c')) i2c_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4210_i2c.c')) i2c_ss.add(when: 'CONFIG_IMX_I2C', if_true: files('imx_i2c.c')) i2c_ss.add(when: 'CONFIG_MPC_I2C', if_true: files('mpc_i2c.c')) +i2c_ss.add(when: 'CONFIG_ALLWINNER_I2C', if_true: files('allwinner-i2c.c')) i2c_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('microbit_i2c.c')) i2c_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_smbus.c')) i2c_ss.add(when: 'CONFIG_SMBUS_EEPROM', if_true: files('smbus_eeprom.c'))
hw/i2c/trace-events +5 -0
@@ -8,6 +8,11 @@ i2c_send_async(uint8_t address, uint8_t data) "send_async(addr:0x%02x) data:0x%0 i2c_recv(uint8_t address, uint8_t data) "recv(addr:0x%02x) data:0x%02x" i2c_ack(void) "" +# allwinner_i2c.c + +allwinner_i2c_read(const char* reg_name, uint64_t offset, uint64_t value) "read %s [0x%" PRIx64 "]: -> 0x%" PRIx64 +allwinner_i2c_write(const char* reg_name, uint64_t offset, uint64_t value) "write %s [0x%" PRIx64 "]: <- 0x%" PRIx64 + # aspeed_i2c.c aspeed_i2c_bus_cmd(uint32_t cmd, const char *cmd_flags, uint32_t count, uint32_t intr_status) "handling cmd=0x%x %s count=%d intr=0x%x"
include/hw/arm/allwinner-a10.h +2 -0
@@ -14,6 +14,7 @@#include "hw/rtc/allwinner-rtc.h" #include "hw/misc/allwinner-a10-ccm.h" #include "hw/misc/allwinner-a10-dramc.h" +#include "hw/i2c/allwinner-i2c.h" #include "target/arm/cpu.h" #include "qom/object.h"
@@ -39,6 +40,7 @@ struct AwA10State {AwEmacState emac;AllwinnerAHCIState sata;AwSdHostState mmc0; +AWI2CState i2c0;AwRtcState rtc;MemoryRegion sram_a;EHCISysBusState ehci[AW_A10_NUM_USB ];
include/hw/arm/allwinner-h3.h +3 -0
@@ -47,6 +47,7 @@#include "hw/sd/allwinner-sdhost.h" #include "hw/net/allwinner-sun8i-emac.h" #include "hw/rtc/allwinner-rtc.h" +#include "hw/i2c/allwinner-i2c.h" #include "target/arm/cpu.h" #include "sysemu/block-backend.h"
@@ -82,6 +83,7 @@ enum {AW_H3_DEV_UART2 ,AW_H3_DEV_UART3 ,AW_H3_DEV_EMAC , +AW_H3_DEV_TWI0 ,AW_H3_DEV_DRAMCOM ,AW_H3_DEV_DRAMCTL , AW_H3_DEV_DRAMPHY,
@@ -130,6 +132,7 @@ struct AwH3State {AwH3SysCtrlState sysctrl;AwSidState sid;AwSdHostState mmc0; +AWI2CState i2c0;AwSun8iEmacState emac;AwRtcState rtc;GICState gic;
include/hw/i2c/allwinner-i2c.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v2 4/7 hw/misc: Allwinner AXP-209 Emulation
In reply to Strahinja JankovicThis patch adds minimal support for AXP-209 PMU.
Most important is chip ID since U-Boot SPL expects version 0x1. Besides the chip ID register, reset values for two more registers used by A10 U-Boot SPL are covered.
--- hw/arm/Kconfig | 1 + hw/misc/Kconfig | 4 + hw/misc/allwinner-axp-209.c | 238 ++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/trace-events | 5 + 5 files changed, 249 insertions(+) create mode 100644 hw/misc/allwinner-axp-209.c
hw/arm/Kconfig +1 -0
@@ -323,6 +323,7 @@ config ALLWINNER_A10 select ALLWINNER_A10_DRAMC select ALLWINNER_EMAC select ALLWINNER_I2C + select ALLWINNER_AXP_209 select SERIAL select UNIMP
hw/misc/Kconfig +4 -0
@@ -180,4 +180,8 @@ config ALLWINNER_A10_CCM config ALLWINNER_A10_DRAMC bool +config ALLWINNER_AXP_209 + bool + depends on I2C + source macio/Kconfig
hw/misc/allwinner-axp-209.c new file +238 -0
238 lines not on this page · raw message
hw/misc/meson.build +1 -0
@@ -40,6 +40,7 @@ softmmu_ss.add(when: 'CONFIG_IVSHMEM_DEVICE', if_true: files('ivshmem.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_A10_CCM', if_true: files('allwinner-a10-ccm.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_A10_DRAMC', if_true: files('allwinner-a10-dramc.c')) +softmmu_ss.add(when: 'CONFIG_ALLWINNER_AXP_209', if_true: files('allwinner-axp-209.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-ccu.c')) specific_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-cpucfg.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-dramc.c'))
hw/misc/trace-events +5 -0
@@ -1,5 +1,10 @@ # See docs/devel/tracing.rst for syntax documentation. +# allwinner-axp209.c +allwinner_axp_209_rx(uint8_t reg, uint8_t data) "Read reg 0x%" PRIx8 " : 0x%" PRIx8 +allwinner_axp_209_select(uint8_t reg) "Accessing reg 0x%" PRIx8 +allwinner_axp_209_tx(uint8_t reg, uint8_t data) "Write reg 0x%" PRIx8 " : 0x%" PRIx8 + # allwinner-cpucfg.c allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_addr 0x%" PRIx32 allwinner_cpucfg_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32
Signature · 1 line
2.30.2
Re: [PATCH v2 4/7] hw/misc: Allwinner AXP-209 Emulation
I forgot to add Philippe Mathieu-Daudé in CC for this patch, so I'm fixing it now.
Best regards,
Strahinja Jankovic
Quoted 315 lines · Strahinja Jankovic
This patch adds minimal support for AXP-209 PMU.
Most important is chip ID since U-Boot SPL expects version0x1. Besides the chip ID register, reset values for two more registers used by A10 U-Boot SPL are covered.Signed-off-by Strahinja Jankovic <[email protected]>--- hw/arm/Kconfig | 1 + hw/misc/Kconfig | 4 + hw/misc/allwinner-axp-209.c | 238 ++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/trace-events | 5 + 5 files changed, 249 insertions(+) create mode 100644 hw/misc/allwinner-axp-209.chw/arm/Kconfig +1
-0@@ -323,6 +323,7 @@ config ALLWINNER_A10 select ALLWINNER_A10_DRAMC select ALLWINNER_EMAC select ALLWINNER_I2C + select ALLWINNER_AXP_209 select SERIAL select UNIMPhw/misc/Kconfig +4
-0@@ -180,4 +180,8 @@ config ALLWINNER_A10_CCM config ALLWINNER_A10_DRAMC bool +config ALLWINNER_AXP_209 + bool + depends on I2C + source macio/Kconfighw/misc/allwinner-axp-209.c new file +238
-0@@ -0,0 +1,238 @@ +/* +* AXP-209 Emulation +* +* Copyright (C) 2022 Strahinja Jankovic <[email protected]> +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +* +* SPDX-License-Identifier: MIT +*/ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "trace.h" +#include "hw/i2c/i2c.h" +#include "migration/vmstate.h" + +#define TYPE_AXP_209 "allwinner.axp209" + +#define AXP_209 (obj) \ + OBJECT_CHECK(AXP209I2CState, (obj), TYPE_AXP_209) + +/* registers */ +enum { +REG_POWER_STATUS =0x0u , +REG_OPERATING_MODE , +REG_OTG_VBUS_STATUS , +REG_CHIP_VERSION , +REG_DATA_CACHE_0 , +REG_DATA_CACHE_1 , +REG_DATA_CACHE_2 , +REG_DATA_CACHE_3 , +REG_DATA_CACHE_4 , +REG_DATA_CACHE_5 , +REG_DATA_CACHE_6 , +REG_DATA_CACHE_7 , +REG_DATA_CACHE_8 , +REG_DATA_CACHE_9 , +REG_DATA_CACHE_A , +REG_DATA_CACHE_B , +REG_POWER_OUTPUT_CTRL =0x12u , +REG_DC_DC2_OUT_V_CTRL =0x23u , +REG_DC_DC2_DVS_CTRL =0x25u , +REG_DC_DC3_OUT_V_CTRL =0x27u , +REG_LDO2_4_OUT_V_CTRL , +REG_LDO3_OUT_V_CTRL , +REG_VBUS_CH_MGMT =0x30u , +REG_SHUTDOWN_V_CTRL , +REG_SHUTDOWN_CTRL , +REG_CHARGE_CTRL_1 , +REG_CHARGE_CTRL_2 , +REG_SPARE_CHARGE_CTRL , +REG_PEK_KEY_CTRL , +REG_DC_DC_FREQ_SET , +REG_CHR_TEMP_TH_SET , +REG_CHR_HIGH_TEMP_TH_CTRL , +REG_IPSOUT_WARN_L1 , +REG_IPSOUT_WARN_L2 , +REG_DISCHR_TEMP_TH_SET , +REG_DISCHR_HIGH_TEMP_TH_CTRL , +REG_IRQ_BANK_1_CTRL =0x40u , +REG_IRQ_BANK_2_CTRL , +REG_IRQ_BANK_3_CTRL , +REG_IRQ_BANK_4_CTRL , +REG_IRQ_BANK_5_CTRL , +REG_IRQ_BANK_1_STAT =0x48u , +REG_IRQ_BANK_2_STAT , +REG_IRQ_BANK_3_STAT , +REG_IRQ_BANK_4_STAT , +REG_IRQ_BANK_5_STAT , +REG_ADC_ACIN_V_H =0x56u , +REG_ADC_ACIN_V_L , +REG_ADC_ACIN_CURR_H , +REG_ADC_ACIN_CURR_L , +REG_ADC_VBUS_V_H , +REG_ADC_VBUS_V_L , +REG_ADC_VBUS_CURR_H , +REG_ADC_VBUS_CURR_L , +REG_ADC_INT_TEMP_H , +REG_ADC_INT_TEMP_L , +REG_ADC_TEMP_SENS_V_H =0x62u , +REG_ADC_TEMP_SENS_V_L , +REG_ADC_BAT_V_H =0x78u , +REG_ADC_BAT_V_L , +REG_ADC_BAT_DISCHR_CURR_H , +REG_ADC_BAT_DISCHR_CURR_L , +REG_ADC_BAT_CHR_CURR_H , +REG_ADC_BAT_CHR_CURR_L , +REG_ADC_IPSOUT_V_H , +REG_ADC_IPSOUT_V_L , +REG_DC_DC_MOD_SEL =0x80u , +REG_ADC_EN_1 , +REG_ADC_EN_2 , +REG_ADC_SR_CTRL , +REG_ADC_IN_RANGE , +REG_GPIO1_ADC_IRQ_RISING_TH , +REG_GPIO1_ADC_IRQ_FALLING_TH , +REG_TIMER_CTRL =0x8au , +REG_VBUS_CTRL_MON_SRP , +REG_OVER_TEMP_SHUTDOWN =0x8fu , +REG_GPIO0_FEAT_SET , +REG_GPIO_OUT_HIGH_SET , +REG_GPIO1_FEAT_SET , +REG_GPIO2_FEAT_SET , +REG_GPIO_SIG_STATE_SET_MON , +REG_GPIO3_SET , +REG_COULOMB_CNTR_CTRL =0xb8u , +REG_POWER_MEAS_RES , +NR_REGS +}; + +#define AXP_209_CHIP_VERSION_ID (0x01) +#define AXP_209_DC_DC2_OUT_V_CTRL_RESET (0x16) +#define AXP_209_IRQ_BANK_1_CTRL_RESET (0xd8) + +/* A simple I2C slave which returns values of ID or CNT register. */ +typedef struct AXP209I2CState { +/*< private >*/ +I2CSlave i2c; +/*< public >*/ +uint8_t regs[NR_REGS ];/* peripheral registers */ +uint8_t ptr;/* current register index */ +uint8_t count;/* counter used for tx/rx */ +}AXP209I2CState ; + +/* Reset all counters and load ID register */ +static void axp_209_reset_enter (Object *obj,ResetType type) +{ +AXP209I2CState *s =AXP_209 (obj); + +memset (s->regs,0 ,NR_REGS ); + s->ptr =0 ; + s->count =0 ; + s->regs[REG_CHIP_VERSION ] =AXP_209_CHIP_VERSION_ID ; + s->regs[REG_DC_DC2_OUT_V_CTRL ] =AXP_209_DC_DC2_OUT_V_CTRL_RESET ; + s->regs[REG_IRQ_BANK_1_CTRL ] =AXP_209_IRQ_BANK_1_CTRL_RESET ; +} + +/* Handle events from master. */ +static int axp_209_event (I2CSlave *i2c,enum i2c_event event) +{ +AXP209I2CState *s =AXP_209 (i2c); + + s->count =0 ; + +return 0 ; +} + +/* Called when master requests read */ +static uint8_t axp_209_rx (I2CSlave *i2c) +{ +AXP209I2CState *s =AXP_209 (i2c); +uint8_t ret =0xff ; + +if (s->ptr <NR_REGS ) { + ret = s->regs[s->ptr++]; + } + +trace_allwinner_axp_209_rx (s->ptr -1 , ret); + +return ret; +} + +/* +* Called when master sends write. +* Update ptr with byte 0, then perform write with second byte. +*/ +static int axp_209_tx (I2CSlave *i2c,uint8_t data) +{ +AXP209I2CState *s =AXP_209 (i2c); + +if (s->count ==0 ) { +/* Store register address */ + s->ptr = data; + s->count++; +trace_allwinner_axp_209_select (data); + }else { +trace_allwinner_axp_209_tx (s->ptr, data); +if (s->ptr ==REG_DC_DC2_OUT_V_CTRL ) { + s->regs[s->ptr++] = data; + } + } + +return 0 ; +} + +static const VMStateDescription vmstate_axp_209 = { + .name =TYPE_AXP_209 , + .version_id =1 , + .fields = (VMStateField []) { +VMSTATE_UINT8_ARRAY (regs, AXP209I2CState,NR_REGS ), +VMSTATE_UINT8 (count, AXP209I2CState), +VMSTATE_UINT8 (ptr, AXP209I2CState), +VMSTATE_END_OF_LIST () + } +}; + +static void axp_209_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); +I2CSlaveClass *isc =I2C_SLAVE_CLASS (oc); +ResettableClass *rc =RESETTABLE_CLASS (oc); + + rc->phases.enter = axp_209_reset_enter; + dc->vmsd = &vmstate_axp_209; + isc->event = axp_209_event; + isc->recv = axp_209_rx; + isc->send = axp_209_tx; +} + +static const TypeInfo axp_209_info = { + .name =TYPE_AXP_209 , + .parent =TYPE_I2C_SLAVE , + .instance_size =sizeof (AXP209I2CState), + .class_init = axp_209_class_init +}; + +static void axp_209_register_devices (void ) +{ +type_register_static (&axp_209_info); +} + +type_init (axp_209_register_devices);hw/misc/meson.build +1
-0@@ -40,6 +40,7 @@ softmmu_ss.add(when: 'CONFIG_IVSHMEM_DEVICE', if_true: files('ivshmem.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_A10_CCM', if_true: files('allwinner-a10-ccm.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_A10_DRAMC', if_true: files('allwinner-a10-dramc.c')) +softmmu_ss.add(when: 'CONFIG_ALLWINNER_AXP_209', if_true: files('allwinner-axp-209.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-ccu.c')) specific_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-cpucfg.c')) softmmu_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3-dramc.c'))hw/misc/trace-events +5
-1@@ -1,5 +1,10 @@ # See docs/devel/tracing.rst for syntax documentation. +# allwinner-axp209.c +allwinner_axp_209_rx(uint8_t reg, uint8_t data) "Read reg 0x%" PRIx8 " : 0x%" PRIx8 +allwinner_axp_209_select(uint8_t reg) "Accessing reg 0x%" PRIx8 +allwinner_axp_209_tx(uint8_t reg, uint8_t data) "Write reg 0x%" PRIx8 " : 0x%" PRIx8 + # allwinner-cpucfg.c allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_addr 0x%" PRIx32 allwinner_cpucfg_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 --2.30.2
Re: [PATCH v2 4/7] hw/misc: Allwinner AXP-209 Emulation
In reply to Strahinja JankovicQuoted 21 lines · Strahinja Jankovic
This patch adds minimal support for AXP-209 PMU.
Most important is chip ID since U-Boot SPL expects version0x1. Besides the chip ID register, reset values for two more registers used by A10 U-Boot SPL are covered.Signed-off-by Strahinja Jankovic <[email protected]>--- hw/arm/Kconfig | 1 + hw/misc/Kconfig | 4 + hw/misc/allwinner-axp-209.c | 238 ++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/trace-events | 5 + 5 files changed, 249 insertions(+)create mode 100644
hw/misc/allwinner-axp-209.chw/misc/Kconfig +0
-0
hw/misc/Kconfig config ALLWINNER_A10_CCM · line 183
Quoted 4 lines
hw/misc/Kconfig +1
-0@@ -180,4 +180,8 @@ config ALLWINNER_A10_CCM config ALLWINNER_A10_DRAMC bool +config ALLWINNER_AXP_209
This controller is not specific to AllWinner. It can be plugged on any i2c bus. Please rename it AXP209_PMU. Otherwise LGTM!
Quoted 14 lines
hw/misc/Kconfig +3
-0+ bool + depends on I2C + source macio/Kconfighw/misc/allwinner-axp-209.c new file +4
-0@@ -0,0 +1,238 @@ +/* +* AXP-209 Emulation +* +* Copyright (C) 2022 Strahinja Jankovic <[email protected]>
Re: [PATCH v2 4/7] hw/misc: Allwinner AXP-209 Emulation
Hi,
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 24 lines · Strahinja Jankovic
This patch adds minimal support for AXP-209 PMU.
Most important is chip ID since U-Boot SPL expects version0x1. Besides the chip ID register, reset values for two more registers used by A10 U-Boot SPL are covered.Signed-off-by Strahinja Jankovic <[email protected]>--- hw/arm/Kconfig | 1 + hw/misc/Kconfig | 4 + hw/misc/allwinner-axp-209.c | 238 ++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/trace-events | 5 + 5 files changed, 249 insertions(+)create mode 100644
hw/misc/allwinner-axp-209.chw/misc/Kconfig +0
-0@@ -180,4 +180,8 @@ config ALLWINNER_A10_CCM config ALLWINNER_A10_DRAMC bool
Quoted 4 lines
hw/misc/Kconfig config ALLWINNER_A10_CCM · line 183
Quoted 1 line
hw/misc/Kconfig +1
-0+config ALLWINNER_AXP_209This controller is not specific to AllWinner. It can be plugged on any i2c bus. Please rename it
AXP209_PMU. Otherwise LGTM!
Do you mean only in Kconfig, or everywhere (file name, function names, etc.)? Thanks.
Best regards,
Strahinja
Quoted 15 lines
Quoted 15 lines
hw/misc/Kconfig +3
-0+ bool + depends on I2C + source macio/Kconfighw/misc/allwinner-axp-209.c new file +4
-0@@ -0,0 +1,238 @@ +/* +* AXP-209 Emulation +* +* Copyright (C) 2022 Strahinja Jankovic <[email protected]>
Re: [PATCH v2 4/7] hw/misc: Allwinner AXP-209 Emulation
Quoted 30 lines · Strahinja Jankovic
Hi,
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 24 lines · Strahinja Jankovic
This patch adds minimal support for AXP-209 PMU.
Most important is chip ID since U-Boot SPL expects version0x1. Besides the chip ID register, reset values for two more registers used by A10 U-Boot SPL are covered.Signed-off-by Strahinja Jankovic <[email protected]>--- hw/arm/Kconfig | 1 + hw/misc/Kconfig | 4 + hw/misc/allwinner-axp-209.c | 238 ++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/trace-events | 5 + 5 files changed, 249 insertions(+)create mode 100644
hw/misc/allwinner-axp-209.chw/misc/Kconfig +0
-0@@ -180,4 +180,8 @@ config ALLWINNER_A10_CCM config ALLWINNER_A10_DRAMC bool
Quoted 7 lines
Quoted 4 lines
hw/misc/Kconfig config ALLWINNER_A10_CCM · line 183
Quoted 1 line
hw/misc/Kconfig +1
-0+config ALLWINNER_AXP_209This controller is not specific to AllWinner. It can be plugged on any i2c bus. Please rename it
AXP209_PMU. Otherwise LGTM!Do you mean only in
Kconfig, or everywhere (file name, function names, etc.)? Thanks.
Keeping the file / functions names with 'allwinner' would give the false idea this is AllWinner specific; rather confusing isn't it? Besides it is not part of the SoC, this is an external component sitting on the bus. So "everywhere".
Also, the "select ALLWINNER_AXP_209/AXP209_PMU" line in hw/arm/Kconfig belongs to the next patch "hw/arm: Add AXP-209 to Cubieboard".
Regards,
Phil.
Re: [PATCH v2 4/7] hw/misc: Allwinner AXP-209 Emulation
Hi,
Quoted 37 lines · Philippe Mathieu-Daudé
Quoted 35 lines · Strahinja Jankovic
Hi,
Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Strahinja Jankovic
This patch adds minimal support for AXP-209 PMU.
Most important is chip ID since U-Boot SPL expects version0x1. Besides the chip ID register, reset values for two more registers used by A10 U-Boot SPL are covered.Signed-off-by Strahinja Jankovic <[email protected]>--- hw/arm/Kconfig | 1 + hw/misc/Kconfig | 4 + hw/misc/allwinner-axp-209.c | 238 ++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/trace-events | 5 + 5 files changed, 249 insertions(+)create mode 100644
hw/misc/allwinner-axp-209.chw/misc/Kconfig +0
-0hw/misc/Kconfig config ALLWINNER_A10_CCM · line 183
Quoted 4 lines
hw/misc/Kconfig +1
-0@@ -180,4 +180,8 @@ config ALLWINNER_A10_CCM config ALLWINNER_A10_DRAMC bool +config ALLWINNER_AXP_209This controller is not specific to AllWinner. It can be plugged on any i2c bus. Please rename it
AXP209_PMU. Otherwise LGTM!
Quoted 7 lines
Quoted 2 lines
Do you mean only in
Kconfig, or everywhere (file name, function names, etc.)? Thanks.Keeping the file / functions names with 'allwinner' would give the false idea this is AllWinner specific; rather confusing isn't it? Besides it is not part of the SoC, this is an external component sitting on the bus. So "everywhere".
I was expecting that answer, but I wanted to check :)
When I started writing code for AXP209 it was indeed without allwinner prefix, but then checkpatch.pl complained about missing lines in MAINTAINERS. At that time it was easier to add the prefix (and get a match in MAINTAINERS) than to investigate if I should update the MAINTAINERS file or ignore the checkpatch.pl complaint.
I will update everything related to AXP209 so it does not have the Allwinner prefix.
Quoted 3 lines
Also, the "select ALLWINNER_AXP_209/AXP209_PMU" line in hw/arm/Kconfig belongs to the next patch "hw/arm: Add AXP-209 to Cubieboard".
I agree, will fix it.
Best regards,
Strahinja
Quoted 4 lines
Regards,
Phil.
Re: [PATCH v2 4/7] hw/misc: Allwinner AXP-209 Emulation
Quoted 48 lines · Strahinja Jankovic
Hi,
Quoted 29 lines · Philippe Mathieu-Daudé
Quoted 27 lines · Strahinja Jankovic
Hi,
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Strahinja Jankovic
This patch adds minimal support for AXP-209 PMU.
Most important is chip ID since U-Boot SPL expects version0x1. Besides the chip ID register, reset values for two more registers used by A10 U-Boot SPL are covered.Signed-off-by Strahinja Jankovic <[email protected]>--- hw/arm/Kconfig | 1 + hw/misc/Kconfig | 4 + hw/misc/allwinner-axp-209.c | 238 ++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/trace-events | 5 + 5 files changed, 249 insertions(+) create mode 100644 hw/misc/allwinner-axp-209.cQuoted 1 line
+config
ALLWINNER_AXP_209This controller is not specific to AllWinner. It can be plugged on any i2c bus. Please rename it
AXP209_PMU. Otherwise LGTM!Quoted 7 lines
Quoted 2 lines
Do you mean only in
Kconfig, or everywhere (file name, function names, etc.)? Thanks.Keeping the file / functions names with 'allwinner' would give the false idea this is AllWinner specific; rather confusing isn't it? Besides it is not part of the SoC, this is an external component sitting on the bus. So "everywhere".
I was expecting that answer, but I wanted to check :)
When I started writing code for AXP209 it was indeed without allwinner prefix, but then checkpatch.pl complained about missing lines inMAINTAINERS. At that time it was easier to add the prefix (and get a match inMAINTAINERS) than to investigate if I should update theMAINTAINERSfile or ignore the checkpatch.pl complaint.
Quoted 2 lines
I will update everything related to AXP209 so it does not have the Allwinner prefix.
Add a new AXP209 MAINTAINERS's section with your name :) Or add the new file to the Allwinner-a10 section and add your name as designated reviewer or co-maintainer :)
Re: [PATCH v2 4/7] hw/misc: Allwinner AXP-209 Emulation
Quoted 50 lines · Philippe Mathieu-Daudé
Quoted 48 lines · Strahinja Jankovic
Hi,
Quoted 29 lines · Philippe Mathieu-Daudé
Quoted 27 lines · Strahinja Jankovic
Hi,
Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Strahinja Jankovic
This patch adds minimal support for AXP-209 PMU.
Most important is chip ID since U-Boot SPL expects version0x1. Besides the chip ID register, reset values for two more registers used by A10 U-Boot SPL are covered.Signed-off-by Strahinja Jankovic <[email protected]>--- hw/arm/Kconfig | 1 + hw/misc/Kconfig | 4 + hw/misc/allwinner-axp-209.c | 238 ++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/trace-events | 5 + 5 files changed, 249 insertions(+) create mode 100644 hw/misc/allwinner-axp-209.cQuoted 1 line
+config
ALLWINNER_AXP_209This controller is not specific to AllWinner. It can be plugged on any i2c bus. Please rename it
AXP209_PMU. Otherwise LGTM!Quoted 7 lines
Quoted 2 lines
Do you mean only in
Kconfig, or everywhere (file name, function names, etc.)? Thanks.Keeping the file / functions names with 'allwinner' would give the false idea this is AllWinner specific; rather confusing isn't it? Besides it is not part of the SoC, this is an external component sitting on the bus. So "everywhere".
I was expecting that answer, but I wanted to check :)
When I started writing code for AXP209 it was indeed without allwinner prefix, but then checkpatch.pl complained about missing lines inMAINTAINERS. At that time it was easier to add the prefix (and get a match inMAINTAINERS) than to investigate if I should update theMAINTAINERSfile or ignore the checkpatch.pl complaint.
Quoted 6 lines
Quoted 2 lines
I will update everything related to AXP209 so it does not have the Allwinner prefix.
Add a new AXP209 MAINTAINERS's section with your name :) Or add the new file to the Allwinner-a10 section and add your name as designated reviewer or co-maintainer :)
Thanks, I will take one of these suggested approaches.
Best regards,
Strahinja
PATCH v2 5/7 hw/arm: Add AXP-209 to Cubieboard
In reply to Strahinja JankovicSPL Boot for Cubieboard expects AXP-209 connected to I2C0 bus.
--- hw/arm/cubieboard.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/arm/cubieboard.c +6 -0
@@ -20,6 +20,7 @@#include "hw/boards.h" #include "hw/qdev-properties.h" #include "hw/arm/allwinner-a10.h" +#include "hw/i2c/i2c.h" static struct arm_boot_info cubieboard_binfo = { .loader_start =AW_A10_SDRAM_BASE ,
@@ -34,6 +35,7 @@ static void cubieboard_init(MachineState *machine)BlockBackend *blk;BusState *bus;DeviceState *carddev; +I2CBus *i2c;/* BIOS is not supported by this board */ if (machine->firmware) {
@@ -80,6 +82,10 @@ static void cubieboard_init(MachineState *machine)exit (1 ); } +/* Connect AXP 209 */ + i2c = (I2CBus *)qdev_get_child_bus (DEVICE (&a10->i2c0),"i2c" ); +i2c_slave_create_simple (i2c,"allwinner.axp209" ,0x34 ); +/* Retrieve SD bus */ di =drive_get (IF_SD ,0 ,0 ); blk = di ?blk_by_legacy_dinfo (di) :NULL ;
Signature · 1 line
2.30.2
Re: [PATCH v2 5/7] hw/arm: Add AXP-209 to Cubieboard
Quoted 28 lines · Strahinja Jankovic
SPL Boot for Cubieboard expects AXP-209 connected to I2C0 bus.
Signed-off-by Strahinja Jankovic <[email protected]>--- hw/arm/cubieboard.c | 6 ++++++ 1 file changed, 6 insertions(+)hw/arm/cubieboard.c +2
-0@@ -20,6 +20,7 @@#include "hw/boards.h" #include "hw/qdev-properties.h" #include "hw/arm/allwinner-a10.h" +#include "hw/i2c/i2c.h" static struct arm_boot_info cubieboard_binfo = { .loader_start =AW_A10_SDRAM_BASE ,@@ -34,6 +35,7 @@ static void cubieboard_init(MachineState *machine)BlockBackend *blk;BusState *bus;DeviceState *carddev; +I2CBus *i2c;/* BIOS is not supported by this board */ if (machine->firmware) {
hw/arm/cubieboard.c static void cubieboard_init(MachineState *machine) · line 86
Quoted 5 lines
hw/arm/cubieboard.c +2
-0@@ -80,6 +82,10 @@ static void cubieboard_init(MachineState *machine)exit (1 ); } +/* Connect AXP 209 */ + i2c = (I2CBus *)qdev_get_child_bus (DEVICE (&a10->i2c0),"i2c" );
Preferably using I2C_BUS() instead of the cast:
Quoted 5 lines
hw/arm/cubieboard.c +2
-0+i2c_slave_create_simple (i2c,"allwinner.axp209" ,0x34 ); +/* Retrieve SD bus */ di =drive_get (IF_SD ,0 ,0 ); blk = di ?blk_by_legacy_dinfo (di) :NULL ;
PATCH v2 6/7 hw/arm: Allwinner A10 enable SPL load from MMC
In reply to Strahinja JankovicThis patch enables copying of SPL from MMC if -kernel parameter is not passed when starting QEMU. SPL is copied to SRAM_A.
The approach is reused from Allwinner H3 implementation.
Tested with Armbian and custom Yocto image.
--- hw/arm/allwinner-a10.c | 18 ++++++++++++++++++ hw/arm/cubieboard.c | 5 +++++ include/hw/arm/allwinner-a10.h | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+)
hw/arm/allwinner-a10.c +18 -0
@@ -24,7 +24,9 @@#include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/usb/hcd-ohci.h" +#include "hw/loader.h" +#define AW_A10_SRAM_A_BASE 0x00000000#define AW_A10_DRAMC_BASE 0x01c01000#define AW_A10_MMC0_BASE 0x01c0f000#define AW_A10_CCM_BASE 0x01c20000
@@ -38,6 +40,22 @@#define AW_A10_RTC_BASE 0x01c20d00#define AW_A10_I2C0_BASE 0x01c2ac00 +void allwinner_a10_bootrom_setup (AwA10State *s,BlockBackend *blk) +{ +const int64_t rom_size =32 * KiB; + g_autofree uint8_t *buffer = g_new0(uint8_t, rom_size); + +if (blk_pread (blk,8 * KiB, rom_size, buffer,0 ) <0 ) { +error_setg (&error_fatal,"%s: failed to read BlockBackend data" , + __func__); +return ; + } + +rom_add_blob ("allwinner-a10.bootrom" , buffer, rom_size, + rom_size,AW_A10_SRAM_A_BASE , +NULL ,NULL ,NULL ,NULL , false); +} +static void aw_a10_init (Object *obj) {AwA10State *s =AW_A10 (obj);
hw/arm/cubieboard.c +5 -0
@@ -99,6 +99,11 @@ static void cubieboard_init(MachineState *machine)memory_region_add_subregion (get_system_memory (),AW_A10_SDRAM_BASE , machine->ram); +/* Load target kernel or start using BootROM */ +if (!machine->kernel_filename && blk &&blk_is_available (blk)) { +/* Use Boot ROM to copy data from SD card to SRAM */ +allwinner_a10_bootrom_setup (a10, blk); + }/* TODO create and connect IDE devices for ide_drive_get() */ cubieboard_binfo.ram_size = machine->ram_size;
include/hw/arm/allwinner-a10.h +21 -0
@@ -15,6 +15,7 @@#include "hw/misc/allwinner-a10-ccm.h" #include "hw/misc/allwinner-a10-dramc.h" #include "hw/i2c/allwinner-i2c.h" +#include "sysemu/block-backend.h" #include "target/arm/cpu.h" #include "qom/object.h"
@@ -47,4 +48,24 @@ struct AwA10State { OHCISysBusState ohci[AW_A10_NUM_USB]; }; +/** +* Emulate Boot ROM firmware setup functionality. +* +* A real Allwinner A10 SoC contains a Boot ROM +* which is the first code that runs right after +* the SoC is powered on. The Boot ROM is responsible +* for loading user code (e.g. a bootloader) from any +* of the supported external devices and writing the +* downloaded code to internal SRAM. After loading the SoC +* begins executing the code written to SRAM. +* +* This function emulates the Boot ROM by copying 32 KiB +* of data from the given block device and writes it to +* the start of the first internal SRAM memory. +* +* @s: Allwinner A10 state object pointer +* @blk: Block backend device object pointer +*/ +void allwinner_a10_bootrom_setup (AwA10State *s,BlockBackend *blk); +#endif
Signature · 1 line
2.30.2
Re: [PATCH v2 6/7] hw/arm: Allwinner A10 enable SPL load from MMC
Quoted 88 lines · Strahinja Jankovic
This patch enables copying of SPL from MMC if
-kernelparameter is not passed when starting QEMU. SPL is copied toSRAM_A.The approach is reused from Allwinner H3 implementation.
Tested with Armbian and custom Yocto image.
Signed-off-by Strahinja Jankovic <[email protected]>Reviewed-by Niek Linnenbank <[email protected]>--- hw/arm/allwinner-a10.c | 18 ++++++++++++++++++ hw/arm/cubieboard.c | 5 +++++ include/hw/arm/allwinner-a10.h | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+)hw/arm/allwinner-a10.c +18
-0@@ -24,7 +24,9 @@#include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/usb/hcd-ohci.h" +#include "hw/loader.h" +#define AW_A10_SRAM_A_BASE 0x00000000#define AW_A10_DRAMC_BASE 0x01c01000#define AW_A10_MMC0_BASE 0x01c0f000#define AW_A10_CCM_BASE 0x01c20000@@ -38,6 +40,22 @@#define AW_A10_RTC_BASE 0x01c20d00#define AW_A10_I2C0_BASE 0x01c2ac00 +void allwinner_a10_bootrom_setup (AwA10State *s,BlockBackend *blk) +{ +const int64_t rom_size =32 * KiB; + g_autofree uint8_t *buffer = g_new0(uint8_t, rom_size); + +if (blk_pread (blk,8 * KiB, rom_size, buffer,0 ) <0 ) { +error_setg (&error_fatal,"%s: failed to read BlockBackend data" , + __func__); +return ; + } + +rom_add_blob ("allwinner-a10.bootrom" , buffer, rom_size, + rom_size,AW_A10_SRAM_A_BASE , +NULL ,NULL ,NULL ,NULL , false); +} +static void aw_a10_init (Object *obj) {AwA10State *s =AW_A10 (obj);hw/arm/cubieboard.c +5
-0@@ -99,6 +99,11 @@ static void cubieboard_init(MachineState *machine)memory_region_add_subregion (get_system_memory (),AW_A10_SDRAM_BASE , machine->ram); +/* Load target kernel or start using BootROM */ +if (!machine->kernel_filename && blk &&blk_is_available (blk)) { +/* Use Boot ROM to copy data from SD card to SRAM */ +allwinner_a10_bootrom_setup (a10, blk); + }/* TODO create and connect IDE devices for ide_drive_get() */ cubieboard_binfo.ram_size = machine->ram_size;include/hw/arm/allwinner-a10.h +4
-0@@ -15,6 +15,7 @@#include "hw/misc/allwinner-a10-ccm.h" #include "hw/misc/allwinner-a10-dramc.h" #include "hw/i2c/allwinner-i2c.h" +#include "sysemu/block-backend.h" #include "target/arm/cpu.h" #include "qom/object.h" @@ -47,4 +48,24 @@ struct AwA10State {OHCISysBusState ohci[AW_A10_NUM_USB ]; }; +/** +* Emulate Boot ROM firmware setup functionality. +*
include/hw/arm/allwinner-a10.h struct AwA10State { · line 63
Quoted 10 lines
include/hw/arm/allwinner-a10.h +10
-0+* A real Allwinner A10 SoC contains a Boot ROM +* which is the first code that runs right after +* the SoC is powered on. The Boot ROM is responsible +* for loading user code (e.g. a bootloader) from any +* of the supported external devices and writing the +* downloaded code to internal SRAM. After loading the SoC +* begins executing the code written to SRAM. +* +* This function emulates the Boot ROM by copying 32 KiB +* of data
"at offset 8 KiB" ?
Quoted 9 lines
from the given block device and writes it to
+ * the start of the first internal SRAM memory.
+ *
+ * @s: Allwinner A10 state object pointer
+ * @blk: Block backend device object pointer
+ */include/hw/arm/allwinner-a10.h +2
-0+void allwinner_a10_bootrom_setup (AwA10State *s,BlockBackend *blk); +#endif
Re: [PATCH v2 6/7] hw/arm: Allwinner A10 enable SPL load from MMC
Hi,
Quoted 87 lines · Philippe Mathieu-Daudé
Quoted 85 lines · Strahinja Jankovic
This patch enables copying of SPL from MMC if
-kernelparameter is not passed when starting QEMU. SPL is copied toSRAM_A.The approach is reused from Allwinner H3 implementation.
Tested with Armbian and custom Yocto image.
Signed-off-by Strahinja Jankovic <[email protected]>Reviewed-by Niek Linnenbank <[email protected]>--- hw/arm/allwinner-a10.c | 18 ++++++++++++++++++ hw/arm/cubieboard.c | 5 +++++ include/hw/arm/allwinner-a10.h | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+)hw/arm/allwinner-a10.c +18
-0@@ -24,7 +24,9 @@#include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/usb/hcd-ohci.h" +#include "hw/loader.h" +#define AW_A10_SRAM_A_BASE 0x00000000#define AW_A10_DRAMC_BASE 0x01c01000#define AW_A10_MMC0_BASE 0x01c0f000#define AW_A10_CCM_BASE 0x01c20000@@ -38,6 +40,22 @@#define AW_A10_RTC_BASE 0x01c20d00#define AW_A10_I2C0_BASE 0x01c2ac00 +void allwinner_a10_bootrom_setup (AwA10State *s,BlockBackend *blk) +{ +const int64_t rom_size =32 * KiB; + g_autofree uint8_t *buffer = g_new0(uint8_t, rom_size); + +if (blk_pread (blk,8 * KiB, rom_size, buffer,0 ) <0 ) { +error_setg (&error_fatal,"%s: failed to read BlockBackend data" , + __func__); +return ; + } + +rom_add_blob ("allwinner-a10.bootrom" , buffer, rom_size, + rom_size,AW_A10_SRAM_A_BASE , +NULL ,NULL ,NULL ,NULL , false); +} +static void aw_a10_init (Object *obj) {AwA10State *s =AW_A10 (obj);hw/arm/cubieboard.c +5
-0@@ -99,6 +99,11 @@ static void cubieboard_init(MachineState *machine)memory_region_add_subregion (get_system_memory (),AW_A10_SDRAM_BASE , machine->ram); +/* Load target kernel or start using BootROM */ +if (!machine->kernel_filename && blk &&blk_is_available (blk)) { +/* Use Boot ROM to copy data from SD card to SRAM */ +allwinner_a10_bootrom_setup (a10, blk); + }/* TODO create and connect IDE devices for ide_drive_get() */ cubieboard_binfo.ram_size = machine->ram_size;include/hw/arm/allwinner-a10.h +1
-0@@ -15,6 +15,7 @@#include "hw/misc/allwinner-a10-ccm.h" #include "hw/misc/allwinner-a10-dramc.h" #include "hw/i2c/allwinner-i2c.h" +#include "sysemu/block-backend.h" #include "target/arm/cpu.h" #include "qom/object.h" @@ -47,4 +48,24 @@ struct AwA10State {OHCISysBusState ohci[AW_A10_NUM_USB ]; };
Quoted 15 lines
include/hw/arm/allwinner-a10.h struct AwA10State {
Quoted 13 lines
include/hw/arm/allwinner-a10.h +13
-0+/** +* Emulate Boot ROM firmware setup functionality. +* +* A real Allwinner A10 SoC contains a Boot ROM +* which is the first code that runs right after +* the SoC is powered on. The Boot ROM is responsible +* for loading user code (e.g. a bootloader) from any +* of the supported external devices and writing the +* downloaded code to internal SRAM. After loading the SoC +* begins executing the code written to SRAM. +* +* This function emulates the Boot ROM by copying 32 KiB +* of data "at offset 8 KiB" ?
Yes, that is correct. I will update the function description.
Best regards,
Strahinja
Quoted 11 lines
Quoted 10 lines
from the given block device and writes it to
+ * the start of the first internal SRAM memory.
+ *
+ * @s: Allwinner A10 state object pointer
+ * @blk: Block backend device object pointer
+ */include/hw/arm/allwinner-a10.h +2
-0+void allwinner_a10_bootrom_setup (AwA10State *s,BlockBackend *blk); +#endif
PATCH v2 7/7 docs/system/arm: Update Allwinner with TWI (I2C)
In reply to Strahinja JankovicTWI (I2C) is supported so docs are updated for Cubieboard and Orangepi-PC board.
--- docs/system/arm/cubieboard.rst | 1 + docs/system/arm/orangepi.rst | 1 + 2 files changed, 2 insertions(+)
docs/system/arm/cubieboard.rst +1 -0
@@ -14,3 +14,4 @@ Emulated devices: - SDHCI - USB controller - SATA controller +- TWI (I2C) controller
docs/system/arm/orangepi.rst +1 -0
@@ -25,6 +25,7 @@ The Orange Pi PC machine supports the following devices: * Clock Control Unit * System Control module * Security Identifier device + * TWI (I2C) Limitations """""""""""
Signature · 1 line
2.30.2
Re: [PATCH v2 7/7] docs/system/arm: Update Allwinner with TWI (I2C)
Quoted 23 lines · Strahinja Jankovic
TWI (I2C) is supported so docs are updated for Cubieboard and Orangepi-PC board.
Signed-off-by Strahinja Jankovic <[email protected]>--- docs/system/arm/cubieboard.rst | 1 + docs/system/arm/orangepi.rst | 1 + 2 files changed, 2 insertions(+)docs/system/arm/cubieboard.rst +1
-0@@ -14,3 +14,4 @@ Emulated devices: - SDHCI - USB controller - SATA controller +- TWI (I2C) controllerdocs/system/arm/orangepi.rst +0
-0
docs/system/arm/orangepi.rst The Orange Pi PC machine supports the following devices: · line 31
Quoted 7 lines
docs/system/arm/orangepi.rst +1
-0@@ -25,6 +25,7 @@ The Orange Pi PC machine supports the following devices: * Clock Control Unit * System Control module * Security Identifier device + * TWI (I2C) Limitations """""""""""
Squash to patch #3 "hw/i2c: Allwinner TWI/I2C Emulation"?
Re: [PATCH v2 7/7] docs/system/arm: Update Allwinner with TWI (I2C)
Hi,
Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 28 lines · Strahinja Jankovic
TWI (I2C) is supported so docs are updated for Cubieboard and Orangepi-PC board.
Signed-off-by Strahinja Jankovic <[email protected]>--- docs/system/arm/cubieboard.rst | 1 + docs/system/arm/orangepi.rst | 1 + 2 files changed, 2 insertions(+)docs/system/arm/cubieboard.rst +1
-0@@ -14,3 +14,4 @@ Emulated devices: - SDHCI - USB controller - SATA controller +- TWI (I2C) controllerdocs/system/arm/orangepi.rst +1
-0@@ -25,6 +25,7 @@ The Orange Pi PC machine supports the following devices: * Clock Control Unit * System Control module * Security Identifier device + * TWI (I2C)
Quoted 4 lines
docs/system/arm/orangepi.rst The Orange Pi PC machine supports the following devices: · line 31
Quoted 2 lines
docs/system/arm/orangepi.rst +0
-0Limitations """""""""""Squash to patch #3 "hw/i2c: Allwinner TWI/I2C Emulation"?
Yes, that makes sense, I will do it. Thanks.
Best regards,
Strahinja
Quoted 7 lines · Strahinja Jankovic
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
Quoted 8 lines
It also updates Allwinner A10 emulation so SPL is copied from attached SD card if
-kernelparameter 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.
Hi,
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Strahinja Jankovic
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 busQuoted 8 lines
It also updates Allwinner A10 emulation so SPL is copied from attached SD card if
-kernelparameter 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
Quoted 5 lines
As a follow-up, could you add a test similar to
test_arm_orangepi_bionic_20_08()intests/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
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
Quoted 48 lines · Strahinja Jankovic
Hi,
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Strahinja Jankovic
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 busQuoted 8 lines
It also updates Allwinner A10 emulation so SPL is copied from attached SD card if
-kernelparameter 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.imgQuoted 5 lines
As a follow-up, could you add a test similar to
test_arm_orangepi_bionic_20_08()intests/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 extractingkernel/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
Quoted 3 lines · Strahinja Jankovic
Hi,
I just looked around a bit more. Would OpenWrt image be acceptable?
Sure.
Quoted 4 lines
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.
Quoted 40 lines
Best regards,
StrahinjaQuoted 35 lines · Strahinja Jankovic
Hi,
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Strahinja Jankovic
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 busQuoted 8 lines
It also updates Allwinner A10 emulation so SPL is copied from attached SD card if
-kernelparameter 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.imgQuoted 5 lines
As a follow-up, could you add a test similar to
test_arm_orangepi_bionic_20_08()intests/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.
Quoted 5 lines
Quoted 5 lines
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 extractingkernel/dtb/initrd).
Similar approach:
https://lore.kernel.org/qemu-devel/[email protected]/
Quoted 7 lines
Quoted 7 lines
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.
Hi,
Quoted 73 lines · Philippe Mathieu-Daudé
Quoted 3 lines · Strahinja Jankovic
Hi,
I just looked around a bit more. Would OpenWrt image be acceptable?
Sure.
Quoted 4 lines
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.
Quoted 40 lines
Best regards,
StrahinjaQuoted 35 lines · Strahinja Jankovic
Hi,
Quoted 18 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Strahinja Jankovic
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 busQuoted 8 lines
It also updates Allwinner A10 emulation so SPL is copied from attached SD card if
-kernelparameter 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.imgQuoted 5 lines
As a follow-up, could you add a test similar to
test_arm_orangepi_bionic_20_08()intests/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.
Quoted 5 lines
Quoted 5 lines
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 extractingkernel/dtb/initrd).Similar approach:
https://lore.kernel.org/qemu-devel/[email protected]/Quoted 5 lines
Quoted 5 lines
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.
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
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
Quoted 4 lines
Regards,
Phil.