Received: from eggs.gnu.org ([2001:4830:134:3::10]:36645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afwhM-0006P8-4j for qemu-devel@nongnu.org; Tue, 15 Mar 2016 17:40:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afwhI-0007tF-TB for qemu-devel@nongnu.org; Tue, 15 Mar 2016 17:40:16 -0400 Received: from zose-mta03.web4all.fr ([185.49.20.44]:38624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afwhI-0007sA-JN for qemu-devel@nongnu.org; Tue, 15 Mar 2016 17:40:12 -0400 References: <56E1C9DA.7010400@tribudubois.net> From: Jean-Christophe DUBOIS Message-ID: <56E88137.3030601@tribudubois.net> Date: Tue, 15 Mar 2016 22:40:07 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 12/12] i.MX: Add sabrelite i.MX6 emulation. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Peter Crosthwaite Le 11/03/2016 00:57, Peter Maydell a =C3=A9crit : > On 11 March 2016 at 02:24, Jean-Christophe DUBOIS = wrote: >> Le 10/03/2016 11:38, Peter Maydell a =C3=A9crit : >>> On 2 March 2016 at 05:27, Jean-Christophe Dubois >>> wrote: >>>> The sabrelite supports one SPI FLASH memory on SPI1 >>>> >>>> Signed-off-by: Jean-Christophe Dubois >>>> --- >>>> >>>> + >>>> + { >>>> + /* Add the sst25vf016b NOR FLASH memory to first SPI */ >>>> + Object *spi_dev; >>>> + >>>> + spi_dev =3D object_resolve_path_component(OBJECT(&s->soc), >>>> "spi1"); >>>> + if (spi_dev) { >>>> + SSIBus *spi_bus; >>>> + >>>> + spi_bus =3D (SSIBus *)qdev_get_child_bus(DEVICE(spi_dev= ), >>>> "spi"); >>> This looks odd. You should just be able to do >>> spi_bus =3D (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 properti= es >>> 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 'spi= 1" >> 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.) Well, each SPI controller has 4 possible CS lines to external devices=20 and I have 5 SPI controllers. This makes 20 externally facing IRQ lines (these are output lines) to=20 add to the i.MX6 soc object as properties (with a meaningful naming=20 convention). And anyway, what I need to pass to sysbus_connect_irq() is a=20 SYS_BUS_DEVICE and not an IRQ line ... So do you mean I should define the 20 external lines (properties) and=20 wire all of them up with sysbus_connect_irq() in the i.MX6 SOC=20 implementation (fsl-imx6.c)? Then How to you "connect" this externally facing line to the selected=20 device CS line (here a FLASH memory) in sabrelite? JC > > thanks > -- PMM >