Skip to contentSkip to conversation

Add ARM S3C SOC core, drivers and boards - v3

Qemu-devel New Vincent Sanders 1 participant 16 messages May 23, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

This is an updated series integrating the feedback from Jean-Christophe plagniol-villard and rebased to current git head.

The following series adds Samsung S3C support to Qemu. The approach taken is to create a series of generic s3c24xx peripheral blocks and then to create a SOC device which collects a number of these generic blocks together.

The SOC device is then instansiated by the board driver and additional external peripherals added as appropriate.

Two actual SOC are currently implemented (however the generic peripherals are used throughout the entire Samsung range from S3C2400 to S3C6410) are the S3C2410 and S3C2440.

These two SOC were chosen as representative samples because they are two of the most popular ARM 9 class devices and have been used in many devices from handhelds to the openmoko phones.

These SOC also have extremely good Linux kernel support, a single default configuration covers 22 boards.

Only a pair of boards have been included in this series purely to demostrate the most basic intended usage of the implementation. A subsequent series will introduce all the omited peripherals for these boards.

This series is the smallest set of changes required to support these devices and is current against git head. The implementation of some peripheral blocks although not complete is sufficient to successfully run Linux kernels. Improved peripheral support is envisaged after the core support is merged.

#1 lore raw

PATCH 1/16 Add ARM 920T CPU identifier

Add the CPU Identifier required for ARM 920T cpu cores

---
 target-arm/cpu.h    |    1 +
 target-arm/helper.c |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)
target-arm/cpu.h +1 -0
index f98655f..eafaeaf 100644
@@ -370,6 +370,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,
 #define ARM_CPUID_ARM1026     0x4106a262
 #define ARM_CPUID_ARM926      0x41069265
 #define ARM_CPUID_ARM946      0x41059461
+#define ARM_CPUID_ARM920T     0x41129200
 #define ARM_CPUID_TI915T      0x54029152
 #define ARM_CPUID_TI925T      0x54029252
 #define ARM_CPUID_PXA250      0x69052100
