qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jeffery <andrew@aj.id.au>
To: "Cédric Le Goater" <clg@kaod.org>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, Alistair Francis <alistair@alistair23.me>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>
Subject: Re: [Qemu-devel] [PATCH 3/3] aspeed/smc: rename aspeed_smc_flash_send_addr() to aspeed_smc_flash_setup()
Date: Mon, 25 Jun 2018 15:43:00 +0930	[thread overview]
Message-ID: <1529907180.2296295.1419124016.128CD074@webmail.messagingengine.com> (raw)
In-Reply-To: <20180612065716.10587-4-clg@kaod.org>

On Tue, 12 Jun 2018, at 16:27, Cédric Le Goater wrote:
> Also handle the fake transfers for dummy bytes in this setup
> routine. It will be useful when we activate MMIO execution.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Reviewed-by: Andrew Jeffery <andrew@aj.id.au>

> ---
>  hw/ssi/aspeed_smc.c | 31 ++++++++++++++++---------------
>  1 file changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
> index b15370893583..b29bfd3124a9 100644
> --- a/hw/ssi/aspeed_smc.c
> +++ b/hw/ssi/aspeed_smc.c
> @@ -503,10 +503,11 @@ static int aspeed_smc_flash_dummies(const 
> AspeedSMCFlash *fl)
>      return dummies;
>  }
>  
> -static void aspeed_smc_flash_send_addr(AspeedSMCFlash *fl, uint32_t addr)
> +static void aspeed_smc_flash_setup(AspeedSMCFlash *fl, uint32_t addr)
>  {
>      const AspeedSMCState *s = fl->controller;
>      uint8_t cmd = aspeed_smc_flash_cmd(fl);
> +    int i;
>  
>      /* Flash access can not exceed CS segment */
>      addr = aspeed_smc_check_segment_addr(fl, addr);
> @@ -519,6 +520,18 @@ static void 
> aspeed_smc_flash_send_addr(AspeedSMCFlash *fl, uint32_t addr)
>      ssi_transfer(s->spi, (addr >> 16) & 0xff);
>      ssi_transfer(s->spi, (addr >> 8) & 0xff);
>      ssi_transfer(s->spi, (addr & 0xff));
> +
> +    /*
> +     * Use fake transfers to model dummy bytes. The value should
> +     * be configured to some non-zero value in fast read mode and
> +     * zero in read mode. But, as the HW allows inconsistent
> +     * settings, let's check for fast read mode.
> +     */
> +    if (aspeed_smc_flash_mode(fl) == CTRL_FREADMODE) {
> +        for (i = 0; i < aspeed_smc_flash_dummies(fl); i++) {
> +                ssi_transfer(fl->controller->spi, 0xFF);
> +        }
> +    }
>  }
>  
>  static uint64_t aspeed_smc_flash_read(void *opaque, hwaddr addr, 
> unsigned size)
> @@ -537,19 +550,7 @@ static uint64_t aspeed_smc_flash_read(void *opaque, 
> hwaddr addr, unsigned size)
>      case CTRL_READMODE:
>      case CTRL_FREADMODE:
>          aspeed_smc_flash_select(fl);
> -        aspeed_smc_flash_send_addr(fl, addr);
> -
> -        /*
> -         * Use fake transfers to model dummy bytes. The value should
> -         * be configured to some non-zero value in fast read mode and
> -         * zero in read mode. But, as the HW allows inconsistent
> -         * settings, let's check for fast read mode.
> -         */
> -        if (aspeed_smc_flash_mode(fl) == CTRL_FREADMODE) {
> -            for (i = 0; i < aspeed_smc_flash_dummies(fl); i++) {
> -                ssi_transfer(fl->controller->spi, 0xFF);
> -            }
> -        }
> +        aspeed_smc_flash_setup(fl, addr);
>  
>          for (i = 0; i < size; i++) {
>              ret |= ssi_transfer(s->spi, 0x0) << (8 * i);
> @@ -586,7 +587,7 @@ static void aspeed_smc_flash_write(void *opaque, 
> hwaddr addr, uint64_t data,
>          break;
>      case CTRL_WRITEMODE:
>          aspeed_smc_flash_select(fl);
> -        aspeed_smc_flash_send_addr(fl, addr);
> +        aspeed_smc_flash_setup(fl, addr);
>  
>          for (i = 0; i < size; i++) {
>              ssi_transfer(s->spi, (data >> (8 * i)) & 0xff);
> -- 
> 2.13.6
> 
> 

  reply	other threads:[~2018-06-25  6:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12  6:57 [Qemu-devel] [PATCH 0/3] aspeed/smc: small fixes Cédric Le Goater
2018-06-12  6:57 ` [Qemu-devel] [PATCH 1/3] aspeed/smc: fix dummy cycles count when in dual IO mode Cédric Le Goater
2018-06-25  6:02   ` [Qemu-devel] [Qemu-arm] " Andrew Jeffery
2018-06-12  6:57 ` [Qemu-devel] [PATCH 2/3] aspeed/smc: fix HW strapping Cédric Le Goater
2018-06-25  6:12   ` Andrew Jeffery
2018-06-12  6:57 ` [Qemu-devel] [PATCH 3/3] aspeed/smc: rename aspeed_smc_flash_send_addr() to aspeed_smc_flash_setup() Cédric Le Goater
2018-06-25  6:13   ` Andrew Jeffery [this message]
2018-06-20 13:40 ` [Qemu-devel] [PATCH 0/3] aspeed/smc: small fixes Peter Maydell
2018-06-20 13:43   ` Cédric Le Goater
2018-06-25 10:52 ` Peter Maydell

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=1529907180.2296295.1419124016.128CD074@webmail.messagingengine.com \
    --to=andrew@aj.id.au \
    --cc=alistair@alistair23.me \
    --cc=clg@kaod.org \
    --cc=crosthwaite.peter@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.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).