From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adxzf-0002cR-5z for qemu-devel@nongnu.org; Thu, 10 Mar 2016 05:39:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adxze-00032l-9x for qemu-devel@nongnu.org; Thu, 10 Mar 2016 05:38:59 -0500 Received: from mail-vk0-x22a.google.com ([2607:f8b0:400c:c05::22a]:34299) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adxzd-00032h-TN for qemu-devel@nongnu.org; Thu, 10 Mar 2016 05:38:58 -0500 Received: by mail-vk0-x22a.google.com with SMTP id e185so90219393vkb.1 for ; Thu, 10 Mar 2016 02:38:57 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Peter Maydell Date: Thu, 10 Mar 2016 17:38:37 +0700 Message-ID: Content-Type: text/plain; charset=UTF-8 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: Jean-Christophe Dubois Cc: QEMU Developers , Peter Crosthwaite 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 = 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. > + if (spi_bus) { > + DeviceState *flash_dev; > + > + flash_dev = ssi_create_slave(spi_bus, "sst25vf016b"); > + if (flash_dev) { > + qemu_irq cs_line = qdev_get_gpio_in_named(flash_dev, > + SSI_GPIO_CS, 0); > + sysbus_connect_irq(SYS_BUS_DEVICE(spi_dev), 1, cs_line); > + } > + } > + } > + } thanks -- PMM