From patchwork Thu Aug 25 20:05:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 3690 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3727923F27 for ; Thu, 25 Aug 2011 20:05:22 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id E66A7A1845B for ; Thu, 25 Aug 2011 20:05:21 +0000 (UTC) Received: by ywo7 with SMTP id 7so2928673ywo.11 for ; Thu, 25 Aug 2011 13:05:21 -0700 (PDT) Received: by 10.150.150.17 with SMTP id x17mr1478979ybd.383.1314302721415; Thu, 25 Aug 2011 13:05:21 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.151.27.20 with SMTP id e20cs253336ybj; Thu, 25 Aug 2011 13:05:21 -0700 (PDT) Received: by 10.213.34.6 with SMTP id j6mr1340920ebd.140.1314302718477; Thu, 25 Aug 2011 13:05:18 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk [81.2.115.146]) by mx.google.com with ESMTPS id k27si1021469eek.66.2011.08.25.13.05.17 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 25 Aug 2011 13:05:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1QwgAp-0005LX-Mo; Thu, 25 Aug 2011 21:05:11 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Andrzej Zaborowski Subject: [PATCH 15/17] omap_gpmc: Pull prefetch engine data into sub-struct Date: Thu, 25 Aug 2011 21:05:09 +0100 Message-Id: <1314302711-20498-16-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1314302711-20498-1-git-send-email-peter.maydell@linaro.org> References: <1314302711-20498-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 --- 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;