target-arm/helper.c +5 -0
index 701629a..2b05d15 100644
@@ -37,6 +37,10 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
 {
     env->cp15.c0_cpuid = id;
     switch (id) {
+    case ARM_CPUID_ARM920T:
+        env->cp15.c0_cachetype = 0x0d172172;
+        env->cp15.c1_sys = 0x00000078;
+        break;
     case ARM_CPUID_ARM926:
         set_feature(env, ARM_FEATURE_VFP);
         env->vfp.xregs[ARM_VFP_FPSID] = 0x41011090;
@@ -277,6 +281,7 @@ struct arm_cpu_t {
 };
 
 static const struct arm_cpu_t arm_cpu_names[] = {
+    { ARM_CPUID_ARM920T, "arm920t"},
     { ARM_CPUID_ARM926, "arm926"},
     { ARM_CPUID_ARM946, "arm946"},
     { ARM_CPUID_ARM1026, "arm1026"},
Signature · 1 line
1.6.0.4
#2 lore raw

PATCH 2/16 S3C2410 and S3C2440 core SOC implementation.

In reply to Vincent Sanders
---
 Makefile.target |    1 +
 hw/s3c2410x.c   |   41 +++++++++++++++++++++++++++++++++++++++++
 hw/s3c2410x.h   |   38 ++++++++++++++++++++++++++++++++++++++
 hw/s3c2440.c    |   40 ++++++++++++++++++++++++++++++++++++++++
 hw/s3c2440.h    |   38 ++++++++++++++++++++++++++++++++++++++
 hw/s3c24xx.h    |   19 +++++++++++++++++++
 6 files changed, 177 insertions(+), 0 deletions(-)
 create mode 100644 hw/s3c2410x.c
 create mode 100644 hw/s3c2410x.h
 create mode 100644 hw/s3c2440.c
 create mode 100644 hw/s3c2440.h
 create mode 100644 hw/s3c24xx.h
Makefile.target +1 -0
index 664a1e3..2e4c0f2 100644
@@ -648,6 +648,7 @@ OBJS+= omap_sx1.o palm.o tsc210x.o
 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
 OBJS+= mst_fpga.o mainstone.o
 OBJS+= musicpal.o pflash_cfi02.o
+OBJS+= s3c2410x.o s3c2440.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
 OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
hw/s3c2410x.c new file +41 -0

41 lines not on this page · raw message

hw/s3c2410x.h new file +38 -0
new file mode 100644
index 0000000..f21bf9c
@@ -0,0 +1,38 @@
+/* hw/s3c2410x.h
+ *
+ * Samsung s3c2410x cpu register definitions
+ *
+ * Copyright 2006, 2007, 2008 Daniel Silverstone and Vincent Sanders
+ *
+ * This file is under the terms of the GNU General Public
+ * License Version 2.
+ */
+
+#ifndef S3C2410X_H
+#define S3C2410X_H 1
+
+#include "s3c24xx.h"
+
+/* S3C2410 Physical memory areas */
+
+/* Chip select 0, Read only, not wired for write */
+#define CPU_S3C2410X_CS0 (0x00000000)
+/* Chip select 1 */
+#define CPU_S3C2410X_CS1 (0x08000000)
+/* Chip select 2 */
+#define CPU_S3C2410X_CS2 (0x10000000)
+/* Chip select 3 */
+#define CPU_S3C2410X_CS3 (0x18000000)
+/* Chip select 4 */
+#define CPU_S3C2410X_CS4 (0x20000000)
+/* Chip select 5 */
+#define CPU_S3C2410X_CS5 (0x28000000)
+/* Dynamic RAM */
+#define CPU_S3C2410X_DRAM (0x30000000)
+/* SOC Internal peripherals */
+#define CPU_S3C2410X_PERIPHERAL (0x40000000)
+
+/* s3c2410 SOC initialisation */
+S3CState *s3c2410x_init(int sdram_size);
+
+#endif /* S3C2410X_H */
hw/s3c2440.c new file +40 -0
new file mode 100644
index 0000000..0d01ac6
@@ -0,0 +1,40 @@
+/* hw/s3c2440.c
+ *
+ * Samsung S3C2440 emulation
+ *
+ * Copyright 2009 Daniel Silverstone and Vincent Sanders
+ *
+ * This file is under the terms of the GNU General Public
+ * License Version 2
+ */
+
+#include "hw.h"
+
+#include "s3c2440.h"
+
+/* Integrated peripherals */
+#define CPU_S3C2440_SRAM_BASE (CPU_S3C2440_PERIPHERAL + 0x00000000)
+#define CPU_S3C2440_SRAM_SIZE 4096
+
+
+/* Initialise a Samsung S3C2440 SOC ARM core and internal peripherals. */
+S3CState *
+s3c2440_init(int sdram_size)
+{
+    S3CState *s = (S3CState *)qemu_mallocz(sizeof(S3CState));
+
+    /* Prepare the ARM 920T core */
+    s->cpu_env = cpu_init("arm920t");
+
+    /* S3C2440X SDRAM memory is always at the same physical location */
+    cpu_register_physical_memory(CPU_S3C2440_DRAM,
+                                 ram_size,
+                                 qemu_ram_alloc(sdram_size) | IO_MEM_RAM);
+
+    /* S3C2440 SRAM */
+    cpu_register_physical_memory(CPU_S3C2440_SRAM_BASE,
+                                 CPU_S3C2440_SRAM_SIZE,
+                                 qemu_ram_alloc(CPU_S3C2440_SRAM_SIZE) | IO_MEM_RAM);
+
+    return s;
+}
hw/s3c2440.h new file +38 -0
new file mode 100644
index 0000000..d60ba44
@@ -0,0 +1,38 @@
+/* hw/s3c2410x.h
+ *
+ * Samsung s3c2410x cpu register definitions
+ *
+ * Copyright 2009 Daniel Silverstone and Vincent Sanders
+ *
+ * This file is under the terms of the GNU General Public
+ * License Version 2.
+ */
+
+#ifndef S3C2440_H
+#define S3C2440_H 1
+
+#include "s3c24xx.h"
+
+/* S3C2440 Physical memory areas */
+
+/* Chip select 0 */
+#define CPU_S3C2440_CS0 (0x00000000)
+/* Chip select 1 */
+#define CPU_S3C2440_CS1 (0x08000000)
+/* Chip select 2 */
+#define CPU_S3C2440_CS2 (0x10000000)
+/* Chip select 3 */
+#define CPU_S3C2440_CS3 (0x18000000)
+/* Chip select 4 */
+#define CPU_S3C2440_CS4 (0x20000000)
+/* Chip select 5 */
+#define CPU_S3C2440_CS5 (0x28000000)
+/* Dynamic RAM */
+#define CPU_S3C2440_DRAM (0x30000000)
+/* SOC Integrated peripherals */
+#define CPU_S3C2440_PERIPHERAL (0x40000000)
+
+/* s3c2440 SOC initialisation */
+S3CState *s3c2440_init(int sdram_size);
+
+#endif /* S3C2440_H */
hw/s3c24xx.h new file +19 -0
new file mode 100644
index 0000000..0b933c9
@@ -0,0 +1,19 @@
+/* hw/s3c24xx.h
+ *
+ * Samsung s3c24xx cpu state and functions.
+ *
+ * Copyright 2006, 2007, 2008 Daniel Silverstone and Vincent Sanders
+ *
+ * This file is under the terms of the GNU General Public
+ * License Version 2.
+ */
+
+#ifndef S3C24XX_H
+#define S3C24XX_H 1
+
+/* This structure type encapsulates the state of a S3C24XX SoC. */
+typedef struct S3CState_s {
+    CPUState *cpu_env;
+} S3CState;
+
+#endif /* S3C24XX_H */
Signature · 1 line
1.6.0.4
#3 lore raw

PATCH 3/16 Peripheral driver for S3C SOC SDRAM controller.

In reply to Vincent Sanders

Peripheral driver for SDRAM controller on s3c24xx SOC. Very similar to the implementation of other such controllers in that it just backs the registers.

---
 Makefile.target   |    1 +
 hw/s3c2410x.c     |    9 +++++
 hw/s3c2440.c      |    8 ++++
 hw/s3c24xx.h      |    8 ++++
 hw/s3c24xx_memc.c |   96 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 122 insertions(+), 0 deletions(-)
 create mode 100644 hw/s3c24xx_memc.c
Makefile.target +1 -0
index 2e4c0f2..2ecfeca 100644
@@ -648,6 +648,7 @@ OBJS+= omap_sx1.o palm.o tsc210x.o
 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
 OBJS+= mst_fpga.o mainstone.o
 OBJS+= musicpal.o pflash_cfi02.o
+OBJS+= s3c24xx_memc.o
 OBJS+= s3c2410x.o s3c2440.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
hw/s3c2410x.c +9 -0
index 0461095..74c61ac 100644
@@ -13,9 +13,15 @@
 #include "s3c2410x.h"
 
 /* Integrated peripherals */
+
+/* SRAM */
 #define CPU_S3C2410X_SRAM_BASE (CPU_S3C2410X_PERIPHERAL + 0x00000000)
 #define CPU_S3C2410X_SRAM_SIZE 4096
 
+/* Memory control */
+#define CPU_S3C2410X_MEMC_BASE (CPU_S3C2410X_PERIPHERAL + 0x8000000)
+
+
 /* Initialise a Samsung S3C2410X SOC ARM core and internal peripherals. */
 S3CState *
 s3c2410x_init(int sdram_size)
@@ -37,5 +43,8 @@ s3c2410x_init(int sdram_size)
                                  qemu_ram_alloc(CPU_S3C2410X_SRAM_SIZE) | IO_MEM_RAM);
 
 
+    /* SDRAM memory controller */
+    s->memc = s3c24xx_memc_init(CPU_S3C2410X_MEMC_BASE);
+
     return s;
 }
hw/s3c2440.c +8 -0
index 0d01ac6..18d8715 100644
@@ -13,9 +13,14 @@
 #include "s3c2440.h"
 
 /* Integrated peripherals */
+
+/* SRAM */
 #define CPU_S3C2440_SRAM_BASE (CPU_S3C2440_PERIPHERAL + 0x00000000)
 #define CPU_S3C2440_SRAM_SIZE 4096
 
+/* Memory control */
+#define CPU_S3C2440_MEMC_BASE (CPU_S3C2440_PERIPHERAL + 0x8000000)
+
 
 /* Initialise a Samsung S3C2440 SOC ARM core and internal peripherals. */
 S3CState *
@@ -36,5 +41,8 @@ s3c2440_init(int sdram_size)
                                  CPU_S3C2440_SRAM_SIZE,
                                  qemu_ram_alloc(CPU_S3C2440_SRAM_SIZE) | IO_MEM_RAM);
 
+    /* SDRAM memory controller */
+    s->memc = s3c24xx_memc_init(CPU_S3C2440_MEMC_BASE);
+
     return s;
 }
hw/s3c24xx.h +8 -0
index 0b933c9..475bb2e 100644
@@ -14,6 +14,14 @@
 /* This structure type encapsulates the state of a S3C24XX SoC. */
 typedef struct S3CState_s {
     CPUState *cpu_env;
+
+    /* Memory controller state */
+    struct s3c24xx_memc_state_s *memc;
+
 } S3CState;
 
+
+/* initialise memory controller peripheral */
+struct s3c24xx_memc_state_s *s3c24xx_memc_init(target_phys_addr_t base_addr);
+
 #endif /* S3C24XX_H */
hw/s3c24xx_memc.c new file +96 -0

96 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#4 lore raw

PATCH 4/16 Peripheral driver for S3C SOC IRQ controller.

In reply to Vincent Sanders

IRQ controller emulation for the s3c24xx SOC.

---
 Makefile.target  |    2 +-
 hw/s3c2410x.c    |    5 +
 hw/s3c2440.c     |    5 +
 hw/s3c24xx.h     |   10 ++
 hw/s3c24xx_irq.c |  250 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 271 insertions(+), 1 deletions(-)
 create mode 100644 hw/s3c24xx_irq.c
Makefile.target +1 -1
index 2ecfeca..1201cd3 100644
@@ -648,7 +648,7 @@ OBJS+= omap_sx1.o palm.o tsc210x.o
 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
 OBJS+= mst_fpga.o mainstone.o
 OBJS+= musicpal.o pflash_cfi02.o
-OBJS+= s3c24xx_memc.o
+OBJS+= s3c24xx_memc.o s3c24xx_irq.o
 OBJS+= s3c2410x.o s3c2440.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
