All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org,
	"Marcin Krzeminski" <marcin.krzeminski@nokia.com>,
	"Cédric Le Goater" <clg@kaod.org>
Subject: [Qemu-devel] [PATCH v2 04/11] aspeed/smc: autostrap CE0/1 configuration
Date: Mon,  9 Jan 2017 17:24:40 +0100	[thread overview]
Message-ID: <1483979087-32663-5-git-send-email-clg@kaod.org> (raw)
In-Reply-To: <1483979087-32663-1-git-send-email-clg@kaod.org>

On the AST2500 SoC, the FMC controller flash type is fixed to SPI for
CE0 and CE1 and 4BYTE mode is autodetected for CE0.

On the AST2400 SoC, the FMC controller flash type and 4BYTE mode are
strapped with register SCU70. We use the default settings from the
palmetto-bmc machine for now.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
---
 hw/ssi/aspeed_smc.c | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

 Changes since v1:

 - splitted ast2400 from ast2500 strapping as they should be handled
   in a different way. ast2400 strapping should be derived from SCU70
   but it seems a little overly complex to do it now.

diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
index 9b31d5d27012..3bd381b13bc2 100644
--- a/hw/ssi/aspeed_smc.c
+++ b/hw/ssi/aspeed_smc.c
@@ -39,11 +39,14 @@
 #define   CONF_ENABLE_W2       18
 #define   CONF_ENABLE_W1       17
 #define   CONF_ENABLE_W0       16
-#define   CONF_FLASH_TYPE4     9
-#define   CONF_FLASH_TYPE3     7
-#define   CONF_FLASH_TYPE2     5
-#define   CONF_FLASH_TYPE1     3
-#define   CONF_FLASH_TYPE0     1
+#define   CONF_FLASH_TYPE4     8
+#define   CONF_FLASH_TYPE3     6
+#define   CONF_FLASH_TYPE2     4
+#define   CONF_FLASH_TYPE1     2
+#define   CONF_FLASH_TYPE0     0
+#define      CONF_FLASH_TYPE_NOR   0x0
+#define      CONF_FLASH_TYPE_NAND  0x1
+#define      CONF_FLASH_TYPE_SPI   0x2
 
 /* CE Control Register */
 #define R_CE_CTRL            (0x04 / 4)
@@ -436,6 +439,25 @@ static void aspeed_smc_reset(DeviceState *d)
         s->regs[R_SEG_ADDR0 + i] =
             aspeed_smc_segment_to_reg(&s->ctrl->segments[i]);
     }
+
+    /* HW strapping for AST2500 FMC controllers  */
+    if (s->ctrl->segments == aspeed_segments_ast2500_fmc) {
+        /* flash type is fixed to SPI for CE0 and CE1 */
+        s->regs[s->r_conf] |= (CONF_FLASH_TYPE_SPI << CONF_FLASH_TYPE0);
+        s->regs[s->r_conf] |= (CONF_FLASH_TYPE_SPI << CONF_FLASH_TYPE1);
+
+        /* 4BYTE mode is autodetected for CE0. Let's force it to 1 for
+         * now */
+        s->regs[s->r_ce_ctrl] |= (1 << (CTRL_EXTENDED0));
+    }
+
+    /* HW strapping for AST2400 FMC controllers (SCU70). Let's use the
+     * configuration of the palmetto-bmc machine */
+    if (s->ctrl->segments == aspeed_segments_fmc) {
+        s->regs[s->r_conf] |= (CONF_FLASH_TYPE_SPI << CONF_FLASH_TYPE0);
+
+        s->regs[s->r_ce_ctrl] |= (1 << (CTRL_EXTENDED0));
+    }
 }
 
 static uint64_t aspeed_smc_read(void *opaque, hwaddr addr, unsigned int size)
-- 
2.7.4

  parent reply	other threads:[~2017-01-09 16:25 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 16:24 [Qemu-devel] [PATCH v2 00/11] Aspeed SMC controller fixes and improvements Cédric Le Goater
2017-01-09 16:24 ` [Qemu-devel] [PATCH v2 01/11] aspeed/smc: remove call to reset in realize function Cédric Le Goater
2017-01-11 18:10   ` mar.krzeminski
2017-01-09 16:24 ` [Qemu-devel] [PATCH v2 02/11] aspeed/smc: remove call to aspeed_smc_update_cs() in reset function Cédric Le Goater
2017-01-16 17:23   ` mar.krzeminski
2017-01-17  8:05     ` Cédric Le Goater
2017-01-09 16:24 ` [Qemu-devel] [PATCH v2 03/11] aspeed/smc: rework the prototype of the AspeedSMCFlash helper routines Cédric Le Goater
2017-01-09 16:24 ` Cédric Le Goater [this message]
2017-01-09 16:24 ` [Qemu-devel] [PATCH v2 05/11] aspeed/smc: unfold the AspeedSMCController array Cédric Le Goater
2017-01-09 16:24 ` [Qemu-devel] [PATCH v2 06/11] aspeed/smc: adjust the size of the register region Cédric Le Goater
2017-01-09 16:24 ` [Qemu-devel] [PATCH v2 07/11] aspeed/smc: handle SPI flash Command mode Cédric Le Goater
2017-01-19 19:26   ` Peter Maydell
2017-01-19 20:35     ` Cédric Le Goater
2017-01-20 10:13       ` Peter Maydell
2017-01-20 10:17         ` Cédric Le Goater
2017-01-20 11:22           ` Cédric Le Goater
2017-01-09 16:24 ` [Qemu-devel] [PATCH v2 08/11] aspeed/smc: reset flash after each test Cédric Le Goater
2017-01-16 17:37   ` mar.krzeminski
2017-01-16 18:10     ` Cédric Le Goater
2017-01-16 18:19       ` mar.krzeminski
2017-01-09 16:24 ` [Qemu-devel] [PATCH v2 09/11] aspeed/smc: extend tests for Command mode Cédric Le Goater
2017-01-16 17:51   ` mar.krzeminski
2017-01-17  8:34     ` Cédric Le Goater
2017-01-17 17:34       ` mar.krzeminski
2017-01-18 14:56         ` Cédric Le Goater
2017-01-09 16:24 ` [Qemu-devel] [PATCH v2 10/11] aspeed: use first FMC flash as a boot ROM Cédric Le Goater
2017-01-30 12:55   ` Peter Maydell
2017-01-30 13:38     ` Cédric Le Goater
2017-01-09 16:24 ` [Qemu-devel] [PATCH v2 11/11] aspeed/smc: handle dummy bytes when doing fast reads in command mode Cédric Le Goater
2017-01-11 18:20   ` mar.krzeminski
2017-01-11 18:55     ` Cédric Le Goater
2017-01-14 18:56       ` mar.krzeminski
2017-01-16  8:18         ` Cédric Le Goater
2017-01-16 18:58           ` mar.krzeminski
2017-01-17  8:37             ` Cédric Le Goater
2017-01-17 17:30               ` mar.krzeminski
2017-01-16 17:00 ` [Qemu-devel] [PATCH v2 00/11] Aspeed SMC controller fixes and improvements Peter Maydell
2017-01-16 17:08   ` Cédric Le Goater

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=1483979087-32663-5-git-send-email-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=crosthwaite.peter@gmail.com \
    --cc=marcin.krzeminski@nokia.com \
    --cc=peter.maydell@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.