Skip to contentSkip to conversation

ARM: Samsung Exynos4210-based boards support.

PATCH Superseded Evgeny Voevodin 4 participants 27 messages Jan 30, 2012 – Feb 3, 2012

Subsystems (2)

v11 of 16 Superseded Latest is v16 →

lore
Share & tools
lore
#0 lore raw

v11 cover ARM: Samsung Exynos4210-based boards support.

This set of patches adds support for Samsung Exynos4210-based boards NURI and SMDKC210. Tested on Linux kernel v3.x series.

Usage:
"-smp 2" option is mandatory for now.
Linux kernel v3.x configured with exynos4_defconfig can be used for boards models testing with rootfs on initrd.

To enable support of framebuffer in kernel, enable Samsung S3C framebuffer driver in kernel configuration.
Note: at present time (26.01.2012) Samsung S3C framebuffer support in mainline kernel is broken. This problem will be solved soon by Samsung kernel developers. People interested in enabling framebuffer right now can patch Linux kernel source files a bit to fix S3C framebuffer support:
- in array init_clocks_off (file arch/arm/mach-exynos/clock.c) for a member with .devname = "exynos4-fb.0" replace .name from "fimd" to "lcd";
- for framebuffer support on nuri board you need to additionally change file arch/arm/mach-exynos/common.c:
add include file
"#include <linux/dma-mapping.h>"
and add string
init_consistent_dma_size(SZ_2M + SZ_4M);
at the very beginning of function "void __init exynos4_map_io(void)".

To enable support of ethernet on smdkc210 board, enable SMSC LAN911x/LAN921x families embedded ethernet driver in Linux kernel configuration file.
Note: NURI board does not have ethernet adapter and currently has no net support.

Example usage:
Boot smdkc210 board with root filesystem on NFS disk.

# qemu-system-arm -kernel ./zImage -append "ip=dhcp root=/dev/nfs nfsroot=10.0.2.2:/srv/nfs/ rw rootwait" -M smdkc210 -smp 2

Boot smdkc210 board with root filesystem on NFS disk and serial port #0 redirected to terminal

# qemu-system-arm -kernel ./zImage -append "console=ttySAC0,115200n8 ip=dhcp root=/dev/nfs nfsroot=10.0.2.2:/srv/nfs/ rw " -serial stdio -M smdkc210 -smp 2

Boot NURI with rootfs on inird and serial port #0 redirected to terminal

# qemu-system-arm -kernel ./zImage -append "console=ttySAC0,115200n8 root=/dev/ram rw " -serial stdio -M nuri -smp 2 -initrd ./rootfs.ext2

Changelog:
v10->v11
- rebased and converted to QOM: hw/exynos4210_combiner.c, hw/exynos4210_gic.c, hw/exynos4210_fimd.c, hw/exynos4210_mct.c, hw/exynos4210_pmu.c, hw/exynos4210_pwm.c, hw/exynos4210_uart.c.
Also we have removed "Reviewed-by:" from those patches touched by conversion to QOM.
v9->v10
- hw/lan9118.c: fixed migration-breaking bug in previous patch version;
- hw/exynos4210_pmu.c: we do not waste space for non-existing registers in PMU state anymore;

                        non-existing registers are now RAZ/WI;
                        added vmstate structure;

v8->v9
- exynos4210.c: secondary cpu bootloader memory region allocation is removed (it resides in already allocated IROM), removed hack memory region for secondary CPU boot loader (PMU device added). added l2x0 cache controller
- exynos4210_pmu.c: PMU registers modelling device added to emulation. It is needed since PMU contains INFORM5 register which is used to boot the secondary CPUs.
- exynos4_boards.c: indentation fix
- exynos4210_uart.c: indentation fix, BREAK event handling code added, fixed size of allocated registers region
- exynos4210_gic.c: number of IRQs passed to gic_init() due to last mainline update.
- lan9118.: added VMSTATE fields due to last mainline update.
v7->v8
- exynos4_boards.c: lack of spaces fix
- exynos4210_gic.c: lack of spaces fix
- exynos4210_combiner.c: lack of spaces fix
- exynos4210_uart.c: lack of spaces fix, indentation fix
- exynos4210_mct.c: ULL suffix fix
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 (6):
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 (2):
ARM: exynos4210: UART support
ARM: exynos4210: basic Power Management Unit implementation

