[PATCH qemu 13/38] aspeed/smc: introduce a aspeed_smc_flash_update_cs() helper

Andrew Jeffery andrew at aj.id.au
Tue Nov 22 00:36:39 AEDT 2016


On Fri, 2016-11-18 at 15:21 +0100, Cédric Le Goater wrote:
> aspeed_smc_update_cs() was uselessly looping on all CS to update their
> status.
> 
> Signed-off-by: Cédric Le Goater <clg at kaod.org>

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

> ---
>  hw/ssi/aspeed_smc.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
> index 91cdc0bf1ac7..1c6c5089f265 100644
> --- a/hw/ssi/aspeed_smc.c
> +++ b/hw/ssi/aspeed_smc.c
> @@ -408,14 +408,10 @@ static const MemoryRegionOps aspeed_smc_flash_ops = {
>      },
>  };
>  
> -static void aspeed_smc_update_cs(const AspeedSMCState *s)
> +static void aspeed_smc_flash_update_cs(AspeedSMCFlash *fl)
>  {
> -    int i;
> -
> -    for (i = 0; i < s->num_cs; ++i) {
> -        qemu_set_irq(s->cs_lines[i],
> -                     aspeed_smc_is_ce_stop_active(&s->flashes[i]));
> -    }
> +    AspeedSMCState *s = fl->controller;
> +    qemu_set_irq(s->cs_lines[fl->id], aspeed_smc_is_ce_stop_active(fl));
>  }
>  
>  static void aspeed_smc_reset(DeviceState *d)
> @@ -431,6 +427,7 @@ static void aspeed_smc_reset(DeviceState *d)
>      /* Unselect all slaves */
>      for (i = 0; i < s->num_cs; ++i) {
>          s->regs[s->r_ctrl0 + i] |= CTRL_CE_STOP_ACTIVE;
> +        qemu_set_irq(s->cs_lines[i], true);
>      }
>  
>      /* setup default segment register values for all */
> @@ -438,8 +435,6 @@ static void aspeed_smc_reset(DeviceState *d)
>          s->regs[R_SEG_ADDR0 + i] =
>              aspeed_smc_segment_to_reg(&s->ctrl->segments[i]);
>      }
> -
> -    aspeed_smc_update_cs(s);
>  }
>  
>  static uint64_t aspeed_smc_read(void *opaque, hwaddr addr, unsigned int size)
> @@ -489,8 +484,9 @@ static void aspeed_smc_write(void *opaque, hwaddr addr, uint64_t data,
>          addr == s->r_ce_ctrl) {
>          s->regs[addr] = value;
>      } else if (addr >= s->r_ctrl0 && addr < s->r_ctrl0 + s->num_cs) {
> +        int cs = addr - s->r_ctrl0;
>          s->regs[addr] = value;
> -        aspeed_smc_update_cs(s);
> +        aspeed_smc_flash_update_cs(&s->flashes[cs]);
>      } else if (addr >= R_SEG_ADDR0 &&
>                 addr < R_SEG_ADDR0 + s->ctrl->max_slaves) {
>          int cs = addr - R_SEG_ADDR0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20161122/cfe951a5/attachment.sig>


More information about the openbmc mailing list