From patchwork Fri Oct 5 00:08:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peter A. G. Crosthwaite" X-Patchwork-Id: 189383 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 086D72C00B9 for ; Fri, 5 Oct 2012 10:50:51 +1000 (EST) Received: from localhost ([::1]:51790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJvUI-0004Il-Uy for incoming@patchwork.ozlabs.org; Thu, 04 Oct 2012 20:09:54 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJvTr-0003B3-8Z for qemu-devel@nongnu.org; Thu, 04 Oct 2012 20:09:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJvTq-000236-1o for qemu-devel@nongnu.org; Thu, 04 Oct 2012 20:09:27 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:42758) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJvTp-0001gF-RN for qemu-devel@nongnu.org; Thu, 04 Oct 2012 20:09:25 -0400 Received: by mail-pa0-f45.google.com with SMTP id fb10so1027227pad.4 for ; Thu, 04 Oct 2012 17:09:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=wOKcFHDcquDFwgQw00rtWCsPbOtQVab2Gi1ReMrLFiU=; b=YyX6Yakapk906+irWtDWrGXGn1TvhxJ70r1utDugViyMEVErWqQIuAKXNdfhRlCQJ9 Il/D5rcFZBLOezg21BgFjGCYK2E7/jn4uOt02FdtXS3kIdwIPXe9AroVIoZFuy9HHTlB xfE1mGWj38h8nY9UUJP7JlBrHKA9xw+5IEwkPwPfIYOUBnpPbnqh03LgW6xS3S6bFopO 9X560N0Rqh2/TRDHLRBfapXJz4uDKnrePLRV8sAvUVpVYIkdpjAS33yG3HNwTNuGhhuz mZu/U6JSM17uDbmz0tl5vEtX3l+0xe9ZzOqdzZT//FrHhrPAcwh1j3Pynl/dhyOjqQ4D gChw== Received: by 10.68.197.70 with SMTP id is6mr14045379pbc.64.1349395765562; Thu, 04 Oct 2012 17:09:25 -0700 (PDT) Received: from localhost ([124.148.20.9]) by mx.google.com with ESMTPS id m5sm5015857pax.10.2012.10.04.17.09.22 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 04 Oct 2012 17:09:24 -0700 (PDT) From: Peter Crosthwaite To: qemu-devel@nongnu.org, edgar.iglesias@gmail.com, blauwirbel@gmail.com, aliguori@us.ibm.com Date: Fri, 5 Oct 2012 10:08:50 +1000 Message-Id: <1349395739-26502-6-git-send-email-peter.crosthwaite@xilinx.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1349395739-26502-1-git-send-email-peter.crosthwaite@xilinx.com> References: <1349395739-26502-1-git-send-email-peter.crosthwaite@xilinx.com> X-Gm-Message-State: ALoCoQkdAnZl/2WmEeE7LwYe0grju7mbdSP/+FCRsDozi3iqPphaYkA0Sj7JigvoaJ3Y2J4XlRaa X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.220.45 Cc: peter.crosthwaite@petalogix.com Subject: [Qemu-devel] [PATCH 05/14] hw/stellaris: Removed gpio_out init array. 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: Peter A. G. Crosthwaite stellaris_init() defines arrays of qemu_irq to decides what each of the GPIO pins are connected to. This is ok for inputs (as an input can only have one source) but is flawed for outputs as an output can connect to any number of sinks. Removed the gpio_out array completely and just replaced its setters with direct calls to qdev_connect_gpio_out(). Signed-off-by: Peter A. G. Crosthwaite --- hw/stellaris.c | 26 ++++++++++++-------------- 1 files changed, 12 insertions(+), 14 deletions(-) diff --git a/hw/stellaris.c b/hw/stellaris.c index 01050d1..a7b68f4 100644 --- a/hw/stellaris.c +++ b/hw/stellaris.c @@ -1244,7 +1244,6 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model, qemu_irq *pic; DeviceState *gpio_dev[7]; qemu_irq gpio_in[7][8]; - qemu_irq gpio_out[7][8]; qemu_irq adc; int sram_size; int flash_size; @@ -1284,8 +1283,9 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model, pic[gpio_irq[i]]); for (j = 0; j < 8; j++) { gpio_in[i][j] = qdev_get_gpio_in(gpio_dev[i], j); - gpio_out[i][j] = NULL; } + } else { + gpio_dev[i] = NULL; } } @@ -1308,20 +1308,27 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model, if (board->peripherals & BP_OLED_SSI) { DeviceState *mux; void *bus; + qemu_irq select_pin; bus = qdev_get_child_bus(dev, "ssi"); mux = ssi_create_slave(bus, "evb6965-ssi"); - gpio_out[GPIO_D][0] = qdev_get_gpio_in(mux, 0); + select_pin = qdev_get_gpio_in(mux, 0); + if (gpio_dev[GPIO_D]) { + qdev_connect_gpio_out(gpio_dev[GPIO_D], 0, select_pin); + } bus = qdev_get_child_bus(mux, "ssi0"); ssi_create_slave(bus, "ssi-sd"); bus = qdev_get_child_bus(mux, "ssi1"); dev = ssi_create_slave(bus, "ssd0323"); - gpio_out[GPIO_C][7] = qdev_get_gpio_in(dev, 0); + if (gpio_dev[GPIO_C]) { + qdev_connect_gpio_out(gpio_dev[GPIO_C], 7, + qdev_get_gpio_in(dev, 0)); + } /* Make sure the select pin is high. */ - qemu_irq_raise(gpio_out[GPIO_D][0]); + qemu_irq_raise(select_pin); } } if (board->dc4 & (1 << 28)) { @@ -1347,15 +1354,6 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model, stellaris_gamepad_init(5, gpad_irq, gpad_keycode); } - for (i = 0; i < 7; i++) { - if (board->dc4 & (1 << i)) { - for (j = 0; j < 8; j++) { - if (gpio_out[i][j]) { - qdev_connect_gpio_out(gpio_dev[i], j, gpio_out[i][j]); - } - } - } - } } /* FIXME: Figure out how to generate these from stellaris_boards. */