hw/s3c2410x.c +5 -0
index 74c61ac..987b14b 100644
@@ -21,6 +21,8 @@
 /* Memory control */
 #define CPU_S3C2410X_MEMC_BASE (CPU_S3C2410X_PERIPHERAL + 0x8000000)
 
+/* Interrupt controller */
+#define CPU_S3C2410X_IRQ_BASE (CPU_S3C2410X_PERIPHERAL + 0xA000000)
 
 /* Initialise a Samsung S3C2410X SOC ARM core and internal peripherals. */
 S3CState *
@@ -46,5 +48,8 @@ s3c2410x_init(int sdram_size)
     /* SDRAM memory controller */
     s->memc = s3c24xx_memc_init(CPU_S3C2410X_MEMC_BASE);
 
+    /* Interrupt controller */
+    s->irq = s3c24xx_irq_init(s, CPU_S3C2410X_IRQ_BASE);
+
     return s;
 }
hw/s3c2440.c +5 -0
index 18d8715..1f86c0f 100644
@@ -21,6 +21,8 @@
 /* Memory control */
 #define CPU_S3C2440_MEMC_BASE (CPU_S3C2440_PERIPHERAL + 0x8000000)
 
+/* Interrupt controller */
+#define CPU_S3C2440_IRQ_BASE (CPU_S3C2440_PERIPHERAL + 0xA000000)
 
 /* Initialise a Samsung S3C2440 SOC ARM core and internal peripherals. */
 S3CState *
@@ -44,5 +46,8 @@ s3c2440_init(int sdram_size)
     /* SDRAM memory controller */
     s->memc = s3c24xx_memc_init(CPU_S3C2440_MEMC_BASE);
 
+    /* Interrupt controller */
+    s->irq = s3c24xx_irq_init(s, CPU_S3C2440_IRQ_BASE);
+
     return s;
 }
hw/s3c24xx.h +10 -0
index 475bb2e..8233757 100644
@@ -18,10 +18,20 @@ typedef struct S3CState_s {
     /* Memory controller state */
     struct s3c24xx_memc_state_s *memc;
 
+    /* IRQ controller state */
+    struct s3c24xx_irq_state_s *irq;
+
 } S3CState;
 
 
 /* initialise memory controller peripheral */
 struct s3c24xx_memc_state_s *s3c24xx_memc_init(target_phys_addr_t base_addr);
 
+/* initialise the IRQ controller */
+struct s3c24xx_irq_state_s *s3c24xx_irq_init(S3CState *soc, target_phys_addr_t base_addr);
+
+/* get the qemu interrupt from an irq number */
+qemu_irq s3c24xx_get_irq(struct s3c24xx_irq_state_s *s, int inum);
+
+
 #endif /* S3C24XX_H */
hw/s3c24xx_irq.c new file +250 -0

250 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#5 lore raw

PATCH 5/16 Peripheral driver for S3C SOC clock control.

In reply to Vincent Sanders

emulation of the S3c24xx SOC clock and power management controller

---
 Makefile.target     |    2 +-
 hw/s3c2410x.c       |    6 ++
 hw/s3c2440.c        |    6 ++
 hw/s3c24xx.h        |    6 ++
 hw/s3c24xx_clkcon.c |  134 +++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 153 insertions(+), 1 deletions(-)
 create mode 100644 hw/s3c24xx_clkcon.c
Makefile.target +1 -1
index 1201cd3..d08bb36 100644
@@ -648,7 +648,7 @@ OBJS+= omap_sx1.o palm.o tsc210x.o
 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
 OBJS+= mst_fpga.o mainstone.o
 OBJS+= musicpal.o pflash_cfi02.o
-OBJS+= s3c24xx_memc.o s3c24xx_irq.o
+OBJS+= s3c24xx_memc.o s3c24xx_irq.o s3c24xx_clkcon.o
 OBJS+= s3c2410x.o s3c2440.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
hw/s3c2410x.c +6 -0
index 987b14b..fe685e8 100644
@@ -24,6 +24,9 @@
 /* Interrupt controller */
 #define CPU_S3C2410X_IRQ_BASE (CPU_S3C2410X_PERIPHERAL + 0xA000000)
 
+/* Clock control */
+#define CPU_S3C2410X_CLKCON_BASE (CPU_S3C2410X_PERIPHERAL + 0xC000000)
+
 /* Initialise a Samsung S3C2410X SOC ARM core and internal peripherals. */
 S3CState *
 s3c2410x_init(int sdram_size)
@@ -51,5 +54,8 @@ s3c2410x_init(int sdram_size)
     /* Interrupt controller */
     s->irq = s3c24xx_irq_init(s, CPU_S3C2410X_IRQ_BASE);
 
+    /* Clock and power control */
+    s->clkcon = s3c24xx_clkcon_init(s, CPU_S3C2410X_CLKCON_BASE, 12000000);
+
     return s;
 }
hw/s3c2440.c +6 -0
index 1f86c0f..b79451e 100644
@@ -24,6 +24,9 @@
 /* Interrupt controller */
 #define CPU_S3C2440_IRQ_BASE (CPU_S3C2440_PERIPHERAL + 0xA000000)
 
+/* Clock control */
+#define CPU_S3C2440_CLKCON_BASE (CPU_S3C2440_PERIPHERAL + 0xC000000)
+
 /* Initialise a Samsung S3C2440 SOC ARM core and internal peripherals. */
 S3CState *
 s3c2440_init(int sdram_size)
@@ -49,5 +52,8 @@ s3c2440_init(int sdram_size)
     /* Interrupt controller */
     s->irq = s3c24xx_irq_init(s, CPU_S3C2440_IRQ_BASE);
 
+    /* Clock and power control */
+    s->clkcon = s3c24xx_clkcon_init(s, CPU_S3C2440_CLKCON_BASE, 12000000);
+
     return s;
 }
hw/s3c24xx.h +6 -0
index 8233757..000c9ba 100644
@@ -21,6 +21,9 @@ typedef struct S3CState_s {
     /* IRQ controller state */
     struct s3c24xx_irq_state_s *irq;
 
+    /* Clock and power control */
+    struct s3c24xx_clkcon_state_s *clkcon;
+
 } S3CState;
 
 
