Skip to contentSkip to conversation

Xilinx Zynq PL330 support

PATCH Superseded Peter A. G. Crosthwaite 3 participants 7 messages Mar 29, 2012 – Mar 30, 2012

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Xilinx Zynq PL330 support

Hi,

These patches add support for the Primcell PL330 DMA controller and add it to the Xilinx Zynq machine model. Patch 1 is the device model. Patch 2 is the machine model update.

Thw Device model was originally contributed by Kirill Batuzov / Samsung, as indicated by the (C) notice in hw/pl330.c.

Peter A. G. Crosthwaite (2):
pl330: initial version
xilinx_zynq: added pl330 to machine model

 MAINTAINERS      |    1 +
 Makefile.target  |    1 +
 hw/pl330.c       | 1395 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/xilinx_zynq.c |   18 +
 4 files changed, 1415 insertions(+), 0 deletions(-)
 create mode 100644 hw/pl330.c
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH 1/2 pl330: initial version

Device model for Primecell PL330 dma controller.

---
 MAINTAINERS     |    1 +
 Makefile.target |    1 +
 hw/pl330.c      | 1395 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1397 insertions(+), 0 deletions(-)
 create mode 100644 hw/pl330.c
MAINTAINERS +1 -0
index f83d07c2..4bdf93a 100644
@@ -257,6 +257,7 @@ S: Maintained
 F: hw/xilinx_zynq.c
 F: hw/zynq_slcr.c
 F: hw/cadence_*
+F: hw/pl330.c
 
 CRIS Machines
 -------------
Makefile.target +1 -0
index 44b2e83..2191103 100644
@@ -362,6 +362,7 @@ obj-arm-y += cadence_uart.o
 obj-arm-y += cadence_ttc.o
 obj-arm-y += cadence_gem.o
 obj-arm-y += xilinx_zynq.o zynq_slcr.o
+obj-arm-y += pl330.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
hw/pl330.c new file +1395 -0

1,395 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#2 lore raw

Re: [Qemu-devel] [PATCH v1 1/2] pl330: initial version

Quoted 11 lines · Peter A. G. Crosthwaite

Device model for Primecell PL330 dma controller.

---

+/*
+ * ARM PrimeCell PL330 DMA Controller
+ *
+ * Copyright (c) 2009 Samsung Electronics.
+ * Contributed by Kirill Batuzov <[email protected]>
+ */

This needs to state the license (presumably GPLv2-or-later but you need to check with the authors of the code), and a Signed-off-by: from somebody at Samsung would be good.

-- PMM

#3 lore raw

Re: [Qemu-devel] [PATCH v1 1/2] pl330: initial version

In reply to Peter A. G. Crosthwaite
Quoted 4 lines · Peter A. G. Crosthwaite

Device model for Primecell PL330 dma controller.

---

Quoted 4 lines
hw/pl330.c new file +4 -0
+static int PL330Fifo_get(PL330Fifo *s, uint8_t *buf, int len, uint8_t tag)
+{
+    int i, ret;
+    int old_s, old_t;

hw/pl330.c line 274

Quoted 10 lines
hw/pl330.c new file +10 -0
+
+    old_s = s->s;
+    old_t = s->t;
+    for (i = 0; i < len; i++) {
+        if (s->t != s->s && s->tag[s->s] == tag) {
+            buf[i] = s->buf[s->s];
+            s->s = PL330Fifo_inc(s->s, s->buf_size);
+        } else {
+            /* Rollback transaction */
+            ret = (s->t == s->s) ? ret = PL330FIFO_STALL : PL330FIFO_ERR;

Minor issue - double assignement of ret in this line.

Quoted 7 lines
hw/pl330.c new file +7 -0
+            s->s = old_s;
+            s->t = old_t;
+            return ret;
+        }
+    }
+    return PL330FIFO_OK;
+}
Signature · 1 line
Kirill Batuzov
#4 lore raw

Re: [Qemu-devel] [PATCH v1 1/2] pl330: initial version

Quoted 11 lines · Kirill Batuzov
Quoted 4 lines · Peter A. G. Crosthwaite