Mitsyanko Igor (1):
Exynos4210: added display controller implementation

 Makefile.target          |    3 +
 hw/exynos4210.c          |  272 +++++++
 hw/exynos4210.h          |  131 ++++
 hw/exynos4210_combiner.c |  481 ++++++++++++
 hw/exynos4210_fimd.c     | 1931 ++++++++++++++++++++++++++++++++++++++++++++++
 hw/exynos4210_gic.c      |  452 +++++++++++
 hw/exynos4210_mct.c      | 1486 +++++++++++++++++++++++++++++++++++
 hw/exynos4210_pmu.c      |  497 ++++++++++++
 hw/exynos4210_pwm.c      |  420 ++++++++++
 hw/exynos4210_uart.c     |  670 ++++++++++++++++
 hw/exynos4_boards.c      |  166 ++++
 hw/lan9118.c             |  124 +++-
 12 files changed, 6627 insertions(+), 6 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_pmu.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
#1 lore raw

PATCH v11 1/9 ARM: exynos4210: IRQ subsystem support.

---
 Makefile.target          |    1 +
 hw/exynos4210.h          |   82 ++++++++
 hw/exynos4210_combiner.c |  481 ++++++++++++++++++++++++++++++++++++++++++++++
 hw/exynos4210_gic.c      |  452 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1016 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
index 68481a3..1b17f15 100644
@@ -338,6 +338,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 +481 -0

481 lines not on this page · raw message

hw/exynos4210_gic.c new file +452 -0

452 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#3 lore raw

Re: [Qemu-devel] [PATCH v11 1/9] ARM: exynos4210: IRQ subsystem support.

In reply to Evgeny Voevodin

Am 30.01.2012 08:38, schrieb Evgeny Voevodin:

hw/exynos4210_combiner.c line 97

Quoted 12 lines

---

hw/exynos4210_combiner.c new file +2 -0
new file mode 100644
index 0000000..4d41a1a
 