@@ -33,5 +36,8 @@ struct s3c24xx_irq_state_s *s3c24xx_irq_init(S3CState *soc, target_phys_addr_t b
 /* get the qemu interrupt from an irq number */
 qemu_irq s3c24xx_get_irq(struct s3c24xx_irq_state_s *s, int inum);
 
+/* initialise clock controller */
+struct s3c24xx_clkcon_state_s *s3c24xx_clkcon_init(S3CState *soc, target_phys_addr_t base_addr, uint32_t ref_freq);
+
 
 #endif /* S3C24XX_H */
hw/s3c24xx_clkcon.c new file +134 -0

134 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#6 lore raw

PATCH 6/16 Peripheral driver for S3C SOC timers.

In reply to Vincent Sanders
---
 Makefile.target     |    2 +-
 hw/s3c2410x.c       |    6 ++
 hw/s3c2440.c        |    6 ++
 hw/s3c24xx.h        |    4 +
 hw/s3c24xx_timers.c |  206 +++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 223 insertions(+), 1 deletions(-)
 create mode 100644 hw/s3c24xx_timers.c
Makefile.target +1 -1
index d08bb36..81fbc34 100644
@@ -648,7 +648,7 @@ OBJS+= omap_sx1.o palm.o tsc210x.o
 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
 OBJS+= mst_fpga.o mainstone.o
 OBJS+= musicpal.o pflash_cfi02.o
-OBJS+= s3c24xx_memc.o s3c24xx_irq.o s3c24xx_clkcon.o
+OBJS+= s3c24xx_memc.o s3c24xx_irq.o s3c24xx_clkcon.o s3c24xx_timers.o
 OBJS+= s3c2410x.o s3c2440.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
hw/s3c2410x.c +6 -0
index fe685e8..d61abe2 100644
@@ -27,6 +27,9 @@
 /* Clock control */
 #define CPU_S3C2410X_CLKCON_BASE (CPU_S3C2410X_PERIPHERAL + 0xC000000)
 
+/* Timer controller */
+#define CPU_S3C2410X_TIMERS_BASE (CPU_S3C2410X_PERIPHERAL + 0x11000000)
+
 /* Initialise a Samsung S3C2410X SOC ARM core and internal peripherals. */
 S3CState *
 s3c2410x_init(int sdram_size)
@@ -57,5 +60,8 @@ s3c2410x_init(int sdram_size)
     /* Clock and power control */
     s->clkcon = s3c24xx_clkcon_init(s, CPU_S3C2410X_CLKCON_BASE, 12000000);
 
+    /* Timer controller */
+    s->timers = s3c24xx_timers_init(s, CPU_S3C2410X_TIMERS_BASE, 0, 12000000);
+
     return s;
 }
hw/s3c2440.c +6 -0
index b79451e..1e947df 100644
@@ -27,6 +27,9 @@
 /* Clock control */
 #define CPU_S3C2440_CLKCON_BASE (CPU_S3C2440_PERIPHERAL + 0xC000000)
 
+/* Timer controller */
+#define CPU_S3C2440_TIMERS_BASE (CPU_S3C2440_PERIPHERAL + 0x11000000)
+
 /* Initialise a Samsung S3C2440 SOC ARM core and internal peripherals. */
 S3CState *
 s3c2440_init(int sdram_size)
@@ -55,5 +58,8 @@ s3c2440_init(int sdram_size)
     /* Clock and power control */
     s->clkcon = s3c24xx_clkcon_init(s, CPU_S3C2440_CLKCON_BASE, 12000000);
 
+    /* Timer controller */
+    s->timers = s3c24xx_timers_init(s, CPU_S3C2440_TIMERS_BASE, 0, 12000000);
+
     return s;
 }
hw/s3c24xx.h +4 -0
index 000c9ba..9cc7f37 100644
@@ -24,6 +24,8 @@ typedef struct S3CState_s {
     /* Clock and power control */
     struct s3c24xx_clkcon_state_s *clkcon;
 
+    /* timer controller */
+    struct s3c24xx_timers_state_s *timers;
 } S3CState;
 
 
@@ -39,5 +41,7 @@ qemu_irq s3c24xx_get_irq(struct s3c24xx_irq_state_s *s, int inum);
 /* initialise clock controller */
 struct s3c24xx_clkcon_state_s *s3c24xx_clkcon_init(S3CState *soc, target_phys_addr_t base_addr, uint32_t ref_freq);
 
+/* initialise timer controller */
+struct s3c24xx_timers_state_s *s3c24xx_timers_init(S3CState *soc, target_phys_addr_t base_addr, uint32_t tclk0, uint32_t tclk1);
 
 #endif /* S3C24XX_H */
hw/s3c24xx_timers.c new file +206 -0

206 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#7 lore raw

PATCH 7/16 Peripheral driver for S3C SOC Serial ports.

In reply to Vincent Sanders
---
 Makefile.target     |    1 +
 hw/s3c2410x.c       |   11 ++
 hw/s3c2440.c        |   11 ++
 hw/s3c24xx.h        |    7 ++
 hw/s3c24xx_serial.c |  261 +++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 291 insertions(+), 0 deletions(-)
 create mode 100644 hw/s3c24xx_serial.c
Makefile.target +1 -0
index 81fbc34..2888e86 100644
@@ -649,6 +649,7 @@ OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
 OBJS+= mst_fpga.o mainstone.o
 OBJS+= musicpal.o pflash_cfi02.o
 OBJS+= s3c24xx_memc.o s3c24xx_irq.o s3c24xx_clkcon.o s3c24xx_timers.o
+OBJS+= s3c24xx_serial.o
 OBJS+= s3c2410x.o s3c2440.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
hw/s3c2410x.c +11 -0
index d61abe2..084f9ec 100644
@@ -9,6 +9,7 @@
  */
 
 #include "hw.h"
+#include "sysemu.h"
 
 #include "s3c2410x.h"
 
@@ -27,6 +28,11 @@
 /* Clock control */
 #define CPU_S3C2410X_CLKCON_BASE (CPU_S3C2410X_PERIPHERAL + 0xC000000)
 
+/* serial port bases */
+#define CPU_S3C2410X_SERIAL0_BASE (CPU_S3C2410X_PERIPHERAL + 0x10000000)
+#define CPU_S3C2410X_SERIAL1_BASE (CPU_S3C2410X_PERIPHERAL + 0x10004000)
+#define CPU_S3C2410X_SERIAL2_BASE (CPU_S3C2410X_PERIPHERAL + 0x10008000)
+
 /* Timer controller */
 #define CPU_S3C2410X_TIMERS_BASE (CPU_S3C2410X_PERIPHERAL + 0x11000000)
 
@@ -63,5 +69,10 @@ s3c2410x_init(int sdram_size)
     /* Timer controller */
     s->timers = s3c24xx_timers_init(s, CPU_S3C2410X_TIMERS_BASE, 0, 12000000);
 
+    /* Serial port controllers */
+    s->uart[0] = s3c24xx_serial_init(s, serial_hds[0], CPU_S3C2410X_SERIAL0_BASE, 32);
+    s->uart[1] = s3c24xx_serial_init(s, serial_hds[1], CPU_S3C2410X_SERIAL1_BASE, 35);
+    s->uart[2] = s3c24xx_serial_init(s, serial_hds[2], CPU_S3C2410X_SERIAL2_BASE, 38);
+
     return s;
 }
hw/s3c2440.c +11 -0
index 1e947df..3896965 100644
@@ -9,6 +9,7 @@
  */
 
 #include "hw.h"
+#include "sysemu.h"
 
 #include "s3c2440.h"
 
@@ -27,6 +28,11 @@
 /* Clock control */
 #define CPU_S3C2440_CLKCON_BASE (CPU_S3C2440_PERIPHERAL + 0xC000000)
 
+/* serial port bases */
+#define CPU_S3C2440_SERIAL0_BASE (CPU_S3C2440_PERIPHERAL + 0x10000000)
+#define CPU_S3C2440_SERIAL1_BASE (CPU_S3C2440_PERIPHERAL + 0x10004000)
+#define CPU_S3C2440_SERIAL2_BASE (CPU_S3C2440_PERIPHERAL + 0x10008000)
+
 /* Timer controller */
 #define CPU_S3C2440_TIMERS_BASE (CPU_S3C2440_PERIPHERAL + 0x11000000)
 
