qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, patches@linaro.org
Subject: [Qemu-devel] [PATCH v2 16/18] omap_gpmc: Pull prefetch engine data into sub-struct
Date: Sun, 28 Aug 2011 17:57:06 +0100	[thread overview]
Message-ID: <1314550628-26869-18-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1314550628-26869-1-git-send-email-peter.maydell@linaro.org>

Refactor the gpmc state structure so items relating to
the prefetch engine are in their own sub-struct and have
more useful names.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/omap_gpmc.c |   52 ++++++++++++++++++++++++++++------------------------
 1 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/hw/omap_gpmc.c b/hw/omap_gpmc.c
index 0326d49..158c097 100644
--- a/hw/omap_gpmc.c
+++ b/hw/omap_gpmc.c
@@ -36,10 +36,6 @@ struct omap_gpmc_s {
     uint16_t irqen;
     uint16_t timeout;
     uint16_t config;
-    uint32_t prefconfig[2];
-    int prefcontrol;
-    int preffifo;
-    int prefcount;
     struct omap_gpmc_cs_file_s {
         uint32_t config[7];
         MemoryRegion *iomem;
@@ -51,6 +47,13 @@ struct omap_gpmc_s {
     int ecc_ptr;
     uint32_t ecc_cfg;
     ECCState ecc[9];
+    struct prefetch {
+        uint32_t config1; /* GPMC_PREFETCH_CONFIG1 */
+        uint32_t transfercount; /* GPMC_PREFETCH_CONFIG2:TRANSFERCOUNT */
+        int startengine; /* GPMC_PREFETCH_CONTROL:STARTENGINE */
+        int fifopointer; /* GPMC_PREFETCH_STATUS:FIFOPOINTER */
+        int count; /* GPMC_PREFETCH_STATUS:COUNTVALUE */
+    } prefetch;
 };
 
 #define OMAP_GPMC_8BIT 0
@@ -243,11 +246,11 @@ void omap_gpmc_reset(struct omap_gpmc_s *s)
     omap_gpmc_int_update(s);
     s->timeout = 0;
     s->config = 0xa00;
-    s->prefconfig[0] = 0x00004000;
-    s->prefconfig[1] = 0x00000000;
-    s->prefcontrol = 0;
-    s->preffifo = 0;
-    s->prefcount = 0;
+    s->prefetch.config1 = 0x00004000;
+    s->prefetch.transfercount = 0x00000000;
+    s->prefetch.startengine = 0;
+    s->prefetch.fifopointer = 0;
+    s->prefetch.count = 0;
     for (i = 0; i < 8; i ++) {
         omap_gpmc_cs_unmap(s, i);
         s->cs_file[i].config[1] = 0x101001;
@@ -363,16 +366,16 @@ static uint64_t omap_gpmc_read(void *opaque, target_phys_addr_t addr,
         break;
 
     case 0x1e0:	/* GPMC_PREFETCH_CONFIG1 */
-        return s->prefconfig[0];
+        return s->prefetch.config1;
     case 0x1e4:	/* GPMC_PREFETCH_CONFIG2 */
-        return s->prefconfig[1];
+        return s->prefetch.transfercount;
     case 0x1ec:	/* GPMC_PREFETCH_CONTROL */
-        return s->prefcontrol;
+        return s->prefetch.startengine;
     case 0x1f0:	/* GPMC_PREFETCH_STATUS */
-        return (s->preffifo << 24) |
-                ((s->preffifo >=
-                  ((s->prefconfig[0] >> 8) & 0x7f) ? 1 : 0) << 16) |
-                s->prefcount;
+        return (s->prefetch.fifopointer << 24) |
+                ((s->prefetch.fifopointer >=
+                  ((s->prefetch.config1 >> 8) & 0x7f) ? 1 : 0) << 16) |
+                s->prefetch.count;
 
     case 0x1f4:	/* GPMC_ECC_CONFIG */
         return s->ecc_cs;
@@ -506,21 +509,22 @@ static void omap_gpmc_write(void *opaque, target_phys_addr_t addr,
         break;
 
     case 0x1e0:	/* GPMC_PREFETCH_CONFIG1 */
-        s->prefconfig[0] = value & 0x7f8f7fbf;
+        s->prefetch.config1 = value & 0x7f8f7fbf;
         /* TODO: update interrupts, fifos, dmas */
         break;
 
     case 0x1e4:	/* GPMC_PREFETCH_CONFIG2 */
-        s->prefconfig[1] = value & 0x3fff;
+        s->prefetch.transfercount = value & 0x3fff;
         break;
 
     case 0x1ec:	/* GPMC_PREFETCH_CONTROL */
-        s->prefcontrol = value & 1;
-        if (s->prefcontrol) {
-            if (s->prefconfig[0] & 1)
-                s->preffifo = 0x40;
-            else
-                s->preffifo = 0x00;
+        s->prefetch.startengine = value & 1;
+        if (s->prefetch.startengine) {
+            if (s->prefetch.config1 & 1) {
+                s->prefetch.fifopointer = 0x40;
+            } else {
+                s->prefetch.fifopointer = 0x00;
+            }
         }
         /* TODO: start */
         break;
-- 
1.7.1

  parent reply	other threads:[~2011-08-28 16:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-28 16:56 [Qemu-devel] [PATCH v2 00/18] onenand, omap_gpmc fixes, features Peter Maydell
2011-08-28 16:56 ` Peter Maydell
2011-08-28 16:56 ` [Qemu-devel] [PATCH v2 01/18] hw/sysbus: Add sysbus_mmio_get_region() Peter Maydell
2011-08-28 16:56 ` [Qemu-devel] [PATCH v2 02/18] hw/onenand: Remove unnecessary argument from onenand_command() Peter Maydell
2011-08-28 16:56 ` [Qemu-devel] [PATCH v2 03/18] hw/onenand: Qdevify Peter Maydell
2011-08-28 16:56 ` [Qemu-devel] [PATCH v2 04/18] hw/onenand: Minor spacing fixes Peter Maydell
2011-08-28 16:56 ` [Qemu-devel] [PATCH v2 05/18] omap_gpmc: Clean up omap_gpmc_attach MemoryRegion conversion Peter Maydell
2011-08-28 16:56 ` [Qemu-devel] [PATCH v2 06/18] omap_gpmc: Refactor omap_gpmc_cs_map and omap_gpmc_cs_unmap Peter Maydell
2011-08-28 16:56 ` [Qemu-devel] [PATCH v2 07/18] omap_gpmc: GPMC_IRQSTATUS is write-one-to-clear Peter Maydell
2011-09-17  1:08   ` andrzej zaborowski
2011-09-17 15:47     ` Peter Maydell
2011-08-28 16:56 ` [Qemu-devel] [PATCH v2 08/18] omap_gpmc: Wire up the GPMC IRQ correctly Peter Maydell
2011-08-28 16:56 ` [Qemu-devel] [PATCH v2 09/18] omap_gpmc: Fix handling of FIFOTHRESHOLDSTATUS bit Peter Maydell
2011-09-17  1:22   ` andrzej zaborowski
2011-08-28 16:57 ` [Qemu-devel] [PATCH v2 10/18] omap_gpmc: Take omap_mpu_state* in omap_gpmc_init Peter Maydell
2011-08-28 16:57 ` [Qemu-devel] [PATCH v2 11/18] omap_gpmc: Calculate revision from OMAP model Peter Maydell
2011-08-28 16:57 ` [Qemu-devel] [PATCH v2 12/18] omap_gpmc: Reindent misindented switch statements Peter Maydell
2011-08-28 16:57 ` [Qemu-devel] [PATCH v2 13/18] omap_gpmc: Support NAND devices Peter Maydell
2011-08-28 16:57 ` [Qemu-devel] [PATCH v2 14/18] hw/omap.h: Add OMAP 3630 to omap_mpu_model enumeration Peter Maydell
2011-08-28 16:57 ` [Qemu-devel] [PATCH v2 15/18] omap_gpmc: Accept a zero mask field on omap3630 Peter Maydell
2011-08-28 16:57 ` Peter Maydell [this message]
2011-08-28 16:57 ` [Qemu-devel] [PATCH v2 17/18] omap: Wire up the DMA request line to the GPMC Peter Maydell
2011-08-28 16:57 ` [Qemu-devel] [PATCH v2 18/18] omap_gpmc: Implement prefetch engine Peter Maydell
2011-08-30  6:27 ` [Qemu-devel] [PATCH v2 00/18] onenand, omap_gpmc fixes, features Edgar E. Iglesias

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314550628-26869-18-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=edgar.iglesias@gmail.com \
    --cc=patches@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).