ARM: Samsung Exynos4210-based boards support.
Subsystems (3)
v7 cover ARM: Samsung Exynos4210-based boards support.
This set of patches adds support for Samsung S5PC210-based boards NURI and SMDKC210. Tested on Linux kernel v3.x series. Usage of "-smp 2" option is required for now.
Changelog:
v6->v7
- exynos4210_pwm.c: added usage of "ptimer.h"
- exynos4210_mct.c: added usage of "ptimer.h"
v5->v6
- arm_boot.c, vexpress.c, realview.c: board should specify smp_bootreg_addr if its ncpu > 1
- patch order changed, "boot secondary CPU" is included in "exynos boards" patch.
- exynos4210_mct.c: usage of UINTX_MAX, removed excessive property list, fixed indentation, fixed comments
- exynos4210_pwm.c: spaces and brakcets in macros, removed excessive property list,
fixed indentation,
- exynos4210_combiner.c: removed excessive reset, fixed indentation, fixed comments
- exynos4210_gic.c: fixed indentation, fixed syntax
- exynos4210_uart.c: fixed indentation, fixed syntax
- exynos4210.c: fixed comments
- Makefile.target: removed "\"
- hw/exynos4210_fimd.c: rebased against current master: all manipulation with physical pages are dropped and
replaced with new memory API functions;
added three new members to winow's state: MemoryRegionSection to describe section
of system RAM containing current framebuffer, host pointer to framebuffer data and
framebuffer length;
mapping of framebuffer now performed only on framebuffer settings change
instead on every display update;
bytes swap in uint64 variable now performed with standard QEMU bswap64 function;
blencon register type changed to uint32_t;
fixed incorrect spelling of "palette" word;
if ... else statements in exynos4210_fimd_read() and exynos4210_fimd_write() are
replaced with switch() {} statement. v4->v5
- hw/exynos4210_gic.c: Use memory aliases for CPU interface and Distributer. Excessive RW functions are removed.
- hw/exynos4210_pwm.c and hw/exynos4210_mct.c: Saving of timers added.
- hw/exynos4210_uart.c: VMSTATE version_id fixed.
v3->v4
- Split Exynos SOC and boards.
- Temporary removed SD and CMU support to post later.
- Lan9118 remarks took into account.
- Secondary CPU bootloader remarks took into account.
- PWM remarks took into account.
- UART remarks took into account.
v2->v3
- Reverted hw/arm_gic.c modification
- Added IRQ Gate to Exynos4210 board.
Evgeny Voevodin (8):
hw/sysbus.h: Increase maximum number of device IRQs. hw/arm_boot.c: Make SMP boards specify address to poll in bootup loop
ARM: exynos4210: IRQ subsystem support.
ARM: Samsung exynos4210-based boards emulation
ARM: exynos4210: PWM support.
ARM: exynos4210: MCT support.
hw/lan9118: Add basic 16-bit mode support. hw/exynos4210.c: Add LAN support for SMDKC210.
Maksim Kozlov (1):
ARM: exynos4210: UART support
Mitsyanko Igor (1):
Exynos4210: added display controller implementation
Makefile.target | 3 + hw/arm-misc.h | 1 + hw/arm_boot.c | 18 +- hw/exynos4210.c | 272 +++++++ hw/exynos4210.h | 128 +++ hw/exynos4210_combiner.c | 464 +++++++++++ hw/exynos4210_fimd.c | 1924 ++++++++++++++++++++++++++++++++++++++++++++++ hw/exynos4210_gic.c | 437 +++++++++++ hw/exynos4210_mct.c | 1479 +++++++++++++++++++++++++++++++++++ hw/exynos4210_pwm.c | 413 ++++++++++ hw/exynos4210_uart.c | 668 ++++++++++++++++ hw/exynos4_boards.c | 166 ++++ hw/lan9118.c | 115 +++- hw/realview.c | 2 + hw/sysbus.h | 2 +- hw/vexpress.c | 2 + 16 files changed, 6080 insertions(+), 14 deletions(-) create mode 100644 hw/exynos4210.c create mode 100644 hw/exynos4210.h create mode 100644 hw/exynos4210_combiner.c create mode 100644 hw/exynos4210_fimd.c create mode 100644 hw/exynos4210_gic.c create mode 100644 hw/exynos4210_mct.c create mode 100644 hw/exynos4210_pwm.c create mode 100644 hw/exynos4210_uart.c create mode 100644 hw/exynos4_boards.c
Signature · 1 line
1.7.4.1
PATCH v7 1/10 hw/sysbus.h: Increase maximum number of device IRQs.
Samsung exynos4210 Interrupt Combiner needs 512 IRQ sources.
--- hw/sysbus.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/sysbus.h +1 -1
@@ -8,7 +8,7 @@#define QDEV_MAX_MMIO 32#define QDEV_MAX_PIO 32 -#define QDEV_MAX_IRQ 256 +#define QDEV_MAX_IRQ 512typedef struct SysBusDevice SysBusDevice ;
Signature · 1 line
1.7.4.1
Re: [Qemu-devel] [PATCH v7 01/10] hw/sysbus.h: Increase maximum number of device IRQs.
Quoted 1 line · Evgeny Voevodin
Samsung exynos4210 Interrupt Combiner needs 512 IRQ sources.
Thanks, I applied this patch and the second one reviewed by Peter Maydell. I haven't look at the other patches but on quick glance the code formatting is still a little off in places.
Cheers
PATCH v7 2/10 hw/arm_boot.c: Make SMP boards specify address to poll in bootup loop
In reply to Evgeny VoevodinThe secondary CPU bootloader in arm_boot.c holds secondary CPUs in a pen until the primary CPU releases them. Make boards specify the address to be polled to determine whether to leave the pen (it was previously hardcoded to 0x10000030, which is a Versatile Express/ Realview specific system register address).
--- hw/arm-misc.h | 1 + hw/arm_boot.c | 18 ++++++++++-------- hw/realview.c | 2 ++ hw/vexpress.c | 2 ++ 4 files changed, 15 insertions(+), 8 deletions(-)
hw/arm-misc.h +1 -0
@@ -31,6 +31,7 @@ struct arm_boot_info {const char *initrd_filename;target_phys_addr_t loader_start;target_phys_addr_t smp_loader_start; +target_phys_addr_t smp_bootreg_addr;target_phys_addr_t smp_priv_base;int nb_cpus;int board_id;
hw/arm_boot.c +10 -8
@@ -31,17 +31,17 @@ static uint32_t bootloader[] = {/* Entry point for secondary CPUs. Enable interrupt controller and Issue WFI until start address is written to system controller. */ static uint32_t smpboot[] = { -0xe59f0020 ,/* ldr r0, privbase */ -0xe3a01001 ,/* mov r1, #1 */ -0xe5801100 ,/* str r1, [r0, #0x100] */ -0xe3a00201 ,/* mov r0, #0x10000000 */ -0xe3800030 ,/* orr r0, #0x30 */ +0xe59f201c ,/* ldr r2, privbase */ +0xe59f001c ,/* ldr r0, startaddr */ +0xe3a01001 ,/* mov r1, #1 */ +0xe5821100 ,/* str r1, [r2, #256] */ 0xe320f003 ,/* wfi */ 0xe5901000 ,/* ldr r1, [r0] */ 0xe1110001 ,/* tst r1, r1 */ 0x0afffffb ,/* beq <wfi> */ 0xe12fff11 ,/* bx r1 */ -0 /* privbase: Private memory region base address. */ +0 ,/* privbase: Private memory region base address. */ +0 /* bootreg: Boot register address is held here */ };#define WRITE_WORD (p, value) do { \
@@ -197,6 +197,7 @@ static void do_cpu_reset(void *opaque) info->loader_start); } }else { +stl_phys_notdirty (info->smp_bootreg_addr,0 ); env->regs[15 ] = info->smp_loader_start; } }
@@ -272,8 +273,9 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)rom_add_blob_fixed ("bootloader" , bootloader,sizeof (bootloader), info->loader_start);if (info->nb_cpus >1 ) { - smpboot[10 ] = info->smp_priv_base; -for (n =0 ; n <sizeof (smpboot) /4 ; n++) { + smpboot[ARRAY_SIZE (smpboot) -1 ] = info->smp_bootreg_addr; + smpboot[ARRAY_SIZE (smpboot) -2 ] = info->smp_priv_base; +for (n =0 ; n <ARRAY_SIZE (smpboot); n++) { smpboot[n] =tswap32 (smpboot[n]); } rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot),
hw/realview.c +2 -0
@@ -21,6 +21,7 @@#include "exec-memory.h" #define SMP_BOOT_ADDR 0xe0000000 +#define SMP_BOOTREG_ADDR 0x10000030 typedef struct { SysBusDevice busdev;
@@ -96,6 +97,7 @@ static void realview_register_devices(void)static struct arm_boot_info realview_binfo = { .smp_loader_start =SMP_BOOT_ADDR , + .smp_bootreg_addr =SMP_BOOTREG_ADDR , };/* The following two lists must be consistent. */
hw/vexpress.c +2 -0
@@ -31,11 +31,13 @@#include "exec-memory.h" #define SMP_BOOT_ADDR 0xe0000000 +#define SMP_BOOTREG_ADDR 0x10000030#define VEXPRESS_BOARD_ID 0x8e0static struct arm_boot_info vexpress_binfo = { .smp_loader_start =SMP_BOOT_ADDR , + .smp_bootreg_addr =SMP_BOOTREG_ADDR , }; static void vexpress_a9_init(ram_addr_t ram_size,
Signature · 1 line
1.7.4.1
PATCH v7 3/10 ARM: exynos4210: IRQ subsystem support.
In reply to Evgeny Voevodin--- Makefile.target | 1 + hw/exynos4210.h | 82 ++++++++ hw/exynos4210_combiner.c | 464 ++++++++++++++++++++++++++++++++++++++++++++++ hw/exynos4210_gic.c | 437 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 984 insertions(+), 0 deletions(-) create mode 100644 hw/exynos4210.h create mode 100644 hw/exynos4210_combiner.c create mode 100644 hw/exynos4210_gic.c
Makefile.target +1 -0
@@ -339,6 +339,7 @@ obj-arm-y = integratorcp.o versatilepb.o arm_pic.o arm_timer.o obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o obj-arm-y += versatile_pci.o obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o +obj-arm-y += exynos4210_gic.o exynos4210_combiner.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
hw/exynos4210.h new file +82 -0
82 lines not on this page · raw message
hw/exynos4210_combiner.c new file +464 -0
464 lines not on this page · raw message
hw/exynos4210_gic.c new file +437 -0
437 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v7 4/10 ARM: Samsung exynos4210-based boards emulation
In reply to Evgeny VoevodinAdd initial support of NURI and SMDKC210 boards
--- Makefile.target | 3 +- hw/exynos4210.c | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++ hw/exynos4210.h | 37 +++++++++ hw/exynos4_boards.c | 143 ++++++++++++++++++++++++++++++++++++ 4 files changed, 384 insertions(+), 1 deletions(-) create mode 100644 hw/exynos4210.c create mode 100644 hw/exynos4_boards.c
Makefile.target +2 -1
@@ -339,7 +339,8 @@ obj-arm-y = integratorcp.o versatilepb.o arm_pic.o arm_timer.o obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o obj-arm-y += versatile_pci.o obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o -obj-arm-y += exynos4210_gic.o exynos4210_combiner.o +obj-arm-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o +obj-arm-y += exynos4_boards.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
hw/exynos4210.c new file +202 -0
202 lines not on this page · raw message
hw/exynos4210.h +37 -0
@@ -31,6 +31,25 @@#define EXYNOS4210_MAX_CPUS 2 +#define EXYNOS4210_DRAM0_BASE_ADDR 0x40000000 +#define EXYNOS4210_DRAM1_BASE_ADDR 0xa0000000 +#define EXYNOS4210_DRAM_MAX_SIZE 0x60000000/* 1.5 GB */ + +#define EXYNOS4210_IROM_BASE_ADDR 0x00000000 +#define EXYNOS4210_IROM_SIZE 0x00010000/* 64 KB */ +#define EXYNOS4210_IROM_MIRROR_BASE_ADDR 0x02000000 +#define EXYNOS4210_IROM_MIRROR_SIZE 0x00010000/* 64 KB */ + +#define EXYNOS4210_IRAM_BASE_ADDR 0x02020000 +#define EXYNOS4210_IRAM_SIZE 0x00020000/* 128 KB */ + +/* Secondary CPU startup code is in IROM memory */ +#define EXYNOS4210_SMP_BOOT_ADDR EXYNOS4210_IROM_BASE_ADDR +#define EXYNOS4210_BASE_BOOT_ADDR EXYNOS4210_DRAM0_BASE_ADDR +/* Secondary CPU polling address to get loader start from */ +#define EXYNOS4210_SECOND_CPU_BOOTREG 0x10020814 +#define EXYNOS4210_SMP_PRIVATE_BASE_ADDR 0x10500000 +/* * exynos4210 IRQ subsystem stub definitions. */
@@ -60,6 +79,24 @@ typedef struct Exynos4210Irq {qemu_irq board_irqs[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ ]; } Exynos4210Irq; +typedef struct Exynos4210State { +CPUState * env[EXYNOS4210_MAX_CPUS ]; +Exynos4210Irq irqs; +qemu_irq *irq_table; + +MemoryRegion chipid_mem; +MemoryRegion iram_mem; +MemoryRegion irom_mem; +MemoryRegion irom_alias_mem; +MemoryRegion dram0_mem; +MemoryRegion dram1_mem; +MemoryRegion hack_mem; +MemoryRegion bootreg_mem; +}Exynos4210State ; + +Exynos4210State *exynos4210_init (MemoryRegion *system_mem, +unsigned long ram_size); +/* Initialize exynos4210 IRQ subsystem stub */ qemu_irq *exynos4210_init_irq (Exynos4210Irq *env);
hw/exynos4_boards.c new file +143 -0
143 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v7 5/10 ARM: exynos4210: UART support
In reply to Evgeny VoevodinFrom: Maksim Kozlov <[email protected]>
Add basic support of exynos4210 UART
--- Makefile.target | 2 +- hw/exynos4210.c | 29 +++ hw/exynos4210.h | 9 + hw/exynos4210_uart.c | 668 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 707 insertions(+), 1 deletions(-) create mode 100644 hw/exynos4210_uart.c
Makefile.target +1 -1
@@ -340,7 +340,7 @@ obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o obj-arm-y += versatile_pci.o obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o -obj-arm-y += exynos4_boards.o +obj-arm-y += exynos4_boards.o exynos4210_uart.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
hw/exynos4210.c +29 -0
@@ -29,6 +29,18 @@#define EXYNOS4210_CHIPID_ADDR 0x10000000 +/* UART's definitions */ +#define EXYNOS4210_UART0_BASE_ADDR 0x13800000 +#define EXYNOS4210_UART1_BASE_ADDR 0x13810000 +#define EXYNOS4210_UART2_BASE_ADDR 0x13820000 +#define EXYNOS4210_UART3_BASE_ADDR 0x13830000 +#define EXYNOS4210_UART0_FIFO_SIZE 256 +#define EXYNOS4210_UART1_FIFO_SIZE 64 +#define EXYNOS4210_UART2_FIFO_SIZE 16 +#define EXYNOS4210_UART3_FIFO_SIZE 16 +/* Interrupt Group of External Interrupt Combiner for UART */ +#define EXYNOS4210_UART_INT_GRP 26 +/* External GIC */ #define EXYNOS4210_EXT_GIC_CPU_BASE_ADDR 0x10480000#define EXYNOS4210_EXT_GIC_DIST_BASE_ADDR 0x10490000
@@ -198,5 +210,22 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,memory_region_add_subregion (system_mem,EXYNOS4210_SECOND_CPU_BOOTREG , &s->bootreg_mem); +/*** UARTs ***/ +exynos4210_uart_create (EXYNOS4210_UART0_BASE_ADDR , +EXYNOS4210_UART0_FIFO_SIZE ,0 ,NULL , + irq_table[exynos4210_get_irq (EXYNOS4210_UART_INT_GRP ,0 )]); + +exynos4210_uart_create (EXYNOS4210_UART1_BASE_ADDR , +EXYNOS4210_UART1_FIFO_SIZE ,1 ,NULL , + irq_table[exynos4210_get_irq (EXYNOS4210_UART_INT_GRP ,1 )]); + +exynos4210_uart_create (EXYNOS4210_UART2_BASE_ADDR , +EXYNOS4210_UART2_FIFO_SIZE ,2 ,NULL , + irq_table[exynos4210_get_irq (EXYNOS4210_UART_INT_GRP ,2 )]); + +exynos4210_uart_create (EXYNOS4210_UART3_BASE_ADDR , +EXYNOS4210_UART3_FIFO_SIZE ,3 ,NULL , + irq_table[exynos4210_get_irq (EXYNOS4210_UART_INT_GRP ,3 )]); +return s; }
hw/exynos4210.h +9 -0
@@ -116,4 +116,13 @@ uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit);void exynos4210_combiner_get_gpioin (Exynos4210Irq *irqs,DeviceState *dev,int ext); +/* +* exynos4210 UART +*/ +DeviceState *exynos4210_uart_create (target_phys_addr_t addr, +int fifo_size, +int channel, +CharDriverState *chr, +qemu_irq irq); +#endif /* EXYNOS4210_H_ */
hw/exynos4210_uart.c new file +668 -0
668 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v7 6/10 ARM: exynos4210: PWM support.
In reply to Evgeny Voevodin--- Makefile.target | 2 +- hw/exynos4210.c | 12 ++ hw/exynos4210_pwm.c | 413 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 426 insertions(+), 1 deletions(-) create mode 100644 hw/exynos4210_pwm.c
Makefile.target +1 -1
@@ -340,7 +340,7 @@ obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o obj-arm-y += versatile_pci.o obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o -obj-arm-y += exynos4_boards.o exynos4210_uart.o +obj-arm-y += exynos4_boards.o exynos4210_uart.o exynos4210_pwm.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
hw/exynos4210.c +12 -0
@@ -29,6 +29,9 @@#define EXYNOS4210_CHIPID_ADDR 0x10000000 +/* PWM */ +#define EXYNOS4210_PWM_BASE_ADDR 0x139D0000 +/* UART's definitions */ #define EXYNOS4210_UART0_BASE_ADDR 0x13800000#define EXYNOS4210_UART1_BASE_ADDR 0x13810000
@@ -210,6 +213,15 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,memory_region_add_subregion (system_mem,EXYNOS4210_SECOND_CPU_BOOTREG , &s->bootreg_mem); +/* PWM */ +sysbus_create_varargs ("exynos4210.pwm" ,EXYNOS4210_PWM_BASE_ADDR , + irq_table[exynos4210_get_irq (22 ,0 )], + irq_table[exynos4210_get_irq (22 ,1 )], + irq_table[exynos4210_get_irq (22 ,2 )], + irq_table[exynos4210_get_irq (22 ,3 )], + irq_table[exynos4210_get_irq (22 ,4 )], +NULL ); +/*** UARTs ***/ exynos4210_uart_create(EXYNOS4210_UART0_BASE_ADDR, EXYNOS4210_UART0_FIFO_SIZE, 0, NULL,
hw/exynos4210_pwm.c new file +413 -0
413 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v7 7/10 ARM: exynos4210: MCT support.
In reply to Evgeny Voevodin--- Makefile.target | 1 + hw/exynos4210.c | 19 + hw/exynos4210_mct.c | 1479 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1499 insertions(+), 0 deletions(-) create mode 100644 hw/exynos4210_mct.c
Makefile.target +1 -0
@@ -341,6 +341,7 @@ obj-arm-y += versatile_pci.o obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o obj-arm-y += exynos4_boards.o exynos4210_uart.o exynos4210_pwm.o +obj-arm-y += exynos4210_mct.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
hw/exynos4210.c +19 -0
@@ -32,6 +32,9 @@/* PWM */ #define EXYNOS4210_PWM_BASE_ADDR 0x139D0000 +/* MCT */ +#define EXYNOS4210_MCT_BASE_ADDR 0x10050000 +/* UART's definitions */ #define EXYNOS4210_UART0_BASE_ADDR 0x13800000#define EXYNOS4210_UART1_BASE_ADDR 0x13810000
@@ -222,6 +225,22 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem, irq_table[exynos4210_get_irq (22 ,4 )], NULL); +/* Multi Core Timer */ + dev =qdev_create (NULL ,"exynos4210.mct" ); +qdev_init_nofail (dev); + busdev =sysbus_from_qdev (dev); +for (n =0 ; n <4 ; n++) { +/* Connect global timer interrupts to Combiner gpio_in */ +sysbus_connect_irq (busdev, n, + irq_table[exynos4210_get_irq (1 ,4 + n)]); + } +/* Connect local timer interrupts to Combiner gpio_in */ +sysbus_connect_irq (busdev,4 , + irq_table[exynos4210_get_irq (51 ,0 )]); +sysbus_connect_irq (busdev,5 , + irq_table[exynos4210_get_irq (35 ,3 )]); +sysbus_mmio_map (busdev,0 ,EXYNOS4210_MCT_BASE_ADDR ); +/*** UARTs ***/ exynos4210_uart_create(EXYNOS4210_UART0_BASE_ADDR, EXYNOS4210_UART0_FIFO_SIZE, 0, NULL,
hw/exynos4210_mct.c new file +1479 -0
1,479 lines not on this page · raw message
Signature · 1 line
1.7.4.1
Re: [Qemu-devel] [PATCH v7 07/10] ARM: exynos4210: MCT support.
On 16 January 2012 06:48, Evgeny Voevodin <[email protected]> wrote:
This doesn't compile on 32 bit hosts:
CC arm-softmmu/exynos4210_mct.o
cc1: warnings being treated as errors /home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c: In function ‘exynos4210_gcomp_get_distance’:/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:485:
error: integer constant is too large for ‘long’ type /home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:487:
error: integer constant is too large for ‘long’ type /home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:490:
error: integer constant is too large for ‘long’ type /home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c: In function ‘exynos4210_gfrc_restart’:/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:507:
error: integer constant is too large for ‘long’ type /home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:508:
error: integer constant is too large for ‘long’ type /home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c: In function ‘exynos4210_gfrc_event’:/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:575:
error: integer constant is too large for ‘long’ type /home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:576:
error: integer constant is too large for ‘long’ type /home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c: In function ‘exynos4210_lfrc_update_count’:/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:599:
error: integer constant is too large for ‘long’ type /home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c: In function ‘exynos4210_ltick_recalc_count’:/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:843:
error: integer constant is too large for ‘long’ type /home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:845:
error: integer constant is too large for ‘long’ type make[1]: *** [exynos4210_mct.o] Error 1
These two 64 bit constants need a ULL suffix:
hw/exynos4210_mct.c line 181
Quoted 2 lines
hw/exynos4210_mct.c new file +2
-0+#define MCT_GT_COUNTER_STEP 0x100000000 +#define MCT_LT_COUNTER_STEP 0x100000000
-- PMM
Re: [Qemu-devel] [PATCH v7 07/10] ARM: exynos4210: MCT support.
Quoted 37 lines · Peter Maydell
On 16 January 2012 06:48, Evgeny Voevodin<[email protected]> wrote:
This doesn't compile on 32 bit hosts:CC
arm-softmmu/exynos4210_mct.o
cc1: warnings being treated as errors/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c: In function ‘exynos4210_gcomp_get_distance’:/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:485:
error: integer constant is too large for ‘long’ type/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:487:
error: integer constant is too large for ‘long’ type/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:490:
error: integer constant is too large for ‘long’ type/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c: In function ‘exynos4210_gfrc_restart’:/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:507:
error: integer constant is too large for ‘long’ type/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:508:
error: integer constant is too large for ‘long’ type/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c: In function ‘exynos4210_gfrc_event’:/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:575:
error: integer constant is too large for ‘long’ type/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:576:
error: integer constant is too large for ‘long’ type/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c: In function ‘exynos4210_lfrc_update_count’:/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:599:
error: integer constant is too large for ‘long’ type/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c: In function ‘exynos4210_ltick_recalc_count’:/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:843:
error: integer constant is too large for ‘long’ type/home/petmay01/linaro/qemu-from-laptop/qemu/hw/exynos4210_mct.c:845:
error: integer constant is too large for ‘long’ type make[1]: *** [exynos4210_mct.o] Error 1
Quoted 6 lines
These two 64 bit constants need a ULL suffix:
hw/exynos4210_mct.c line 181
Quoted 2 lines
hw/exynos4210_mct.c new file +2
-0+#define MCT_GT_COUNTER_STEP 0x100000000 +#define MCT_LT_COUNTER_STEP 0x100000000-- PMM
Thanks. gcc 4.5 compiles it quietly on our systems, but 4.4 reports warnings. Will fix and provide v8 soon.
Signature · 5 lines
Kind regards, Evgeny Voevodin, Leading Software Engineer, ASWG, Moscow R&D center, Samsung Electronics e-mail: [email protected]
PATCH v7 8/10 hw/lan9118: Add basic 16-bit mode support.
In reply to Evgeny Voevodin--- hw/lan9118.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 110 insertions(+), 5 deletions(-)
hw/lan9118.c +110 -5
@@ -216,6 +216,17 @@ typedef struct {int rxp_offset;int rxp_size;int rxp_pad; + +uint32_t write_word_prev_offset; +uint32_t write_word_n; +uint16_t write_word_l; +uint16_t write_word_h; +uint32_t read_word_prev_offset; +uint32_t read_word_n; +uint32_t read_long; + +uint32_t mode_16bit; + } lan9118_state;static void lan9118_update (lan9118_state *s)
@@ -310,7 +321,7 @@ static void lan9118_reset(DeviceState *d) s->fifo_int =0x48000000 ; s->rx_cfg =0 ; s->tx_cfg =0 ; - s->hw_cfg =0x00050000 ; + s->hw_cfg = s->mode_16bit ?0x00050000 :0x00050004 ; s->pmt_ctrl &=0x45 ; s->gpio_cfg =0 ; s->txp->fifo_used =0 ;
@@ -349,6 +360,9 @@ static void lan9118_reset(DeviceState *d) s->mac_mii_data =0 ; s->mac_flow =0 ; + s->read_word_n =0 ; + s->write_word_n =0 ; +phy_reset (s); s->eeprom_writable =0 ;
@@ -904,7 +918,7 @@ static void lan9118_writel(void *opaque, target_phys_addr_t offset, {lan9118_state *s = (lan9118_state *)opaque; offset &=0xff ; - +//DPRINTF("Write reg 0x%02x = 0x%08x\n", (int)offset, val); if (offset >=0x20 && offset <0x40 ) {/* TX FIFO */
@@ -954,7 +968,7 @@ static void lan9118_writel(void *opaque, target_phys_addr_t offset,/* SRST */ lan9118_reset (&s->busdev.qdev); }else { - s->hw_cfg = val &0x003f300 ; + s->hw_cfg = (val &0x003f300 ) | (s->hw_cfg &0x4 ); }break ;case CSR_RX_DP_CTRL :
@@ -1033,6 +1047,46 @@ static void lan9118_writel(void *opaque, target_phys_addr_t offset,lan9118_update (s); } +static void lan9118_writew (void *opaque,target_phys_addr_t offset, +uint32_t val) +{ +lan9118_state *s = (lan9118_state *)opaque; + offset &=0xff ; + +if (s->write_word_prev_offset != (offset & ~0x3 )) { +/* New offset, reset word counter */ + s->write_word_n =0 ; + s->write_word_prev_offset = offset & ~0x3 ; + } + +if (offset &0x2 ) { + s->write_word_h = val; + }else { + s->write_word_l = val; + } + +//DPRINTF("Writew reg 0x%02x = 0x%08x\n", (int)offset, val); + s->write_word_n++; +if (s->write_word_n ==2 ) { + s->write_word_n =0 ; +lan9118_writel (s, offset & ~3 , s->write_word_l + + (s->write_word_h <<16 ),4 ); + } +} + +static void lan9118_16bit_mode_write (void *opaque,target_phys_addr_t offset, +uint64_t val,unsigned size) +{ +switch (size) { +case 2 : +return lan9118_writew (opaque, offset, (uint32_t )val); +case 4 : +return lan9118_writel (opaque, offset, val, size); + } + +hw_error ("lan9118_write: Bad size 0x%x\n" , size); +} +static uint64_t lan9118_readl (void *opaque,target_phys_addr_t offset,unsigned size) {
@@ -1069,7 +1123,7 @@ static uint64_t lan9118_readl(void *opaque, target_phys_addr_t offset,case CSR_TX_CFG :return s->tx_cfg;case CSR_HW_CFG : -return s->hw_cfg |0x4 ; +return s->hw_cfg;case CSR_RX_DP_CTRL :return 0 ;case CSR_RX_FIFO_INF :
@@ -1107,12 +1161,60 @@ static uint64_t lan9118_readl(void *opaque, target_phys_addr_t offset,return 0 ; } +static uint32_t lan9118_readw (void *opaque,target_phys_addr_t offset) +{ +lan9118_state *s = (lan9118_state *)opaque; +uint32_t val; + +if (s->read_word_prev_offset != (offset & ~0x3 )) { +/* New offset, reset word counter */ + s->read_word_n =0 ; + s->read_word_prev_offset = offset & ~0x3 ; + } + + s->read_word_n++; +if (s->read_word_n ==1 ) { + s->read_long =lan9118_readl (s, offset & ~3 ,4 ); + }else { + s->read_word_n =0 ; + } + +if (offset &2 ) { + val = s->read_long >>16 ; + }else { + val = s->read_long &0xFFFF ; + } + +//DPRINTF("Readw reg 0x%02x, val 0x%x\n", (int)offset, val); +return val; +} + +static uint64_t lan9118_16bit_mode_read (void *opaque,target_phys_addr_t offset, +unsigned size) +{ +switch (size) { +case 2 : +return lan9118_readw (opaque, offset); +case 4 : +return lan9118_readl (opaque, offset, size); + } + +hw_error ("lan9118_read: Bad size 0x%x\n" , size); +return 0 ; +} +static const MemoryRegionOps lan9118_mem_ops = { .read = lan9118_readl, .write = lan9118_writel, .endianness =DEVICE_NATIVE_ENDIAN , }; +static const MemoryRegionOps lan9118_16bit_mem_ops = { + .read = lan9118_16bit_mode_read, + .write = lan9118_16bit_mode_write, + .endianness =DEVICE_NATIVE_ENDIAN , +}; +static void lan9118_cleanup (VLANClientState *nc) {lan9118_state *s =DO_UPCAST (NICState, nc, nc)->opaque;
@@ -1134,8 +1236,10 @@ static int lan9118_init1(SysBusDevice *dev)lan9118_state *s =FROM_SYSBUS (lan9118_state, dev);QEMUBH *bh;int i; +const MemoryRegionOps *mem_ops = + s->mode_16bit ? &lan9118_16bit_mem_ops : &lan9118_mem_ops; -memory_region_init_io (&s->mmio, &lan9118_mem_ops, s,"lan9118-mmio" ,0x100 ); +memory_region_init_io (&s->mmio, mem_ops, s,"lan9118-mmio" ,0x100 );sysbus_init_mmio (dev, &s->mmio);sysbus_init_irq (dev, &s->irq);qemu_macaddr_default_if_unset (&s->conf.macaddr);
@@ -1166,6 +1270,7 @@ static SysBusDeviceInfo lan9118_info = { .qdev.reset = lan9118_reset, .qdev.props = (Property []) {DEFINE_NIC_PROPERTIES (lan9118_state, conf), +DEFINE_PROP_UINT32 ("mode_16bit" , lan9118_state, mode_16bit,0 ),DEFINE_PROP_END_OF_LIST (), } };
Signature · 1 line
1.7.4.1
PATCH v7 9/10 hw/exynos4210.c: Add LAN support for SMDKC210.
In reply to Evgeny VoevodinSMDKC210 uses lan9215 chip, but lan9118 in 16-bit mode seems to be enough.
--- hw/exynos4_boards.c | 27 +++++++++++++++++++++++++-- 1 files changed, 25 insertions(+), 2 deletions(-)
hw/exynos4_boards.c +25 -2
@@ -23,6 +23,7 @@#include "sysemu.h" #include "sysbus.h" +#include "net.h" #include "arm-misc.h" #include "exec-memory.h" #include "exynos4210.h"
@@ -42,6 +43,8 @@ #define PRINT_DEBUG(fmt, args...) do {} while (0)#endif +#define SMDK_LAN9118_BASE_ADDR 0x05000000 + typedef enum exynos4_board_type { EXYNOS4_BOARD_NURI, EXYNOS4_BOARD_SMDKC210,
@@ -68,6 +71,24 @@ static struct arm_boot_info exynos4_board_binfo = { .smp_loader_start = EXYNOS4210_SMP_BOOT_ADDR, }; +static void lan9215_init (uint32_t base,qemu_irq irq) +{ +DeviceState *dev; +SysBusDevice *s; + +/* This should be a 9215 but the 9118 is close enough */ +if (nd_table[0 ].vlan) { +qemu_check_nic_model (&nd_table[0 ],"lan9118" ); + dev =qdev_create (NULL ,"lan9118" ); +qdev_set_nic_properties (dev, &nd_table[0 ]); +qdev_prop_set_uint32 (dev,"mode_16bit" ,1 ); +qdev_init_nofail (dev); + s =sysbus_from_qdev (dev); +sysbus_mmio_map (s,0 , base); +sysbus_connect_irq (s,0 , irq); + } +} + static Exynos4210State *exynos4_boards_init_common( const char *kernel_filename, const char *kernel_cmdline,
@@ -114,9 +135,11 @@ static void smdkc210_init(ram_addr_t ram_size, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { -exynos4_boards_init_common (kernel_filename ,kernel_cmdline , -initrd_filename ,EXYNOS4_BOARD_SMDKC210 ); + Exynos4210State *s = exynos4_boards_init_common(kernel_filename, + kernel_cmdline, initrd_filename,EXYNOS4_BOARD_SMDKC210 ); +lan9215_init (SMDK_LAN9118_BASE_ADDR , +qemu_irq_invert (s->irq_table[exynos4210_get_irq (37 ,1 )]));arm_load_kernel (first_cpu, &exynos4_board_binfo); }
Signature · 1 line
1.7.4.1
Re: [Qemu-devel] [PATCH v7 09/10] hw/exynos4210.c: Add LAN support for SMDKC210.
Quoted 4 lines · Evgeny Voevodin
SMDKC210 uses lan9215 chip, but lan9118 in 16-bit mode seems to be enough.
Signed-off-by Evgeny Voevodin <[email protected]>
-- PMM
PATCH v7 10/10 Exynos4210: added display controller implementation
In reply to Evgeny VoevodinFrom: Mitsyanko Igor <[email protected]>
Exynos4210 display controller (FIMD) has 5 hardware windows with alpha and chroma key blending functions.
--- Makefile.target | 2 +- hw/exynos4210.c | 10 + hw/exynos4210_fimd.c | 1924 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1935 insertions(+), 1 deletions(-) create mode 100644 hw/exynos4210_fimd.c
Makefile.target +1 -1
@@ -341,7 +341,7 @@ obj-arm-y += versatile_pci.o obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o obj-arm-y += exynos4_boards.o exynos4210_uart.o exynos4210_pwm.o -obj-arm-y += exynos4210_mct.o +obj-arm-y += exynos4210_mct.o exynos4210_fimd.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
hw/exynos4210.c +10 -0
@@ -55,6 +55,9 @@#define EXYNOS4210_EXT_COMBINER_BASE_ADDR 0x10440000#define EXYNOS4210_INT_COMBINER_BASE_ADDR 0x10448000 +/* Display controllers (FIMD) */ +#define EXYNOS4210_FIMD0_BASE_ADDR 0x11C00000 +static uint8_t chipid_and_omr[] = {0x11 ,0x02 ,0x21 ,0x43 ,0x09 ,0x00 ,0x00 ,0x00 };
@@ -258,5 +261,12 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,EXYNOS4210_UART3_FIFO_SIZE ,3 ,NULL , irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 3)]); +/*** Display controller (FIMD) ***/ +sysbus_create_varargs ("exynos4210.fimd" ,EXYNOS4210_FIMD0_BASE_ADDR , + irq_table[exynos4210_get_irq (11 ,0 )], + irq_table[exynos4210_get_irq (11 ,1 )], + irq_table[exynos4210_get_irq (11 ,2 )], +NULL ); +return s; }
hw/exynos4210_fimd.c new file +1924 -0
1,924 lines not on this page · raw message
Signature · 1 line
1.7.4.1