@@ -61,5 +67,10 @@ s3c2440_init(int sdram_size)
     /* Timer controller */
     s->timers = s3c24xx_timers_init(s, CPU_S3C2440_TIMERS_BASE, 0, 12000000);
 
+    /* Serial port controllers */
+    s->uart[0] = s3c24xx_serial_init(s, serial_hds[0], CPU_S3C2440_SERIAL0_BASE, 32);
+    s->uart[1] = s3c24xx_serial_init(s, serial_hds[1], CPU_S3C2440_SERIAL1_BASE, 35);
+    s->uart[2] = s3c24xx_serial_init(s, serial_hds[2], CPU_S3C2440_SERIAL2_BASE, 38);
+
     return s;
 }
hw/s3c24xx.h +7 -0
index 9cc7f37..5a2e806 100644
@@ -26,6 +26,10 @@ typedef struct S3CState_s {
 
     /* timer controller */
     struct s3c24xx_timers_state_s *timers;
+
+    /* Serial ports */
+    struct s3c24xx_serial_dev_s *uart[3];
+
 } S3CState;
 
 
@@ -44,4 +48,7 @@ struct s3c24xx_clkcon_state_s *s3c24xx_clkcon_init(S3CState *soc, target_phys_ad
 /* initialise timer controller */
 struct s3c24xx_timers_state_s *s3c24xx_timers_init(S3CState *soc, target_phys_addr_t base_addr, uint32_t tclk0, uint32_t tclk1);
 
+/* initialise a serial port controller */
+struct s3c24xx_serial_dev_s *s3c24xx_serial_init(S3CState *soc, CharDriverState *chr, target_phys_addr_t base_addr, int irqn);
+
 #endif /* S3C24XX_H */
hw/s3c24xx_serial.c new file +261 -0

261 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#8 lore raw

PATCH 8/16 Peripheral driver for S3C SOC real time clock.

In reply to Vincent Sanders
---
 Makefile.target  |    2 +-
 hw/s3c2410x.c    |    6 ++
 hw/s3c2440.c     |    6 ++
 hw/s3c24xx.h     |    7 +++
 hw/s3c24xx_rtc.c |  135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 155 insertions(+), 1 deletions(-)
 create mode 100644 hw/s3c24xx_rtc.c
Makefile.target +1 -1
index 2888e86..2596943 100644
@@ -649,7 +649,7 @@ OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
 OBJS+= mst_fpga.o mainstone.o
 OBJS+= musicpal.o pflash_cfi02.o
 OBJS+= s3c24xx_memc.o s3c24xx_irq.o s3c24xx_clkcon.o s3c24xx_timers.o
-OBJS+= s3c24xx_serial.o
+OBJS+= s3c24xx_serial.o s3c24xx_rtc.o
 OBJS+= s3c2410x.o s3c2440.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
hw/s3c2410x.c +6 -0
index 084f9ec..21ecec2 100644
@@ -36,6 +36,9 @@
 /* Timer controller */
 #define CPU_S3C2410X_TIMERS_BASE (CPU_S3C2410X_PERIPHERAL + 0x11000000)
 
+/* Real time clock */
+#define CPU_S3C2410X_RTC_BASE (CPU_S3C2410X_PERIPHERAL + 0x17000000)
+
 /* Initialise a Samsung S3C2410X SOC ARM core and internal peripherals. */
 S3CState *
 s3c2410x_init(int sdram_size)
@@ -74,5 +77,8 @@ s3c2410x_init(int sdram_size)
     s->uart[1] = s3c24xx_serial_init(s, serial_hds[1], CPU_S3C2410X_SERIAL1_BASE, 35);
     s->uart[2] = s3c24xx_serial_init(s, serial_hds[2], CPU_S3C2410X_SERIAL2_BASE, 38);
 
+    /* Real time clcok */
+    s->rtc = s3c24xx_rtc_init(CPU_S3C2410X_RTC_BASE);
+
     return s;
 }
hw/s3c2440.c +6 -0
index 3896965..91f4341 100644
@@ -36,6 +36,9 @@
 /* Timer controller */
 #define CPU_S3C2440_TIMERS_BASE (CPU_S3C2440_PERIPHERAL + 0x11000000)
 
+/* Real time clock */
+#define CPU_S3C2440_RTC_BASE (CPU_S3C2440_PERIPHERAL + 0x17000000)
+
 /* Initialise a Samsung S3C2440 SOC ARM core and internal peripherals. */
 S3CState *
 s3c2440_init(int sdram_size)
@@ -72,5 +75,8 @@ s3c2440_init(int sdram_size)
     s->uart[1] = s3c24xx_serial_init(s, serial_hds[1], CPU_S3C2440_SERIAL1_BASE, 35);
     s->uart[2] = s3c24xx_serial_init(s, serial_hds[2], CPU_S3C2440_SERIAL2_BASE, 38);
 
+    /* Real time clcok */
+    s->rtc = s3c24xx_rtc_init(CPU_S3C2440_RTC_BASE);
+
     return s;
 }
hw/s3c24xx.h +7 -0
index 5a2e806..643d841 100644
@@ -30,6 +30,9 @@ typedef struct S3CState_s {
     /* Serial ports */
     struct s3c24xx_serial_dev_s *uart[3];
 
+    /* Real time clock */
+    struct s3c24xx_rtc_state_s *rtc;
+
 } S3CState;
 
 
@@ -51,4 +54,8 @@ struct s3c24xx_timers_state_s *s3c24xx_timers_init(S3CState *soc, target_phys_ad
 /* initialise a serial port controller */
 struct s3c24xx_serial_dev_s *s3c24xx_serial_init(S3CState *soc, CharDriverState *chr, target_phys_addr_t base_addr, int irqn);
 
+/* Initialise real time clock */
+struct s3c24xx_rtc_state_s *s3c24xx_rtc_init(target_phys_addr_t base_addr);
+
+
 #endif /* S3C24XX_H */
hw/s3c24xx_rtc.c new file +135 -0

135 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#9 lore raw

PATCH 9/16 Peripheral driver for S3C SOC general purpose I/O

In reply to Vincent Sanders

Provides general purpose I/O handling, SOC identification registers and external interrupt support

---
 Makefile.target   |    2 +-
 hw/s3c2410x.c     |   10 +++
 hw/s3c2440.c      |    9 ++
 hw/s3c24xx.h      |    7 ++
 hw/s3c24xx_gpio.c |  225 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 252 insertions(+), 1 deletions(-)
 create mode 100644 hw/s3c24xx_gpio.c
Makefile.target +1 -1
index 2596943..52dcf4c 100644
@@ -649,7 +649,7 @@ OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
 OBJS+= mst_fpga.o mainstone.o
 OBJS+= musicpal.o pflash_cfi02.o
 OBJS+= s3c24xx_memc.o s3c24xx_irq.o s3c24xx_clkcon.o s3c24xx_timers.o
-OBJS+= s3c24xx_serial.o s3c24xx_rtc.o
+OBJS+= s3c24xx_serial.o s3c24xx_rtc.o s3c24xx_gpio.o
 OBJS+= s3c2410x.o s3c2440.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
hw/s3c2410x.c +10 -0
index 21ecec2..c3b84a0 100644
@@ -13,6 +13,10 @@
 
 #include "s3c2410x.h"
 
+/* S3C2410 SoC IDs */
+#define CPU_S3C2410X_IDENT_S3C2410X 0x32410000
+#define CPU_S3C2410X_IDENT_S3C2410A 0x32410002
+
 /* Integrated peripherals */
 
 /* SRAM */
@@ -36,6 +40,9 @@
 /* Timer controller */
 #define CPU_S3C2410X_TIMERS_BASE (CPU_S3C2410X_PERIPHERAL + 0x11000000)
 
+/* GPIO */
+#define CPU_S3C2410X_GPIO_BASE (CPU_S3C2410X_PERIPHERAL + 0x16000000)
+
 /* Real time clock */
 #define CPU_S3C2410X_RTC_BASE (CPU_S3C2410X_PERIPHERAL + 0x17000000)
 
@@ -80,5 +87,8 @@ s3c2410x_init(int sdram_size)
     /* Real time clcok */
     s->rtc = s3c24xx_rtc_init(CPU_S3C2410X_RTC_BASE);
 
+    /* GPIO */
+    s->gpio = s3c24xx_gpio_init(s, CPU_S3C2410X_GPIO_BASE, CPU_S3C2410X_IDENT_S3C2410A);
+
     return s;
 }
