From patchwork Tue Dec 11 15:22:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 205257 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DAE9C2C0080 for ; Wed, 12 Dec 2012 02:23:31 +1100 (EST) Received: from localhost ([::1]:38439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiRg9-0001Qz-S7 for incoming@patchwork.ozlabs.org; Tue, 11 Dec 2012 10:23:29 -0500 Received: from eggs.gnu.org ([208.118.235.92]:48986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiRfh-00014Q-8G for qemu-devel@nongnu.org; Tue, 11 Dec 2012 10:23:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TiRfY-0000Rn-Kw for qemu-devel@nongnu.org; Tue, 11 Dec 2012 10:23:01 -0500 Received: from 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:1d0::1]:55594 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiRfY-0000Pc-F8 for qemu-devel@nongnu.org; Tue, 11 Dec 2012 10:22:52 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1TiRfM-0007cK-9o; Tue, 11 Dec 2012 15:22:40 +0000 From: Peter Maydell To: Anthony Liguori Date: Tue, 11 Dec 2012 15:22:38 +0000 Message-Id: <1355239360-29249-5-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1355239360-29249-1-git-send-email-peter.maydell@linaro.org> References: <1355239360-29249-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: qemu-devel@nongnu.org, Paul Brook Subject: [Qemu-devel] [PATCH 4/6] xilinx_zynq: Add one variable to avoid overwriting QSPI bus X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: walimis commit 7b482bcf xilinx_zynq: added QSPI controller Adds one QSPI controller, which has two spi buses, one is for spi0, and another is for spi1. But when initializing the spi1 bus, "dev" has been overwrited by the ssi_create_slave_no_init() function, so that qdev_get_child_bus() returns NULL and the last two m25p80 flashes won't be attached to the spi1 bus, but to main-system-bus. Here we add one variable to avoid overwriting. Signed-off-by: Liming Wang Reviewed-by: Peter Crosthwaite Signed-off-by: Peter Maydell --- hw/xilinx_zynq.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/xilinx_zynq.c b/hw/xilinx_zynq.c index 1f12a3d..49233d8 100644 --- a/hw/xilinx_zynq.c +++ b/hw/xilinx_zynq.c @@ -57,6 +57,7 @@ static inline void zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq, DeviceState *dev; SysBusDevice *busdev; SSIBus *spi; + DeviceState *flash_dev; int i, j; int num_busses = is_qspi ? NUM_QSPI_BUSSES : 1; int num_ss = is_qspi ? NUM_QSPI_FLASHES : NUM_SPI_FLASHES; @@ -81,11 +82,11 @@ static inline void zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq, spi = (SSIBus *)qdev_get_child_bus(dev, bus_name); for (j = 0; j < num_ss; ++j) { - dev = ssi_create_slave_no_init(spi, "m25p80"); - qdev_prop_set_string(dev, "partname", "n25q128"); - qdev_init_nofail(dev); + flash_dev = ssi_create_slave_no_init(spi, "m25p80"); + qdev_prop_set_string(flash_dev, "partname", "n25q128"); + qdev_init_nofail(flash_dev); - cs_line = qdev_get_gpio_in(dev, 0); + cs_line = qdev_get_gpio_in(flash_dev, 0); sysbus_connect_irq(busdev, i * num_ss + j + 1, cs_line); } }