All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Christophe DUBOIS <jcd@tribudubois.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v2 4/4] i.MX: Add SPI NOR FLASH memory to sabrelite board.
Date: Thu, 25 Feb 2016 21:37:09 +0100	[thread overview]
Message-ID: <56CF65F5.60202@tribudubois.net> (raw)
In-Reply-To: <CAFEAcA-Eg3OkGn8zvQOEr9qd+RLW2cLD06fWzu0DfmT19mrUMg@mail.gmail.com>

Le 25/02/2016 15:33, Peter Maydell a écrit :
> On 15 February 2016 at 11:18, Jean-Christophe Dubois
> <jcd@tribudubois.net> wrote:
>> Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
>> ---
>>
>> Changes since v1:
>>   * Not present on v1.
>>
>>   hw/arm/sabrelite.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c
>> index 8db9bbc..237dfa1 100644
>> --- a/hw/arm/sabrelite.c
>> +++ b/hw/arm/sabrelite.c
>> @@ -70,6 +70,15 @@ static void sabrelite_init(MachineState *machine)
>>       memory_region_add_subregion(get_system_memory(), FSL_IMX6_MMDC_ADDR,
>>                                   &s->ram);
>>
>> +    {
>> +        /* Add the sst25vf016b NOR FLASH memory to first SPI */
>> +        SSIBus *spi = (SSIBus *)qdev_get_child_bus(DEVICE(&s->soc.spi[0]),
>> +                                                   "spi");
> Rather than having the board code looking into the internals
> of the SoC struct like this, you should have the SoC create an
> spi bus property for itself, and then here you can just have
>
>        spibus = (SSIBus *)qdev_get_child_bus(DEVICE(&s->soc), "spi");

I have 5 SPI Controllers so I should do it for each of them. And maybe 
also for I2C, SDHC  and other devices ...

There might be a lot of properties a the end ...

What would be the rule?

Is there a recommended naming scheme?

>
> See hw/arm/xlnx-ep108.c for an example of this.
> The code to create the property in the SoC's realize method is
>
>          object_property_add_alias(OBJECT(s), "spi",
>                                    OBJECT(&s->spi[i]), "spi",
>                                    &error_abort);
>
> (where the first "spi" is the name of the bus property to create on the
> SoC object, and the second is the name of the bus property on the
> internal SPI device object). Example code in hw/arm/xlnx-zynqmp.c.

OK, I'll have a look.
>
>> +        DeviceState *flash_dev = ssi_create_slave(spi, "sst25vf016b");
>> +        qemu_irq cs_line = qdev_get_gpio_in_named(flash_dev, SSI_GPIO_CS, 0);
>> +        sysbus_connect_irq(SYS_BUS_DEVICE(&s->soc.spi[0]), 1, cs_line);
> Again, you want the SoC to provide an outward-facing interface to the
> chipselect line so you don't have to have the board code looking
> into soc.spi[] itself.

OK

>
>> +    }
>> +
>>       sabrelite_binfo.ram_size = machine->ram_size;
>>       sabrelite_binfo.kernel_filename = machine->kernel_filename;
>>       sabrelite_binfo.kernel_cmdline = machine->kernel_cmdline;
> thanks
> -- PMM
>

  reply	other threads:[~2016-02-25 20:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 11:17 [Qemu-devel] [PATCH v2 0/4] Add support for i.MX SPI Controller Jean-Christophe Dubois
2016-02-15 11:17 ` [Qemu-devel] [PATCH v2 1/4] FIFO: Add a FIFO32 implementation Jean-Christophe Dubois
2016-02-25 14:12   ` Peter Maydell
2016-02-15 11:17 ` [Qemu-devel] [PATCH v2 2/4] i.MX: Add the Freescale SPI Controller Jean-Christophe Dubois
2016-02-25 14:52   ` Peter Maydell
2016-02-15 11:18 ` [Qemu-devel] [PATCH v2 3/4] i.MX: Add SPI controllers to i.MX6 SOC Jean-Christophe Dubois
2016-02-25 14:27   ` Peter Maydell
2016-02-15 11:18 ` [Qemu-devel] [PATCH v2 4/4] i.MX: Add SPI NOR FLASH memory to sabrelite board Jean-Christophe Dubois
2016-02-25 14:33   ` Peter Maydell
2016-02-25 20:37     ` Jean-Christophe DUBOIS [this message]
2016-02-25 21:03       ` 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=56CF65F5.60202@tribudubois.net \
    --to=jcd@tribudubois.net \
    --cc=crosthwaite.peter@gmail.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.