From patchwork Mon Aug 6 02:16:21 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: 175246 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 CFBAF2C009A for ; Mon, 6 Aug 2012 13:04:49 +1000 (EST) Received: from localhost ([::1]:43546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyDcd-0002qQ-Kq for incoming@patchwork.ozlabs.org; Sun, 05 Aug 2012 23:04:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyCtM-0008TE-Q6 for qemu-devel@nongnu.org; Sun, 05 Aug 2012 22:18:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SyCtL-0001ep-EG for qemu-devel@nongnu.org; Sun, 05 Aug 2012 22:18:00 -0400 Received: from mail-gg0-f173.google.com ([209.85.161.173]:48344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyCtL-0001db-8Y for qemu-devel@nongnu.org; Sun, 05 Aug 2012 22:17:59 -0400 Received: by mail-gg0-f173.google.com with SMTP id p1so1994474ggn.4 for ; Sun, 05 Aug 2012 19:17:59 -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 :in-reply-to:references:x-gm-message-state; bh=bJ4guPX/yuUyjg03q17akOLgX4PgaenVINH4TAD+E18=; b=Ltcd0DBCLVh9CaZzf23YM88gv5nU1dImRQ1+6FRR2PuDmaVtPhWfGb7QAxeN2kuXgm aaJDjqbdT3ICIdtcNE3/mbYKEdBVP9vQkzZPAxoHODgRoacr2IRWFa1JA78xwhgpugyr mR/Jm/t8GhiyyoGgMzFspifRE9BsufKeSRoMqJhbS64S/D1rShxPxkzm962plmF/86jG YUbQrZNSJpabqJFzDBgGAsFBIQmEoBtiE65bo9XiHL8bLFHH0T1YO7xIToaVmXHnKiow Chjut78qrZT2cpuQODNMjlMG8SQflLFHFWW1iLaEuTaACi1DY7xu+pjBmI8bdoctk8kE IogA== Received: by 10.66.76.106 with SMTP id j10mr14770117paw.51.1344219478660; Sun, 05 Aug 2012 19:17:58 -0700 (PDT) Received: from localhost ([124.148.20.9]) by mx.google.com with ESMTPS id mn9sm7867408pbc.39.2012.08.05.19.17.55 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 05 Aug 2012 19:17:58 -0700 (PDT) From: "Peter A. G. Crosthwaite" To: qemu-devel@nongnu.org, paul@codesourcery.com, edgar.iglesias@gmail.com, peter.maydell@linaro.org, stefanha@gmail.com Date: Mon, 6 Aug 2012 12:16:21 +1000 Message-Id: X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQnsY4qplQj9rmJFIcC4VPm7ijLUd3WcTwGwBGuzBAKmLuMYNZKJZo8kEUvFw/F8LSKDB2Z1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.161.173 Cc: peter.crosthwaite@petalogix.com, i.mitsyanko@samsung.com, john.williams@petalogix.com Subject: [Qemu-devel] [PATCH v5 07/15] stellaris: Removed SSI mux 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 Removed the explicit SSI mux and wired the CS line directly up to the SSI devices. Signed-off-by: Peter A. G. Crosthwaite --- hw/ssd0323.c | 1 + hw/ssi-sd.c | 1 + hw/stellaris.c | 98 ++++++++++---------------------------------------------- 3 files changed, 19 insertions(+), 81 deletions(-) diff --git a/hw/ssd0323.c b/hw/ssd0323.c index db16d20..d8a0c14 100644 --- a/hw/ssd0323.c +++ b/hw/ssd0323.c @@ -352,6 +352,7 @@ static void ssd0323_class_init(ObjectClass *klass, void *data) k->init = ssd0323_init; k->transfer = ssd0323_transfer; + k->cs_polarity = SSI_CS_HIGH; } static TypeInfo ssd0323_info = { diff --git a/hw/ssi-sd.c b/hw/ssi-sd.c index 6fd9ab9..1b1f625 100644 --- a/hw/ssi-sd.c +++ b/hw/ssi-sd.c @@ -256,6 +256,7 @@ static void ssi_sd_class_init(ObjectClass *klass, void *data) k->init = ssi_sd_init; k->transfer = ssi_sd_transfer; + k->cs_polarity = SSI_CS_LOW; } static TypeInfo ssi_sd_info = { diff --git a/hw/stellaris.c b/hw/stellaris.c index ec55c0e..acb297b 100644 --- a/hw/stellaris.c +++ b/hw/stellaris.c @@ -1154,58 +1154,6 @@ static int stellaris_adc_init(SysBusDevice *dev) return 0; } -/* Some boards have both an OLED controller and SD card connected to - the same SSI port, with the SD card chip select connected to a - GPIO pin. Technically the OLED chip select is connected to the SSI - Fss pin. We do not bother emulating that as both devices should - never be selected simultaneously, and our OLED controller ignores stray - 0xff commands that occur when deselecting the SD card. */ - -typedef struct { - SSISlave ssidev; - qemu_irq irq; - int current_dev; - SSIBus *bus[2]; -} stellaris_ssi_bus_state; - -static void stellaris_ssi_bus_select(void *opaque, int irq, int level) -{ - stellaris_ssi_bus_state *s = (stellaris_ssi_bus_state *)opaque; - - s->current_dev = level; -} - -static uint32_t stellaris_ssi_bus_transfer(SSISlave *dev, uint32_t val) -{ - stellaris_ssi_bus_state *s = FROM_SSI_SLAVE(stellaris_ssi_bus_state, dev); - - return ssi_transfer(s->bus[s->current_dev], val); -} - -static const VMStateDescription vmstate_stellaris_ssi_bus = { - .name = "stellaris_ssi_bus", - .version_id = 1, - .minimum_version_id = 1, - .minimum_version_id_old = 1, - .fields = (VMStateField[]) { - VMSTATE_SSI_SLAVE(ssidev, stellaris_ssi_bus_state), - VMSTATE_INT32(current_dev, stellaris_ssi_bus_state), - VMSTATE_END_OF_LIST() - } -}; - -static int stellaris_ssi_bus_init(SSISlave *dev) -{ - stellaris_ssi_bus_state *s = FROM_SSI_SLAVE(stellaris_ssi_bus_state, dev); - - s->bus[0] = ssi_create_bus(&dev->qdev, "ssi0"); - s->bus[1] = ssi_create_bus(&dev->qdev, "ssi1"); - qdev_init_gpio_in(&dev->qdev, stellaris_ssi_bus_select, 1); - - vmstate_register(&dev->qdev, -1, &vmstate_stellaris_ssi_bus, s); - return 0; -} - /* Board init. */ static stellaris_board_info stellaris_boards[] = { { "LM3S811EVB", @@ -1306,29 +1254,33 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model, if (board->dc2 & (1 << 4)) { dev = sysbus_create_simple("pl022", 0x40008000, pic[7]); if (board->peripherals & BP_OLED_SSI) { - DeviceState *mux; void *bus; - qemu_irq select_pin; + /* Some boards have both an OLED controller and SD card connected to + * the same SSI port, with the SD card chip select connected to a + * GPIO pin. Technically the OLED chip select is connected to the + * SSI Fss pin. We do not bother emulating that as both devices + * should never be selected simultaneously, and our OLED controller + * ignores stray 0xff commands that occur when deselecting the SD + * card. + */ bus = qdev_get_child_bus(dev, "ssi"); - mux = ssi_create_slave(bus, "evb6965-ssi"); - select_pin = qdev_get_gpio_in(mux, 0); + + dev = ssi_create_slave(bus, "ssi-sd"); if (gpio_dev[GPIO_D]) { - qdev_connect_gpio_out(gpio_dev[GPIO_D], 0, select_pin); + qdev_connect_gpio_out(gpio_dev[GPIO_D], 0, + qdev_get_gpio_in(dev, 0)); } - 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"); + if (gpio_dev[GPIO_D]) { + qdev_connect_gpio_out(gpio_dev[GPIO_D], 0, + 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)); + qdev_get_gpio_in(dev, 1)); } - - /* Make sure the select pin is high. */ - qemu_irq_raise(select_pin); } } if (board->dc4 & (1 << 28)) { @@ -1393,21 +1345,6 @@ static void stellaris_machine_init(void) machine_init(stellaris_machine_init); -static void stellaris_ssi_bus_class_init(ObjectClass *klass, void *data) -{ - SSISlaveClass *k = SSI_SLAVE_CLASS(klass); - - k->init = stellaris_ssi_bus_init; - k->transfer = stellaris_ssi_bus_transfer; -} - -static TypeInfo stellaris_ssi_bus_info = { - .name = "evb6965-ssi", - .parent = TYPE_SSI_SLAVE, - .instance_size = sizeof(stellaris_ssi_bus_state), - .class_init = stellaris_ssi_bus_class_init, -}; - static void stellaris_i2c_class_init(ObjectClass *klass, void *data) { SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); @@ -1455,7 +1392,6 @@ static void stellaris_register_types(void) type_register_static(&stellaris_i2c_info); type_register_static(&stellaris_gptm_info); type_register_static(&stellaris_adc_info); - type_register_static(&stellaris_ssi_bus_info); } type_init(stellaris_register_types)