add allwinner A10 SoC support
v13 cover add allwinner A10 SoC support
lay a foundation for allwinner A10 SoC with a cortex-a8 processor, and will add more devices later.
v2: split timer and interrupt controller emulation into
their corresponding files.
v3:
1. change loader_start address
2. add 64-bit counter
3. fixup fail to clear interrup status issue
v4:
1. add VMSD
2. use defines of magic number for readability
3. code cleanup
v5:
1. add VMSTATE_PTIMER_ARRAY
2. code cleanup
v6:
1. fix a fiq lost issue pointed out by Peter Crosthwaite
2. code cleanup
v7:
model allwinner A10 as a SoC device,
and add cubieboard.
v8:
1. A10 be QOMified as a device
2. add AW as prefix of A10
v9:
code cleanup for PATCH 4/5 A10 SoC support
v10:
code cleanup for PATCH 2/5
v11:
code cleanup for PATCH 2/5, 3/5
v12:
1. use bool type for irq setting
2. use Peter's VMSTATE_PTIMER_ARRAY
v13:
1. remove odd spaces
2. add cubieboard entry for qom-test
TODO:
1. add BROM support
2. add more devices
test:
can boot-up officially released linux kernel build with PLL disabled.
can find test zImage at:
http://dl.dbank.com/c0jaibr54s
reference:
http://linux-sunxi.org/Main_Page
Peter Maydell (1):
vmstate: Add support for an array of ptimer_state *
liguang (5):
hw/timer: add allwinner a10 timer hw/intc: add allwinner A10 interrupt controller hw/arm: add allwinner a10 SoC support hw/arm: add cubieboard support
MAINTAINERS: add myself to maintain allwinner-a10
MAINTAINERS | 7 + default-configs/arm-softmmu.mak | 4 + hw/arm/Makefile.objs | 1 + hw/arm/allwinner-a10.c | 103 ++++++++++++++ hw/arm/cubieboard.c | 69 +++++++++ hw/intc/Makefile.objs | 1 + hw/intc/allwinner-a10-pic.c | 200 ++++++++++++++++++++++++++ hw/timer/Makefile.objs | 2 + hw/timer/allwinner-a10-pit.c | 254 ++++++++++++++++++++++++++++++++++ include/hw/arm/allwinner-a10.h | 35 +++++ include/hw/intc/allwinner-a10-pic.h | 40 ++++++ include/hw/ptimer.h | 4 + include/hw/timer/allwinner-a10-pit.h | 59 ++++++++ include/migration/vmstate.h | 10 ++ tests/qom-test.c | 1 + 15 files changed, 790 insertions(+), 0 deletions(-) create mode 100644 hw/arm/allwinner-a10.c create mode 100644 hw/arm/cubieboard.c create mode 100644 hw/intc/allwinner-a10-pic.c create mode 100644 hw/timer/allwinner-a10-pit.c create mode 100644 include/hw/arm/allwinner-a10.h create mode 100644 include/hw/intc/allwinner-a10-pic.h create mode 100644 include/hw/timer/allwinner-a10-pit.h
PATCH v13 1/6 vmstate: Add support for an array of ptimer_state *
From: Peter Maydell <[email protected]>
Add support for defining a vmstate field which is an array of pointers to structures, and use this to define a VMSTATE_PTIMER_ARRAY() which allows an array of ptimer_state* to be used by devices.
--- include/hw/ptimer.h | 4 ++++ include/migration/vmstate.h | 10 ++++++++++ 2 files changed, 14 insertions(+), 0 deletions(-)
include/hw/ptimer.h +4 -0
@@ -36,4 +36,8 @@ extern const VMStateDescription vmstate_ptimer; .offset = vmstate_offset_pointer(_state, _field, ptimer_state), \ } +#define VMSTATE_PTIMER_ARRAY (_f, _s, _n) \ + VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, 0, \ + vmstate_ptimer, ptimer_state) +#endif
include/migration/vmstate.h +10 -0
@@ -339,6 +339,16 @@ extern const VMStateInfo vmstate_info_bitmap; .offset = vmstate_offset_array(_state, _field, _type, _num), \ } +#define VMSTATE_ARRAY_OF_POINTER_TO_STRUCT (_f, _s, _n, _v, _vmsd, _type) { \ + .name = (stringify(_f)), \ + .version_id = (_v), \ + .num = (_n), \ + .vmsd = &(_vmsd), \ + .size = sizeof(_type *), \ + .flags = VMS_ARRAY|VMS_STRUCT|VMS_ARRAY_OF_POINTER, \ + .offset = vmstate_offset_array(_s, _f, _type*, _n), \ +} +#define VMSTATE_STRUCT_ARRAY_TEST (_field, _state, _num, _test, _version, _vmsd, _type) { \ .name = (stringify(_field)), \ .num = (_num), \
Signature · 1 line
1.7.2.5
PATCH v13 2/6 hw/timer: add allwinner a10 timer
In reply to liguang--- default-configs/arm-softmmu.mak | 2 + hw/timer/Makefile.objs | 2 + hw/timer/allwinner-a10-pit.c | 254 ++++++++++++++++++++++++++++++++++ include/hw/timer/allwinner-a10-pit.h | 58 ++++++++ 4 files changed, 316 insertions(+), 0 deletions(-) create mode 100644 hw/timer/allwinner-a10-pit.c create mode 100644 include/hw/timer/allwinner-a10-pit.h
default-configs/arm-softmmu.mak +2 -0
@@ -81,3 +81,5 @@ CONFIG_VERSATILE_I2C=y CONFIG_SDHCI=y CONFIG_INTEGRATOR_DEBUG=y + +CONFIG_ALLWINNER_A10_PIT=y
hw/timer/Makefile.objs +2 -0
@@ -27,3 +27,5 @@ obj-$(CONFIG_SH4) += sh_timer.o obj-$(CONFIG_TUSB6010) += tusb6010.o obj-$(CONFIG_MC146818RTC) += mc146818rtc.o + +obj-$(CONFIG_ALLWINNER_A10_PIT) += allwinner-a10-pit.o
hw/timer/allwinner-a10-pit.c new file +254 -0
254 lines not on this page · raw message
include/hw/timer/allwinner-a10-pit.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
1.7.2.5
PATCH v13 3/6 hw/intc: add allwinner A10 interrupt controller
In reply to liguang--- default-configs/arm-softmmu.mak | 1 + hw/intc/Makefile.objs | 1 + hw/intc/allwinner-a10-pic.c | 200 +++++++++++++++++++++++++++++++++++ include/hw/intc/allwinner-a10-pic.h | 40 +++++++ 4 files changed, 242 insertions(+), 0 deletions(-) create mode 100644 hw/intc/allwinner-a10-pic.c create mode 100644 include/hw/intc/allwinner-a10-pic.h
default-configs/arm-softmmu.mak +1 -0
@@ -83,3 +83,4 @@ CONFIG_SDHCI=y CONFIG_INTEGRATOR_DEBUG=y CONFIG_ALLWINNER_A10_PIT=y +CONFIG_ALLWINNER_A10_PIC=y
hw/intc/Makefile.objs +1 -0
@@ -24,3 +24,4 @@ obj-$(CONFIG_OPENPIC_KVM) += openpic_kvm.o obj-$(CONFIG_SH4) += sh_intc.o obj-$(CONFIG_XICS) += xics.o obj-$(CONFIG_XICS_KVM) += xics_kvm.o +obj-$(CONFIG_ALLWINNER_A10_PIC) += allwinner-a10-pic.o
hw/intc/allwinner-a10-pic.c new file +200 -0
200 lines not on this page · raw message
include/hw/intc/allwinner-a10-pic.h new file +40 -0
@@ -0,0 +1,40 @@ +#ifndef AW_A10_PIC_H +#define AW_A10_PIC_H + +#define TYPE_AW_A10_PIC "allwinner-a10-pic" +#define AW_A10_PIC (obj) OBJECT_CHECK(AwA10PICState, (obj), TYPE_AW_A10_PIC) + +#define AW_A10_PIC_VECTOR 0 +#define AW_A10_PIC_BASE_ADDR 4 +#define AW_A10_PIC_PROTECT 8 +#define AW_A10_PIC_NMI 0xc +#define AW_A10_PIC_IRQ_PENDING 0x10 +#define AW_A10_PIC_FIQ_PENDING 0x20 +#define AW_A10_PIC_SELECT 0x30 +#define AW_A10_PIC_ENABLE 0x40 +#define AW_A10_PIC_MASK 0x50 + +#define AW_A10_PIC_INT_NR 95 +#define AW_A10_PIC_REG_NUM DIV_ROUND_UP(AW_A10_PIC_INT_NR, 32) + +typedef struct AwA10PICState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ +MemoryRegion iomem; +qemu_irq parent_fiq; +qemu_irq parent_irq; + +uint32_t vector; +uint32_t base_addr; +uint32_t protect; +uint32_t nmi; +uint32_t irq_pending[AW_A10_PIC_REG_NUM ]; +uint32_t fiq_pending[AW_A10_PIC_REG_NUM ]; +uint32_t select[AW_A10_PIC_REG_NUM ]; +uint32_t enable[AW_A10_PIC_REG_NUM ]; +uint32_t mask[AW_A10_PIC_REG_NUM ]; +/*priority setting here*/ +}AwA10PICState ; + +#endif
Signature · 1 line
1.7.2.5
PATCH v13 4/6 hw/arm: add allwinner a10 SoC support
In reply to liguang--- default-configs/arm-softmmu.mak | 1 + hw/arm/Makefile.objs | 1 + hw/arm/allwinner-a10.c | 103 +++++++++++++++++++++++++++++++++++++++ include/hw/arm/allwinner-a10.h | 35 +++++++++++++ 4 files changed, 140 insertions(+), 0 deletions(-) create mode 100644 hw/arm/allwinner-a10.c create mode 100644 include/hw/arm/allwinner-a10.h
default-configs/arm-softmmu.mak +1 -0
@@ -84,3 +84,4 @@ CONFIG_INTEGRATOR_DEBUG=y CONFIG_ALLWINNER_A10_PIT=y CONFIG_ALLWINNER_A10_PIC=y +CONFIG_ALLWINNER_A10=y
hw/arm/Makefile.objs +1 -0
@@ -5,3 +5,4 @@ obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o obj-y += omap1.o omap2.o strongarm.o +obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o
hw/arm/allwinner-a10.c new file +103 -0
103 lines not on this page · raw message
include/hw/arm/allwinner-a10.h new file +35 -0
@@ -0,0 +1,35 @@ +#ifndef ALLWINNER_H_ + +#include "qemu-common.h" +#include "qemu/error-report.h" +#include "hw/char/serial.h" +#include "hw/arm/arm.h" +#include "hw/timer/allwinner-a10-pit.h" +#include "hw/intc/allwinner-a10-pic.h" + +#include "sysemu/sysemu.h" +#include "exec/address-spaces.h" + + +#define AW_A10_PIC_REG_BASE 0x01c20400 +#define AW_A10_PIT_REG_BASE 0x01c20c00 +#define AW_A10_UART0_REG_BASE 0x01c28000 + +#define AW_A10_SDRAM_BASE 0x40000000 + +#define TYPE_AW_A10 "allwinner-a10" +#define AW_A10 (obj) OBJECT_CHECK(AwA10State, (obj), TYPE_AW_A10) + +typedef struct AwA10State { +/*< private >*/ +DeviceState parent_obj; +/*< public >*/ + +ARMCPU cpu; +qemu_irq irq[AW_A10_PIC_INT_NR ]; +AwA10PITState timer; +AwA10PICState intc; +}AwA10State ; + +#define ALLWINNER_H_ +#endif
Signature · 1 line
1.7.2.5
PATCH v13 5/6 hw/arm: add cubieboard support
In reply to liguang--- hw/arm/Makefile.objs | 2 +- hw/arm/cubieboard.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/qom-test.c | 1 + 3 files changed, 71 insertions(+), 1 deletions(-) create mode 100644 hw/arm/cubieboard.c
hw/arm/Makefile.objs +1 -1
@@ -5,4 +5,4 @@ obj-y += tosa.o versatilepb.o vexpress.o xilinx_zynq.o z2.o obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o obj-y += omap1.o omap2.o strongarm.o -obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o +obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o
hw/arm/cubieboard.c new file +69 -0
69 lines not on this page · raw message
tests/qom-test.c +1 -0
@@ -70,6 +70,7 @@ static const char *arm_machines[] = {"xilinx-zynq-a9" ,"highbank" ,"midway" , + "cubieboard", }; static const char *cris_machines[] = {
Signature · 1 line
1.7.2.5
PATCH v13 6/6 MAINTAINERS: add myself to maintain allwinner-a10
In reply to liguang--- MAINTAINERS | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
MAINTAINERS +7 -0
@@ -219,6 +219,13 @@ F: *win32* ARM Machines ------------ +Allwinner-a10 +M: Li Guang <[email protected]> +S: Maintained +F: hw/*/allwinner-a10* +F: include/hw/*/allwinner-a10* +F: hw/arm/cubieboard.c + Exynos M: Evgeny Voevodin <[email protected]> M: Maksim Kozlov <[email protected]>
Signature · 1 line
1.7.2.5
Quoted 2 lines · liguang
lay a foundation for allwinner A10 SoC with a cortex-a8 processor, and will add more devices later.
Thanks; applied all to target-arm.next.
-- PMM