qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v3 12/12] i.MX: Add sabrelite i.MX6 emulation.
Date: Fri, 11 Mar 2016 06:57:43 +0700	[thread overview]
Message-ID: <CAFEAcA-KbDzx1OZHTnMHc7umP3fdOaEHoqfzUdfn4zkJjMYGSg@mail.gmail.com> (raw)
In-Reply-To: <56E1C9DA.7010400@tribudubois.net>

On 11 March 2016 at 02:24, Jean-Christophe DUBOIS <jcd@tribudubois.net> wrote:
> Le 10/03/2016 11:38, Peter Maydell a écrit :
>>
>> On 2 March 2016 at 05:27, Jean-Christophe Dubois <jcd@tribudubois.net>
>> wrote:
>>>
>>> The sabrelite supports one SPI FLASH memory on SPI1
>>>
>>> Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
>>> ---
>>>
>>> +
>>> +    {
>>> +        /* Add the sst25vf016b NOR FLASH memory to first SPI */
>>> +        Object *spi_dev;
>>> +
>>> +        spi_dev = object_resolve_path_component(OBJECT(&s->soc),
>>> "spi1");
>>> +        if (spi_dev) {
>>> +            SSIBus *spi_bus;
>>> +
>>> +            spi_bus = (SSIBus *)qdev_get_child_bus(DEVICE(spi_dev),
>>> "spi");
>>
>> This looks odd. You should just be able to do
>>   spi_bus = (SSIBus *)qdev_get_child_bus(DEVICE(&s->soc), "spi1");
>> without using object_resolve_path_component() to try to find an
>> SPI device object, because your SoC device should have alias properties
>> which provide access to its SPI subcomponents' SPI buses.
>> See hw/arm/xlnx-ep108.c for an example of the board code for this and
>> hw/arm/xlnx-zynqmp.c for the SoC code which calls
>> object_property_add_alias() to set up the aliases.
>
>
> I certainly could do as you proposed.
>
> The problem is that I also need the spi_dev device for the
> sysbus_connect_irq() call below.
>
> My spi_dev is referenced as "spi1" in the i.MX6 doc and I added a 'spi1"
> property for it in the i.MX6 soc.
>
> Once I have the spi_dev device it is trivial to retrieve the spi_bus
> attached to it.
>
> So, yes this is not in line with what is done in xlnx-zynqmp.c but the need
> is a bit different.

I think the SoC should probably have an externally-facing IRQ line
which it wires up internally to the SPI's IRQ line.
(This corresponds basically to what happens in h/w -- the SoC's
interfaces are defined by it even though many of them may be
directly wired up to some internal component it has, but from
outside the SoC you don't get access to the whole of the internal
component.)

thanks
-- PMM

  reply	other threads:[~2016-03-10 23:58 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 22:27 [Qemu-devel] [PATCH v3 00/12] Add i.MX6 (Single/Dual/Quad) support Jean-Christophe Dubois
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 01/12] i.MX: Allow GPT timer to rollover Jean-Christophe Dubois
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 02/12] i.MX: Rename CCM NOCLK to CLK_NONE for naming consistency Jean-Christophe Dubois
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 03/12] i.MX: Remove CCM useless clock computation handling Jean-Christophe Dubois
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 04/12] i.MX: Add the CLK_IPG_HIGH clock Jean-Christophe Dubois
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 05/12] i.MX: Add i.MX6 CCM and ANALOG device Jean-Christophe Dubois
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 06/12] ARM: Factor out ARM on/off PSCI control functions Jean-Christophe Dubois
2016-03-10 10:14   ` Peter Maydell
2016-03-16 22:19     ` Jean-Christophe DUBOIS
2016-03-17  8:46       ` Peter Maydell
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 07/12] i.MX: Add i.MX6 System Reset Controller device Jean-Christophe Dubois
2016-03-10 10:20   ` Peter Maydell
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 08/12] i.MX: Add missing descriptions in devices Jean-Christophe Dubois
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 09/12] FIFO: Add a FIFO32 implementation Jean-Christophe Dubois
2016-03-10 10:25   ` Peter Maydell
2016-03-10 19:26     ` Jean-Christophe DUBOIS
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 10/12] i.MX: Add the Freescale SPI Controller Jean-Christophe Dubois
2016-03-10 10:31   ` Peter Maydell
2016-03-10 19:26     ` Jean-Christophe DUBOIS
2016-03-11  0:01       ` Peter Maydell
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 11/12] i.MX: Add i.MX6 SOC implementation Jean-Christophe Dubois
2016-03-10 10:33   ` Peter Maydell
2016-03-01 22:27 ` [Qemu-devel] [PATCH v3 12/12] i.MX: Add sabrelite i.MX6 emulation Jean-Christophe Dubois
2016-03-10 10:38   ` Peter Maydell
2016-03-10 19:24     ` Jean-Christophe DUBOIS
2016-03-10 23:57       ` Peter Maydell [this message]
2016-03-15 21:40         ` Jean-Christophe DUBOIS
2016-03-16  6:32           ` Peter Maydell
2016-03-16 11:28             ` Peter Maydell
2016-03-16 11:04 ` [Qemu-devel] [PATCH v3 00/12] Add i.MX6 (Single/Dual/Quad) support 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=CAFEAcA-KbDzx1OZHTnMHc7umP3fdOaEHoqfzUdfn4zkJjMYGSg@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=crosthwaite.peter@gmail.com \
    --cc=jcd@tribudubois.net \
    --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).