+static const VMStateDescription VMState_Exynos4210CombinerGroupState = {
 
+static const VMStateDescription VMState_Exynos4210Combiner = {

Here the variable names should not be CamelCase.

Quoted 1 line

+static DeviceInfo exynos4210_combiner_info = {

This will need to be updated to TypeInfo after Anthony's series removes DeviceInfo.

Quoted 58 lines
hw/exynos4210_gic.c new file +52 -0
new file mode 100644
index 0000000..bd37e86
 
+#define    EXT_GIC_ID_TVENC   127
+#define    EXT_GIC_ID_MFC 126
+#define    EXT_GIC_ID_HDMI_I2C    125
+#define    EXT_GIC_ID_HDMI    124
+#define    EXT_GIC_ID_MIXER   123
+#define    EXT_GIC_ID_PCIe    122
+#define    EXT_GIC_ID_2D  121
+#define    EXT_GIC_ID_JPEG    120
+#define    EXT_GIC_ID_FIMC3   119
+#define    EXT_GIC_ID_FIMC2   118
+#define    EXT_GIC_ID_FIMC1   117
+#define    EXT_GIC_ID_FIMC0   116
+#define    EXT_GIC_ID_ROTATOR 115
+#define    EXT_GIC_ID_ONENAND_AUDI    114
+#define    EXT_GIC_ID_MIPI_DSI_2LANE  113
+#define    EXT_GIC_ID_MIPI_CSI_2LANE  112
+#define    EXT_GIC_ID_MIPI_DSI_4LANE  111
+#define    EXT_GIC_ID_MIPI_CSI_4LANE  110
+#define    EXT_GIC_ID_SDMMC   109
+#define    EXT_GIC_ID_HSMMC3  108
+#define    EXT_GIC_ID_HSMMC2  107
+#define    EXT_GIC_ID_HSMMC1  106
+#define    EXT_GIC_ID_HSMMC0  105
+#define    EXT_GIC_ID_MODEMIF 104
+#define    EXT_GIC_ID_USB_DEVICE  103
+#define    EXT_GIC_ID_USB_HOST    102
+#define    EXT_GIC_ID_MCT_G1  101
+#define    EXT_GIC_ID_SPI2    100
+#define    EXT_GIC_ID_SPI1    99
+#define    EXT_GIC_ID_SPI0    98
+#define    EXT_GIC_ID_I2C7    97
+#define    EXT_GIC_ID_I2C6    96
+#define    EXT_GIC_ID_I2C5    95
+#define    EXT_GIC_ID_I2C4    94
+#define    EXT_GIC_ID_I2C3    93
+#define    EXT_GIC_ID_I2C2    92
+#define    EXT_GIC_ID_I2C1    91
+#define    EXT_GIC_ID_I2C0    90
+#define    EXT_GIC_ID_MCT_G0  89
+#define    EXT_GIC_ID_UART4   88
+#define    EXT_GIC_ID_UART3   87
+#define    EXT_GIC_ID_UART2   86
+#define    EXT_GIC_ID_UART1   85
+#define    EXT_GIC_ID_UART0    84
+#define    EXT_GIC_ID_NFC      83
+#define    EXT_GIC_ID_IEM_IEC 82
+#define    EXT_GIC_ID_IEM_APC 81
+#define    EXT_GIC_ID_MCT_L1  80
+#define    EXT_GIC_ID_GPIO_XA 79
+#define    EXT_GIC_ID_GPIO_XB 78
+#define    EXT_GIC_ID_RTC_TIC 77
+#define    EXT_GIC_ID_RTC_ALARM   76

hw/exynos4210_gic.c line 89

Quoted 10 lines
hw/exynos4210_gic.c new file +10 -0
+#define    EXT_GIC_ID_WDT 75
+#define    EXT_GIC_ID_MCT_L0  74
+#define    EXT_GIC_ID_TIMER4  73
+#define    EXT_GIC_ID_TIMER3  72
+#define    EXT_GIC_ID_TIMER2  71
+#define    EXT_GIC_ID_TIMER1  70
+#define    EXT_GIC_ID_TIMER0  69
+#define    EXT_GIC_ID_PDMA1   68
+#define    EXT_GIC_ID_PDMA0   67
+#define    EXT_GIC_ID_MDMA_LCD0   66

The formatting looks interesting here... copied from an external header? Since they're in descending order maybe just inverse them and use an enum (gdb in mind)?

hw/exynos4210_gic.c line 91

Quoted 2 lines
hw/exynos4210_gic.c new file +2 -0
+
+enum ext_int {

CamelCase :)

hw/exynos4210_gic.c line 121

Quoted 6 lines
hw/exynos4210_gic.c new file +6 -0
+static uint32_t
+combiner_grp_to_gic_id[64-EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ][8] = {
+    /* int combiner groups 16-19 */
+    {}, {}, {}, {},
+    /* int combiner group 20 */
+    {0, EXT_GIC_ID_MDMA_LCD0},

Usually we use spaces inside braces.

Quoted 1 line

+static const VMStateDescription VMState_Exynos4210IRQGate = {

Not CamelCase ;)

But seriously, I really think review makes more sense when the patches can actually be applied unmodified. Since Peter, as I understood, does not have a kernel to test these machines himself, this will need to be rebased by you guys - either onto Anthony's designated qom-upstream.X branch or wait til next week for the patches to arrive in master.

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#4 lore raw

Re: [Qemu-devel] [PATCH v11 1/9] ARM: exynos4210: IRQ subsystem support.

Quoted 6 lines · Andreas Färber
Quoted 2 lines

+static const VMStateDescription VMState_Exynos4210IRQGate = {

Not CamelCase ;)

But seriously, I really think review makes more sense when the patches can actually be applied unmodified.

Out patches could be applied to current master without modification ;)

Quoted 2 lines

Since Peter, as I understood, does
not have a kernel to test these machines himself,

Anyone can get the kernel from kernel.org. It works with default configuration as mentioned in the cover letter.

Quoted 7 lines

this will need to be
rebased by you guys - either onto Anthony's designated qom-upstream.X branch or wait til next week for the patches to arrive in master.

Regards,
Andreas

Thanks for the remarks. It seems that our patches will not be applied until Anthony's patches come to upstream. If so, we will fix CamelCases and spaces, rebase and produce v12.
Could someone, please, advise a better/faster way: wait until Anthony's patches are landed into master or rebase on his branch? I'm afraid that till these patches are not in the master we could have to rebase many times if qom-upstream.X branch is used because we do not actually know which version will be last.

Signature · 5 lines
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: [email protected]
#5 lore raw

Re: [Qemu-devel] [PATCH v11 1/9] ARM: exynos4210: IRQ subsystem support.

Quoted 12 lines · Evgeny Voevodin

Thanks for the remarks. It seems that our patches will not be applied until Anthony's patches come to upstream. If so, we will fix CamelCases and spaces, rebase and
produce v12.
Could someone, please, advise a better/faster way: wait until Anthony's patches
are landed into master or rebase on his branch? I'm afraid that till these patches are not in
the master we could have to rebase many times if qom-upstream.X branch is used because we
do not actually know which version will be last.

IMHO, it is quite strange that our ready-to-use patches should wait until other patch set land into master. We can quickly fix CamelCases and spaces and produce v12 before next week, when, as Andreas said, Anthony's patches arrive.

Signature · 5 lines
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: [email protected]
#6 lore raw

Re: [Qemu-devel] [PATCH v11 1/9] ARM: exynos4210: IRQ subsystem support.

In reply to Andreas Färber
Quoted 1 line · Andreas Färber

The formatting looks interesting here... copied from an external header?

Copied from HW specification :)

Signature · 5 lines
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: [email protected]
#7 lore raw

PATCH v11 2/9 ARM: Samsung exynos4210-based boards emulation

In reply to Evgeny Voevodin

Add initial support of NURI and SMDKC210 boards

---
 Makefile.target     |    3 +-
 hw/exynos4210.c     |  193 +++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/exynos4210.h     |   40 +++++++++++
 hw/exynos4_boards.c |  143 +++++++++++++++++++++++++++++++++++++
 4 files changed, 378 insertions(+), 1 deletions(-)
 create mode 100644 hw/exynos4210.c
 create mode 100644 hw/exynos4_boards.c
Makefile.target +2 -1
index 1b17f15..93eb7d6 100644
@@ -338,7 +338,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 +193 -0

193 lines not on this page · raw message

hw/exynos4210.h +40 -0
index cef264b..621e75a 100644
@@ -31,6 +31,28 @@
 
 #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_SMP_BOOT_SIZE            0x1000
+#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
+#define EXYNOS4210_L2X0_BASE_ADDR           0x10502000
+
 /*
  * exynos4210 IRQ subsystem stub definitions.
  */
@@ -60,6 +82,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 boot_secondary;
+    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
#8 lore raw

PATCH v11 3/9 ARM: exynos4210: UART support

In reply to Evgeny Voevodin

From: 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 |  670 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 709 insertions(+), 1 deletions(-)
 create mode 100644 hw/exynos4210_uart.c
Makefile.target +1 -1
index 93eb7d6..4291619 100644
@@ -339,7 +339,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
index aff0081..3838b96 100644
@@ -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
@@ -189,5 +201,22 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
     memory_region_add_subregion(system_mem, EXYNOS4210_DRAM0_BASE_ADDR,
             &s->dram0_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
index 621e75a..11368e8 100644
@@ -119,4 +119,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 +670 -0

670 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#10 lore raw

PATCH v11 4/9 ARM: exynos4210: PWM support.

In reply to Evgeny Voevodin
---
 Makefile.target     |    2 +-
 hw/exynos4210.c     |   12 ++
 hw/exynos4210_pwm.c |  420 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 433 insertions(+), 1 deletions(-)
 create mode 100644 hw/exynos4210_pwm.c
Makefile.target +1 -1
index 4291619..5f0726d 100644
@@ -339,7 +339,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
index 3838b96..ea5a1f8 100644
@@ -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
@@ -201,6 +204,15 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
     memory_region_add_subregion(system_mem, EXYNOS4210_DRAM0_BASE_ADDR,
             &s->dram0_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 +420 -0

420 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#11 lore raw

Re: [Qemu-devel] [PATCH v11 4/9] ARM: exynos4210: PWM support.

Quoted 3 lines · Evgeny Voevodin

---

This patch should not contain "Reviewed-by:" since QOM usage was added. Apologise for it. Peter, could you, please, rereview it?

Signature · 5 lines
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: [email protected]
Reviewed-by
#12 lore raw

Re: [Qemu-devel] [PATCH v11 4/9] ARM: exynos4210: PWM support.

Quoted 9 lines · Evgeny Voevodin
Quoted 4 lines · Evgeny Voevodin

---

This patch should not contain "Reviewed-by:" since QOM usage was added. Apologise for it.
Peter, could you, please, rereview it?

(based on diff between v9 and v11 patch)

-- PMM

#13 lore raw

PATCH v11 5/9 ARM: exynos4210: basic Power Management Unit implementation

In reply to Evgeny Voevodin

From: Maksim Kozlov <[email protected]>

Patch adds basic model for Exynos4210 SoC PMU.
This model implements PMU registers just as a bulk of memory. Currently, the only reason this device exists is that secondary CPU boot loader uses PMU INFORM5 register as a holding pen.

---
 Makefile.target     |    1 +
 hw/exynos4210.c     |    9 +
 hw/exynos4210_pmu.c |  497 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 507 insertions(+), 0 deletions(-)
 create mode 100644 hw/exynos4210_pmu.c
Makefile.target +1 -0
index 5f0726d..5803072 100644
@@ -340,6 +340,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_pmu.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 +9 -0
index ea5a1f8..2e2dbf0 100644
@@ -52,6 +52,9 @@
 #define EXYNOS4210_EXT_COMBINER_BASE_ADDR   0x10440000
 #define EXYNOS4210_INT_COMBINER_BASE_ADDR   0x10448000
 
+/* PMU SFR base address */
+#define EXYNOS4210_PMU_BASE_ADDR            0x10020000
+
 static uint8_t chipid_and_omr[] = { 0x11, 0x02, 0x21, 0x43,
                                     0x09, 0x00, 0x00, 0x00 };
 
@@ -204,6 +207,12 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
     memory_region_add_subregion(system_mem, EXYNOS4210_DRAM0_BASE_ADDR,
             &s->dram0_mem);
 
+   /* PMU.
+    * The only reason of existence at the moment is that secondary CPU boot
+    * loader uses PMU INFORM5 register as a holding pen.
+    */
+    sysbus_create_simple("exynos4210.pmu", EXYNOS4210_PMU_BASE_ADDR, NULL);
+
     /* PWM */
     sysbus_create_varargs("exynos4210.pwm", EXYNOS4210_PWM_BASE_ADDR,
             irq_table[exynos4210_get_irq(22, 0)],
hw/exynos4210_pmu.c new file +497 -0

497 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#14 lore raw

Re: [Qemu-devel] [PATCH v11 5/9] ARM: exynos4210: basic Power Management Unit implementation

Quoted 6 lines · Evgeny Voevodin

From: Maksim Kozlov <[email protected]>

Patch adds basic model for Exynos4210 SoC PMU.
This model implements PMU registers just as a bulk of memory. Currently, the only reason this device exists is that secondary CPU boot loader uses PMU INFORM5 register as a holding pen.

Your cover letter's changelog says
- hw/exynos4210_pmu.c: we do not waste space for non-existing registers in PMU state anymore; non-existing registers are now RAZ/WI;

...wrong version of this patch, or is the cover letter wrong?

-- PMM

#15 lore raw

Re: [Qemu-devel] [PATCH v11 5/9] ARM: exynos4210: basic Power Management Unit implementation

Quoted 8 lines · Peter Maydell
Quoted 6 lines · Evgeny Voevodin

From: Maksim Kozlov<[email protected]>

Patch adds basic model for Exynos4210 SoC PMU.
This model implements PMU registers just as a bulk of memory. Currently, the only reason this device exists is that secondary CPU boot loader uses PMU INFORM5 register as a holding pen.

Quoted 9 lines

Your cover letter's changelog says
- hw/exynos4210_pmu.c: we do not waste space for non-existing registers

    in PMU state anymore; non-existing registers are now RAZ/WI;

...wrong version of this patch, or is the cover letter wrong?

-- PMM

Cover letter is not wrong, when we send PMU patch for the first time (in V9 series), PMU memory was modelled as continious array of registers 0x3d0c bytes long, with every register being "read as written". This was wrong since PMU address space consists of only a handful of registers with big empty gaps between them. Starting from V10, PMU state includes only actually existing registers, and empty gaps between these registers behave as RAZ/WI.

Signature · 3 lines
Mitsyanko Igor
ASWG, Moscow R&D center, Samsung Electronics
email: [email protected]
#16 lore raw

PATCH v11 6/9 ARM: exynos4210: MCT support.

In reply to Evgeny Voevodin
---
 Makefile.target     |    2 +-
 hw/exynos4210.c     |   19 +
 hw/exynos4210_mct.c | 1486 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1506 insertions(+), 1 deletions(-)
 create mode 100644 hw/exynos4210_mct.c
Makefile.target +1 -1
index 5803072..61727bf 100644
@@ -340,7 +340,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_pmu.o
+obj-arm-y += exynos4210_pmu.o 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
index 2e2dbf0..aceec2a 100644
@@ -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 +1486 -0

1,486 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#17 lore raw

Re: [Qemu-devel] [PATCH v11 6/9] ARM: exynos4210: MCT support.

Quoted 2 lines · Evgeny Voevodin

This patch should not contain "Reviewed-by:" since QOM usage was added. Apologise for it. Peter, could you, please, rereview it?

Signature · 5 lines
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: [email protected]
Reviewed-by
#18 lore raw

Re: [Qemu-devel] [PATCH v11 6/9] ARM: exynos4210: MCT support.

Quoted 8 lines · Evgeny Voevodin
Quoted 3 lines · Evgeny Voevodin

This patch should not contain "Reviewed-by:" since QOM usage was added. Apologise for it.
Peter, could you, please, rereview it?

(based on diff between v9 and v11 patch)

-- PMM

#19 lore raw

PATCH v11 7/9 hw/lan9118: Add basic 16-bit mode support.

In reply to Evgeny Voevodin
---
 hw/lan9118.c |  124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 118 insertions(+), 6 deletions(-)
hw/lan9118.c +118 -6
index 3925b04..c95724d 100644
@@ -235,11 +235,21 @@ typedef struct {
     int32_t rxp_offset;
     int32_t rxp_size;
     int32_t 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 const VMStateDescription vmstate_lan9118 = {
     .name = "lan9118",
-    .version_id = 1,
+    .version_id = 2,
     .minimum_version_id = 1,
     .fields = (VMStateField[]) {
         VMSTATE_PTIMER(timer, lan9118_state),
@@ -294,6 +304,14 @@ static const VMStateDescription vmstate_lan9118 = {
         VMSTATE_INT32(rxp_offset, lan9118_state),
         VMSTATE_INT32(rxp_size, lan9118_state),
         VMSTATE_INT32(rxp_pad, lan9118_state),
+        VMSTATE_UINT32_V(write_word_prev_offset, lan9118_state, 2),
+        VMSTATE_UINT32_V(write_word_n, lan9118_state, 2),
+        VMSTATE_UINT16_V(write_word_l, lan9118_state, 2),
+        VMSTATE_UINT16_V(write_word_h, lan9118_state, 2),
+        VMSTATE_UINT32_V(read_word_prev_offset, lan9118_state, 2),
+        VMSTATE_UINT32_V(read_word_n, lan9118_state, 2),
+        VMSTATE_UINT32_V(read_long, lan9118_state, 2),
+        VMSTATE_UINT32_V(mode_16bit, lan9118_state, 2),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -390,7 +408,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;
@@ -429,6 +447,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;
@@ -984,7 +1005,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 */
@@ -1034,7 +1055,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:
@@ -1113,6 +1134,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)
 {
@@ -1149,7 +1210,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:
@@ -1187,12 +1248,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;
@@ -1214,8 +1323,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);
@@ -1240,6 +1351,7 @@ static int lan9118_init1(SysBusDevice *dev)
 
 static Property lan9118_properties[] = {
     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
#20 lore raw

PATCH v11 8/9 hw/exynos4210.c: Add LAN support for SMDKC210.

In reply to Evgeny Voevodin

SMDKC210 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
index 55fca06..8befe8b 100644
@@ -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 Exynos4BoardType {
     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
#21 lore raw

PATCH v11 9/9 Exynos4210: added display controller implementation

In reply to Evgeny Voevodin

From: 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 | 1931 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1942 insertions(+), 1 deletions(-)
 create mode 100644 hw/exynos4210_fimd.c
Makefile.target +1 -1
index 61727bf..39682ee 100644
@@ -340,7 +340,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_pmu.o exynos4210_mct.o
+obj-arm-y += exynos4210_pmu.o 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
index aceec2a..7727578 100644
@@ -58,6 +58,9 @@
 /* PMU SFR base address */
 #define EXYNOS4210_PMU_BASE_ADDR            0x10020000
 
+/* 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 +1931 -0

1,931 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#22 lore raw

Re: [Qemu-devel] [PATCH v11 9/9] Exynos4210: added display controller implementation

Quoted 8 lines · Evgeny Voevodin

From: Mitsyanko Igor<[email protected]>

Exynos4210 display controller (FIMD) has 5 hardware windows with alpha and chroma key blending functions.

This patch should not contain "Reviewed-by:" since QOM usage was added. Apologise for it. Peter, could you, please, rereview it?

Signature · 5 lines
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: [email protected]
Reviewed-by
#23 lore raw

Re: [Qemu-devel] [PATCH v11 9/9] Exynos4210: added display controller implementation

Quoted 7 lines · Evgeny Voevodin
Quoted 6 lines · Evgeny Voevodin

From: Mitsyanko Igor<[email protected]>

Exynos4210 display controller (FIMD) has 5 hardware windows with alpha and chroma key blending functions.

Quoted 7 lines
Quoted 3 lines

This patch should not contain "Reviewed-by:" since QOM usage was added. Apologise for it.
Peter, could you, please, rereview it?

based on diff between v9 and v11 patch.

-- PMM

#24 lore raw
In reply to Evgeny Voevodin
Quoted 5 lines · Evgeny Voevodin

This set of patches adds support for Samsung Exynos4210-based boards NURI and SMDKC210. Tested on Linux kernel v3.x series.

Usage:
"-smp 2" option is mandatory for now.

If it is then the board should complain about -smp 1. As it is, you get a huge pile of "Timer with period zero, disabling" debug printout to the terminal...

-- PMM

#25 lore raw
Quoted 4 lines · Peter Maydell
Quoted 3 lines · Evgeny Voevodin

This set of patches adds support for Samsung Exynos4210-based boards NURI and SMDKC210. Tested on Linux kernel v3.x series.

Quoted 8 lines
Quoted 2 lines

Usage:
"-smp 2" option is mandatory for now.

If it is then the board should complain about -smp 1. As it is, you get a huge pile of "Timer with period zero, disabling" debug printout to the terminal...

-- PMM

I think that better way is to hardcode exynos4_board_binfo.nb_cpus to be equal to 2. AFAIK, there is no exynos4210 variant with other amount of cores then two. So, will produce v12 soon.

Signature · 5 lines
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: [email protected]
#26 lore raw
Quoted 12 lines · Evgeny Voevodin
Quoted 11 lines · Peter Maydell
Quoted 6 lines · Evgeny Voevodin

This set of patches adds support for Samsung Exynos4210-based boards NURI and SMDKC210.
Tested on Linux kernel v3.x series.

Usage:
"-smp 2" option is mandatory for now.

If it is then the board should complain about -smp 1. As it is, you get a huge pile of "Timer with period zero, disabling" debug printout to the terminal...

Quoted 8 lines
Quoted 2 lines

-- PMM

I think that better way is to hardcode exynos4_board_binfo.nb_cpus to be equal to 2.
AFAIK, there is no exynos4210 variant with other amount of cores then two. So, will produce v12 soon.

After a discussion we decided to hardcode exynos4_board_binfo.nb_cpus to be equal to 2 and if smp_cpus is set to smth other, throw a warning message.

Signature · 5 lines
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: [email protected]