hw/s3c2440.c +9 -0
index 91f4341..b53f010 100644
@@ -13,6 +13,9 @@
 
 #include "s3c2440.h"
 
+/* S3C2440 SoC ID */
+#define CPU_S3C2440_IDENT_S3C2440A 0x32440001
+
 /* Integrated peripherals */
 
 /* SRAM */
@@ -36,6 +39,9 @@
 /* Timer controller */
 #define CPU_S3C2440_TIMERS_BASE (CPU_S3C2440_PERIPHERAL + 0x11000000)
 
+/* GPIO */
+#define CPU_S3C2440_GPIO_BASE (CPU_S3C2440_PERIPHERAL + 0x16000000)
+
 /* Real time clock */
 #define CPU_S3C2440_RTC_BASE (CPU_S3C2440_PERIPHERAL + 0x17000000)
 
@@ -78,5 +84,8 @@ s3c2440_init(int sdram_size)
     /* Real time clcok */
     s->rtc = s3c24xx_rtc_init(CPU_S3C2440_RTC_BASE);
 
+    /* And some GPIO */
+    s->gpio = s3c24xx_gpio_init(s, CPU_S3C2440_GPIO_BASE, CPU_S3C2440_IDENT_S3C2440A);
+
     return s;
 }
hw/s3c24xx.h +7 -0
index 643d841..b9d8dfe 100644
@@ -33,6 +33,8 @@ typedef struct S3CState_s {
     /* Real time clock */
     struct s3c24xx_rtc_state_s *rtc;
 
+    /* GPIO */
+    struct s3c24xx_gpio_state_s *gpio;
 } S3CState;
 
 
@@ -57,5 +59,10 @@ struct s3c24xx_serial_dev_s *s3c24xx_serial_init(S3CState *soc, CharDriverState
 /* Initialise real time clock */
 struct s3c24xx_rtc_state_s *s3c24xx_rtc_init(target_phys_addr_t base_addr);
 
+/* initialise GPIO */
+struct s3c24xx_gpio_state_s *s3c24xx_gpio_init(S3CState *soc, target_phys_addr_t base_addr, uint32_t cpu_id);
+
+/* get the qemu interrupt from an eirq number */
+qemu_irq s3c24xx_get_eirq(struct s3c24xx_gpio_state_s *s, int einum);
 
 #endif /* S3C24XX_H */
hw/s3c24xx_gpio.c new file +225 -0

225 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#10 lore raw

PATCH 10/16 Peripheral driver for S3C SOC I2C controller.

In reply to Vincent Sanders
---
 Makefile.target  |    2 +-
 hw/s3c2410x.c    |    7 ++
 hw/s3c2440.c     |    7 ++
 hw/s3c24xx.h     |    9 ++
 hw/s3c24xx_iic.c |  255 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 279 insertions(+), 1 deletions(-)
 create mode 100644 hw/s3c24xx_iic.c
Makefile.target +1 -1
index 52dcf4c..c9af461 100644
@@ -649,7 +649,7 @@ OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
 OBJS+= mst_fpga.o mainstone.o
 OBJS+= musicpal.o pflash_cfi02.o
 OBJS+= s3c24xx_memc.o s3c24xx_irq.o s3c24xx_clkcon.o s3c24xx_timers.o
-OBJS+= s3c24xx_serial.o s3c24xx_rtc.o s3c24xx_gpio.o
+OBJS+= s3c24xx_serial.o s3c24xx_rtc.o s3c24xx_gpio.o s3c24xx_iic.o
 OBJS+= s3c2410x.o s3c2440.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
hw/s3c2410x.c +7 -0
index c3b84a0..f3057f8 100644
@@ -40,6 +40,9 @@
 /* Timer controller */
 #define CPU_S3C2410X_TIMERS_BASE (CPU_S3C2410X_PERIPHERAL + 0x11000000)
 
+/* IIC */
+#define CPU_S3C2410X_IIC_BASE (CPU_S3C2410X_PERIPHERAL + 0x14000000)
+
 /* GPIO */
 #define CPU_S3C2410X_GPIO_BASE (CPU_S3C2410X_PERIPHERAL + 0x16000000)
 
@@ -90,5 +93,9 @@ s3c2410x_init(int sdram_size)
     /* GPIO */
     s->gpio = s3c24xx_gpio_init(s, CPU_S3C2410X_GPIO_BASE, CPU_S3C2410X_IDENT_S3C2410A);
 
+    /* I2C */
+    s->iic = s3c24xx_iic_init(s3c24xx_get_irq(s->irq, 27),
+                              CPU_S3C2410X_IIC_BASE);
+
     return s;
 }
hw/s3c2440.c +7 -0
index b53f010..f8d6f63 100644
@@ -39,6 +39,9 @@
 /* Timer controller */
 #define CPU_S3C2440_TIMERS_BASE (CPU_S3C2440_PERIPHERAL + 0x11000000)
 
+/* IIC */
+#define CPU_S3C2440_IIC_BASE (CPU_S3C2440_PERIPHERAL + 0x14000000)
+
 /* GPIO */
 #define CPU_S3C2440_GPIO_BASE (CPU_S3C2440_PERIPHERAL + 0x16000000)
 
@@ -87,5 +90,9 @@ s3c2440_init(int sdram_size)
     /* And some GPIO */
     s->gpio = s3c24xx_gpio_init(s, CPU_S3C2440_GPIO_BASE, CPU_S3C2440_IDENT_S3C2440A);
 
+    /* I2C */
+    s->iic = s3c24xx_iic_init(s3c24xx_get_irq(s->irq, 27),
+                              CPU_S3C2440_IIC_BASE);
+
     return s;
 }
hw/s3c24xx.h +9 -0
index b9d8dfe..bb52c00 100644
@@ -35,6 +35,9 @@ typedef struct S3CState_s {
 
     /* GPIO */
     struct s3c24xx_gpio_state_s *gpio;
+
+    /* I2C */
+    struct s3c24xx_i2c_state_s *iic;
 } S3CState;
 
 
