[PATCH qemu 11/38] aspeed/smc: get the number of flash modules from hw strapping

Cédric Le Goater clg at kaod.org
Tue Nov 22 00:29:46 AEDT 2016


On 11/21/2016 02:13 PM, Andrew Jeffery wrote:
> On Fri, 2016-11-18 at 15:21 +0100, Cédric Le Goater wrote:
>> If the second watchdog is activated, a second flash module is
>> available. It should be of the same model.
>>
>>> Signed-off-by: Cédric Le Goater <clg at kaod.org>
>> ---
>>  hw/arm/aspeed_soc.c | 26 +++++++++++++++++++++++++-
>>  1 file changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
>> index 503efe0f5f77..fcf029f8c1c2 100644
>> --- a/hw/arm/aspeed_soc.c
>> +++ b/hw/arm/aspeed_soc.c
>> @@ -170,12 +170,30 @@ static void aspeed_soc_init(Object *obj)
>>                                "ram-size", &error_abort);
>>  }
>>  
>> +static int aspeed_fmc_get_cs(AspeedSoCState *s, Error **errp)
>> +{
>> +    Error *err = NULL;
>> +    uint32_t hw_strap1;
>> +
>> +    hw_strap1 = object_property_get_int(OBJECT(&s->scu), "hw-strap1", errp);
>> +    if (err) {
>> +        error_propagate(errp, err);
>> +        return -1;
>> +    }
>> +
>> +    /*
>> +     * If the second watchdog is activated, then we have two chips.
>> +     */
>> +    return hw_strap1 & SCU_HW_STRAP_2ND_BOOT_WDT ? 2 : 1;
> 
> Should we instead count the muxed chip selects? We also have FWSPICS2#.
>   We would be looking at:
> 
> FWSPICS0#: Dedicated pin, no configuration
> FWSPICS1#: SCU88[24]=1 & COND2
> FWSPICS2#: SCU88[25]=1 & COND2
> 
> Where COND2 is: SCU94[1:0] = 0

Yes I agree. that would be much better for the AST2500 but I don't see 
a solution for the AST2400 ? 

C. 

>> +}
>> +
>>  static void aspeed_soc_realize(DeviceState *dev, Error **errp)
>>  {
>>      int i;
>>      AspeedSoCState *s = ASPEED_SOC(dev);
>>      AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
>>      Error *err = NULL, *local_err = NULL;
>> +    int fmc_num_cs;
>>  
>>      /* IO space */
>>      memory_region_init_io(&s->iomem, NULL, &aspeed_soc_io_ops, NULL,
>> @@ -251,7 +269,13 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
>>                         qdev_get_gpio_in(DEVICE(&s->vic), 12));
>>  
>>      /* FMC */
>> -    object_property_set_int(OBJECT(&s->fmc), 1, "num-cs", &err);
>> +    fmc_num_cs = aspeed_fmc_get_cs(s, &err);
>> +    if (err) {
>> +        error_propagate(errp, err);
>> +        return;
>> +    }
>> +
>> +    object_property_set_int(OBJECT(&s->fmc), fmc_num_cs, "num-cs", &err);
>>      object_property_set_bool(OBJECT(&s->fmc), true, "realized", &local_err);
>>      error_propagate(&err, local_err);
>>      if (err) {



More information about the openbmc mailing list