Device model for Primecell PL330 dma controller.

---

Thanks Kirill

Quoted 7 lines
Quoted 7 lines
hw/pl330.c new file +7 -0
+static int PL330Fifo_get(PL330Fifo *s, uint8_t *buf, int len, uint8_t tag)
+{
+    int i, ret;
+    int old_s, old_t;
+
+    old_s = s->s;
+    old_t = s->t;
Quoted 8 lines
Quoted 7 lines

+    for (i = 0; i < len; i++) {
+        if (s->t != s->s && s->tag[s->s] == tag) {
+            buf[i] = s->buf[s->s];
+            s->s = PL330Fifo_inc(s->s, s->buf_size);
+        } else {
+            /* Rollback transaction */
+            ret = (s->t == s->s) ? ret = PL330FIFO_STALL : PL330FIFO_ERR;

Minor issue - double assignement of ret in this line.

Fixed in v2.

Quoted 10 lines
Quoted 7 lines

+            s->s = old_s;
+            s->t = old_t;
+            return ret;
+        }
+    }
+    return PL330FIFO_OK;
+}

--
Kirill Batuzov

Regards,
Peter

#5 lore raw

PATCH 2/2 xilinx_zynq: added pl330 to machine model

In reply to Peter A. G. Crosthwaite
---
 hw/xilinx_zynq.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
hw/xilinx_zynq.c +18 -0
index 7290c64..033ba09 100644
@@ -61,6 +61,9 @@ static void zynq_init(ram_addr_t ram_size, const char *boot_device,
     NICInfo *nd;
     int n;
     qemu_irq cpu_irq;
+    int dma_irqs[8] = {
+        46, 47, 48, 49, 72, 73, 74, 75
+    };
 
     if (!cpu_model) {
         cpu_model = "cortex-a9";
@@ -130,6 +133,21 @@ static void zynq_init(ram_addr_t ram_size, const char *boot_device,
         }
     }
 
+    dev = qdev_create(NULL, "pl330");
+    qdev_prop_set_uint32(dev, "cfg0", 0x001e3071); /* CR0 */
+    qdev_prop_set_uint32(dev, "cfg1", 0x00000074); /* CR1 ... */
+    qdev_prop_set_uint32(dev, "cfg2", 0x00000000);
+    qdev_prop_set_uint32(dev, "cfg3", 0x00000000);
+    qdev_prop_set_uint32(dev, "cfg4", 0x00000000); /* ... CR4 */
+    qdev_prop_set_uint32(dev, "cfg5", 0x07ff7f73); /* CRD */
+    qdev_init_nofail(dev);
+    busdev = sysbus_from_qdev(dev);
+    sysbus_mmio_map(busdev, 0, 0xF8003000);
+    sysbus_connect_irq(busdev, 0, pic[45-IRQ_OFFSET]); /* abort irq line */
+    for (n = 0; n < 8; ++n) { /* event irqs */
+        sysbus_connect_irq(busdev, n + 1, pic[dma_irqs[n] - IRQ_OFFSET]);
+    }
+
     zynq_binfo.ram_size = ram_size;
     zynq_binfo.kernel_filename = kernel_filename;
     zynq_binfo.kernel_cmdline = kernel_cmdline;
Signature · 1 line
1.7.3.2
#6 lore raw
In reply to Peter A. G. Crosthwaite

Sorry should be RFC

Quoted 20 lines · Peter A. G. Crosthwaite

Hi,

These patches add support for the Primcell PL330 DMA controller and add it to the Xilinx Zynq machine model. Patch 1 is the device model. Patch 2 is the machine model update.

Thw Device model was originally contributed by Kirill Batuzov / Samsung, as indicated by the (C) notice in hw/pl330.c.

Peter A. G. Crosthwaite (2):
 pl330: initial version
 xilinx_zynq: added pl330 to machine model

 MAINTAINERS      |    1 +
 Makefile.target  |    1 +
 hw/pl330.c       | 1395 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/xilinx_zynq.c |   18 +

 4 files changed, 1415 insertions(+), 0 deletions(-)

 create mode 100644 hw/pl330.c

--
1.7.3.2