@@ -65,4 +68,10 @@ struct s3c24xx_gpio_state_s *s3c24xx_gpio_init(S3CState *soc, target_phys_addr_t
 /* get the qemu interrupt from an eirq number */
 qemu_irq s3c24xx_get_eirq(struct s3c24xx_gpio_state_s *s, int einum);
 
+/* Initialise I2c controller */
+struct s3c24xx_i2c_state_s *s3c24xx_iic_init(qemu_irq irq, target_phys_addr_t base_addr);
+
+/* aquire bus from controller state */
+i2c_bus *s3c24xx_i2c_bus(struct s3c24xx_i2c_state_s *s);
+
 #endif /* S3C24XX_H */
hw/s3c24xx_iic.c new file +255 -0

255 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#11 lore raw

PATCH 11/16 Peripheral driver for S3C SOC LCD controller

In reply to Vincent Sanders
---
 Makefile.target       |    1 +
 hw/s3c2410x.c         |    7 +
 hw/s3c2440.c          |    7 +
 hw/s3c24xx.h          |    7 +
 hw/s3c24xx_lcd.c      |  560 +++++++++++++++++++++++++++++++++++++++++++++++++
 hw/s3c24xx_template.h |  266 +++++++++++++++++++++++
 6 files changed, 848 insertions(+), 0 deletions(-)
 create mode 100644 hw/s3c24xx_lcd.c
 create mode 100644 hw/s3c24xx_template.h
Makefile.target +1 -0
index c9af461..0d33486 100644
@@ -650,6 +650,7 @@ OBJS+= mst_fpga.o mainstone.o
 OBJS+= musicpal.o pflash_cfi02.o
 OBJS+= s3c24xx_memc.o s3c24xx_irq.o s3c24xx_clkcon.o s3c24xx_timers.o
 OBJS+= s3c24xx_serial.o s3c24xx_rtc.o s3c24xx_gpio.o s3c24xx_iic.o
+OBJS+= s3c24xx_lcd.o
 OBJS+= s3c2410x.o s3c2440.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
hw/s3c2410x.c +7 -0
index f3057f8..42cd2a8 100644
@@ -32,6 +32,9 @@
 /* Clock control */
 #define CPU_S3C2410X_CLKCON_BASE (CPU_S3C2410X_PERIPHERAL + 0xC000000)
 
+/* LCD controller */
+#define CPU_S3C2410X_LCD_BASE (CPU_S3C2410X_PERIPHERAL + 0xD000000)
+
 /* serial port bases */
 #define CPU_S3C2410X_SERIAL0_BASE (CPU_S3C2410X_PERIPHERAL + 0x10000000)
 #define CPU_S3C2410X_SERIAL1_BASE (CPU_S3C2410X_PERIPHERAL + 0x10004000)
@@ -97,5 +100,9 @@ s3c2410x_init(int sdram_size)
     s->iic = s3c24xx_iic_init(s3c24xx_get_irq(s->irq, 27),
                               CPU_S3C2410X_IIC_BASE);
 
+    /* LCD controller */
+    s->lcd = s3c24xx_lcd_init(CPU_S3C2410X_LCD_BASE,
+                              s3c24xx_get_irq(s->irq, 16));
+
     return s;
 }
hw/s3c2440.c +7 -0
index f8d6f63..3d32c03 100644
@@ -31,6 +31,9 @@
 /* Clock control */
 #define CPU_S3C2440_CLKCON_BASE (CPU_S3C2440_PERIPHERAL + 0xC000000)
 
+/* LCD controller */
+#define CPU_S3C2440_LCD_BASE (CPU_S3C2440_PERIPHERAL + 0xD000000)
+
 /* serial port bases */
 #define CPU_S3C2440_SERIAL0_BASE (CPU_S3C2440_PERIPHERAL + 0x10000000)
 #define CPU_S3C2440_SERIAL1_BASE (CPU_S3C2440_PERIPHERAL + 0x10004000)
@@ -94,5 +97,9 @@ s3c2440_init(int sdram_size)
     s->iic = s3c24xx_iic_init(s3c24xx_get_irq(s->irq, 27),
                               CPU_S3C2440_IIC_BASE);
 
+    /* LCD controller */
+    s->lcd = s3c24xx_lcd_init(CPU_S3C2440_LCD_BASE,
+                              s3c24xx_get_irq(s->irq, 16));
+
     return s;
 }
hw/s3c24xx.h +7 -0
index bb52c00..2fdc3e8 100644
@@ -38,6 +38,10 @@ typedef struct S3CState_s {
 
     /* I2C */
     struct s3c24xx_i2c_state_s *iic;
+
+    /* LCD controller state */
+    struct s3c24xx_lcd_state_s *lcd;
+
 } S3CState;
 
 
@@ -74,4 +78,7 @@ struct s3c24xx_i2c_state_s *s3c24xx_iic_init(qemu_irq irq, target_phys_addr_t ba
 /* aquire bus from controller state */
 i2c_bus *s3c24xx_i2c_bus(struct s3c24xx_i2c_state_s *s);
 
+/* Initialise LCD controller */
+struct s3c24xx_lcd_state_s *s3c24xx_lcd_init(target_phys_addr_t base, qemu_irq irq);
+
 #endif /* S3C24XX_H */
hw/s3c24xx_lcd.c new file +560 -0

560 lines not on this page · raw message

hw/s3c24xx_template.h new file +266 -0

266 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#12 lore raw

PATCH 12/16 Peripheral driver for S3C SOC NAND controller

In reply to Vincent Sanders
---
 Makefile.target   |    2 +-
 hw/s3c2410x.c     |    6 ++
 hw/s3c2440.c      |    6 ++
 hw/s3c24xx.h      |   10 ++++
 hw/s3c24xx_nand.c |  147 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 170 insertions(+), 1 deletions(-)
 create mode 100644 hw/s3c24xx_nand.c
Makefile.target +1 -1
index 0d33486..535b4a2 100644
@@ -650,7 +650,7 @@ OBJS+= mst_fpga.o mainstone.o
 OBJS+= musicpal.o pflash_cfi02.o
 OBJS+= s3c24xx_memc.o s3c24xx_irq.o s3c24xx_clkcon.o s3c24xx_timers.o
 OBJS+= s3c24xx_serial.o s3c24xx_rtc.o s3c24xx_gpio.o s3c24xx_iic.o
-OBJS+= s3c24xx_lcd.o
+OBJS+= s3c24xx_lcd.o s3c24xx_nand.o
 OBJS+= s3c2410x.o s3c2440.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
hw/s3c2410x.c +6 -0
index 42cd2a8..78b9ee0 100644
@@ -35,6 +35,9 @@
 /* LCD controller */
 #define CPU_S3C2410X_LCD_BASE (CPU_S3C2410X_PERIPHERAL + 0xD000000)
 
+/* NAND */
+#define CPU_S3C2410X_NAND_BASE (CPU_S3C2410X_PERIPHERAL + 0xE000000)
+
 /* serial port bases */
 #define CPU_S3C2410X_SERIAL0_BASE (CPU_S3C2410X_PERIPHERAL + 0x10000000)
 #define CPU_S3C2410X_SERIAL1_BASE (CPU_S3C2410X_PERIPHERAL + 0x10004000)
@@ -104,5 +107,8 @@ s3c2410x_init(int sdram_size)
     s->lcd = s3c24xx_lcd_init(CPU_S3C2410X_LCD_BASE,
                               s3c24xx_get_irq(s->irq, 16));
 
+    /* NAND controller */
+    s->nand = s3c24xx_nand_init(CPU_S3C2410X_NAND_BASE);
+
     return s;
 }
hw/s3c2440.c +6 -0
index 3d32c03..fdb107b 100644
@@ -34,6 +34,9 @@
 /* LCD controller */
 #define CPU_S3C2440_LCD_BASE (CPU_S3C2440_PERIPHERAL + 0xD000000)
 
+/* NAND */
+#define CPU_S3C2440_NAND_BASE (CPU_S3C2440_PERIPHERAL + 0xE000000)
+
 /* serial port bases */
 #define CPU_S3C2440_SERIAL0_BASE (CPU_S3C2440_PERIPHERAL + 0x10000000)
 #define CPU_S3C2440_SERIAL1_BASE (CPU_S3C2440_PERIPHERAL + 0x10004000)
@@ -101,5 +104,8 @@ s3c2440_init(int sdram_size)
     s->lcd = s3c24xx_lcd_init(CPU_S3C2440_LCD_BASE,
                               s3c24xx_get_irq(s->irq, 16));
 
+    /* NAND controller */
+    s->nand = s3c24xx_nand_init(CPU_S3C2440_NAND_BASE);
+
     return s;
 }
hw/s3c24xx.h +10 -0
index 2fdc3e8..af73ce5 100644
@@ -11,6 +11,8 @@
 #ifndef S3C24XX_H
 #define S3C24XX_H 1
 
+#include "flash.h"
+
 /* This structure type encapsulates the state of a S3C24XX SoC. */
 typedef struct S3CState_s {
     CPUState *cpu_env;
@@ -42,6 +44,8 @@ typedef struct S3CState_s {
     /* LCD controller state */
     struct s3c24xx_lcd_state_s *lcd;
 
+    /* NAND controller */
+    struct s3c24xx_nand_state_s *nand;
 } S3CState;
 
 
@@ -81,4 +85,10 @@ i2c_bus *s3c24xx_i2c_bus(struct s3c24xx_i2c_state_s *s);
 /* Initialise LCD controller */
 struct s3c24xx_lcd_state_s *s3c24xx_lcd_init(target_phys_addr_t base, qemu_irq irq);
 
+/* Initialise nand controller */
+struct s3c24xx_nand_state_s *s3c24xx_nand_init(target_phys_addr_t base_addr);
+
+/* set nand controller context */
+void s3c24xx_nand_attach(struct s3c24xx_nand_state_s *s, NANDFlashState *nand);
+
 #endif /* S3C24XX_H */
hw/s3c24xx_nand.c new file +147 -0

147 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#13 lore raw

PATCH 13/16 Peripheral driver for S3C OHCI controller

In reply to Vincent Sanders

Add the USB host port OHCI controller useing the existing pxa driver

---
 hw/s3c2410x.c |    9 +++++++++
 hw/s3c2440.c  |    9 +++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
hw/s3c2410x.c +9 -0
index 78b9ee0..79978bf 100644
@@ -13,6 +13,9 @@
 
 #include "s3c2410x.h"
 
+/* Use the PXA OHCI USB mapping */
+#include "pxa.h"
+
 /* S3C2410 SoC IDs */
 #define CPU_S3C2410X_IDENT_S3C2410X 0x32410000
 #define CPU_S3C2410X_IDENT_S3C2410A 0x32410002
@@ -26,6 +29,9 @@
 /* Memory control */
 #define CPU_S3C2410X_MEMC_BASE (CPU_S3C2410X_PERIPHERAL + 0x8000000)
 
+/* USB controller */
+#define CPU_S3C2410X_OHCI_BASE (CPU_S3C2410X_PERIPHERAL + 0x9000000)
+
 /* Interrupt controller */
 #define CPU_S3C2410X_IRQ_BASE (CPU_S3C2410X_PERIPHERAL + 0xA000000)
 
@@ -110,5 +116,8 @@ s3c2410x_init(int sdram_size)
     /* NAND controller */
     s->nand = s3c24xx_nand_init(CPU_S3C2410X_NAND_BASE);
 
+    /* A two port OHCI controller */
+    usb_ohci_init_pxa(CPU_S3C2410X_OHCI_BASE, 2, -1, s3c24xx_get_irq(s->irq, 26));
+
     return s;
 }
hw/s3c2440.c +9 -0
index fdb107b..515f270 100644
@@ -13,6 +13,9 @@
 
 #include "s3c2440.h"
 
+/* Use the PXA OHCI USB mapping */
+#include "pxa.h"
+
 /* S3C2440 SoC ID */
 #define CPU_S3C2440_IDENT_S3C2440A 0x32440001
 
@@ -25,6 +28,9 @@
 /* Memory control */
 #define CPU_S3C2440_MEMC_BASE (CPU_S3C2440_PERIPHERAL + 0x8000000)
 
+/* USB controller */
+#define CPU_S3C2440_OHCI_BASE (CPU_S3C2440_PERIPHERAL + 0x9000000)
+
 /* Interrupt controller */
 #define CPU_S3C2440_IRQ_BASE (CPU_S3C2440_PERIPHERAL + 0xA000000)
 
@@ -107,5 +113,8 @@ s3c2440_init(int sdram_size)
     /* NAND controller */
     s->nand = s3c24xx_nand_init(CPU_S3C2440_NAND_BASE);
 
+    /* A two port OHCI controller */
+    usb_ohci_init_pxa(CPU_S3C2440_OHCI_BASE, 2, -1, s3c24xx_get_irq(s->irq, 26));
+
     return s;
 }
Signature · 1 line
1.6.0.4
#14 lore raw

PATCH 14/16 Add bast board support

In reply to Vincent Sanders
---
 Makefile.target |    1 +
 hw/bast.c       |  191 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 192 insertions(+), 0 deletions(-)
 create mode 100644 hw/bast.c
Makefile.target +1 -0
index 535b4a2..4cb49e1 100644
@@ -652,6 +652,7 @@ OBJS+= s3c24xx_memc.o s3c24xx_irq.o s3c24xx_clkcon.o s3c24xx_timers.o
 OBJS+= s3c24xx_serial.o s3c24xx_rtc.o s3c24xx_gpio.o s3c24xx_iic.o
 OBJS+= s3c24xx_lcd.o s3c24xx_nand.o
 OBJS+= s3c2410x.o s3c2440.o
+OBJS+= bast.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
 OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
hw/bast.c new file +191 -0

191 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#15 lore raw

PATCH 15/16 Add SMDK2410 board support

In reply to Vincent Sanders
---
 Makefile.target |    2 +-
 hw/smdk2410.c   |  125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 126 insertions(+), 1 deletions(-)
 create mode 100644 hw/smdk2410.c
Makefile.target +1 -1
index 4cb49e1..b30e90a 100644
@@ -652,7 +652,7 @@ OBJS+= s3c24xx_memc.o s3c24xx_irq.o s3c24xx_clkcon.o s3c24xx_timers.o
 OBJS+= s3c24xx_serial.o s3c24xx_rtc.o s3c24xx_gpio.o s3c24xx_iic.o
 OBJS+= s3c24xx_lcd.o s3c24xx_nand.o
 OBJS+= s3c2410x.o s3c2440.o
-OBJS+= bast.o
+OBJS+= bast.o smdk2410.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
 OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
hw/smdk2410.c new file +125 -0

125 lines not on this page · raw message

Signature · 1 line
1.6.0.4