From patchwork Tue Oct 15 10:37:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 835431 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c8f:0:b0:37d:45d0:187 with SMTP id z15csp162182wrs; Tue, 15 Oct 2024 03:42:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWOEzMTFudbYRfI2C+P5TBfTYsFN8WhBQfO4N6CRykIMWJc0ze+5XQQ1q7JDeiAxA3GulHS2g==@linaro.org X-Google-Smtp-Source: AGHT+IEsCIDcm66VC4U+oqq+GIa6N/oNsgmUiPXauaWszXSXFCfr3XlMzEjF/p5DYxVxc1mlCgSd X-Received: by 2002:a05:6214:5c42:b0:6cc:70e:3fcd with SMTP id 6a1803df08f44-6cc070e3fcfmr115359386d6.42.1728988959340; Tue, 15 Oct 2024 03:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1728988959; cv=none; d=google.com; s=arc-20240605; b=jqbz63vuXQqmZBe8DMxluGE3tur1Ts9QLDCN41MSR4BZ3Cyhy7Y4t3N9QqtxKVEHjn 4+chBxkJY6bGTrQDujfXySzHhMJMop5Ho8XW30jYrAsk662cnlpnGtddrnHiBuPlkl36 9haWgr2wCVG54POGL/+dOwsfP7ZuMeTci3k+Vsxp8zYtPlO5Ib6MmN7OScog3mP6NR8A 61APyzkxCT/Vt4SYv+9swWlvC3wkAsXL3PfVroxwDn9gX1NrdFmMONftIrqi6abF5GjB 7HsYJIM86931FGWHO0QI+HoOkipXSi0Y11xUpdP9gYWvjbnLKbOVTlVjP8qZUVsjdlhi Vf8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=47U5s28OGpM6bb1dLZ8yiy3hyxHlTkKckKzJhK7slhA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=FQsVPFT5bAByzKXQt0DBXh0ZnHHaHZpMKP2sepl48ThdzA4EGzU+68PPjcFA6KPX6F 1AzUInK8xzxfjASeWKR+JLlY9XGL3H49hY0hfGQA2OMbo9d5im0tKe5UNW3fREhX1pVI n6WF+rbUSZBGYR1XDKSEoSs3AtdPkFWKdks6exvb5r1TKQGaAVZs1H1G6kL0jGRT7uPB bt7coejNkZYJNxIE2B9bhmX/Y+/s80gYaV2lPeTUswz+/EvkoGSlIGsrGvdqLFZr1BUn csQk/LyIFbeedMjMSGIADSYgD68Voq4owl/SVA9c1Ee7X2JM9n0B/FGfiCeIClxdEhoj w84g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CStta/v5"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6cc22b39fb7si11219326d6.406.2024.10.15.03.42.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Oct 2024 03:42:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CStta/v5"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t0ewZ-0006gc-1j; Tue, 15 Oct 2024 06:38:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0ewV-0006dl-Dp for qemu-devel@nongnu.org; Tue, 15 Oct 2024 06:38:19 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t0ewS-0005wN-Ix for qemu-devel@nongnu.org; Tue, 15 Oct 2024 06:38:19 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-37d4c482844so2984285f8f.0 for ; Tue, 15 Oct 2024 03:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728988695; x=1729593495; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=47U5s28OGpM6bb1dLZ8yiy3hyxHlTkKckKzJhK7slhA=; b=CStta/v55clxwg3Dw7yEeLQSO9QKJ+IOTroZSS9YqjT/ryUCe5UnYjDiAxiEQU4fbk +evzGzpxwINRQzF+gBA25odwXA4FpScTfiAAvN0aBhv2b5hTvcF9Qk4Vd+kESqQGqrwY fn5kInQhfNy4GQj69vl7TBZKTuk0IdfMd+avM1sDLCGXLspem75ZPYBCOl1y8/WDLenw byIZVCg2qJTKej9lwtX5rJ+Y6QJzL5b4jd4myugwvZhVleHfZdZwG2JLssQ9fLjxStyq TWzza6B9KDQUtqWUBv8SSQVyQ9YoyRB1DKVf0Y7gtAWrx6/16ZeJHlMrqa+UjZRkJTCz iyAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728988695; x=1729593495; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=47U5s28OGpM6bb1dLZ8yiy3hyxHlTkKckKzJhK7slhA=; b=NO0rkeSYbsKONNBCHeFuGGpxqiFTlwO0j55c74Ov5I5EOWCYE8W6e0mTIv6eT6dpCW 6ohBXWQhOUB2ySkJxOcp7j5mzj6uhtqoFMSmD+4uAezDHhzR73giZ5dHauMZhEAICauq nuYCVp3f/uG37+GRsNigIkrv5/QycPp0CgYyztoqlhgkO15h+Sh+BUBiFFpTvg/JC3Zq Sowq5+qXk3yZvfhvdWrcWsXRCXTcbrSZaUSU5vFpn1vhsfqcTcC0c2MbCSUcLO9doYCd icKBk2gRbqhHCel/wP1tkeFC2MKpS+G7vCX+kC8ULFYcehP/a/W3qite+BwswKXVTtPW hzmQ== X-Gm-Message-State: AOJu0YwIsc+5oDJpKDgr4ffc5YyXPgLusaeJ01jeu57+FWyup6j3Ioc3 TFjrCW/Ut9L2V0JbhiFYljRVWotu+1ijE8Ta/lC9CgtFX8cdyTTyb1bWTW0e3iOC8J63DbxZEqp A X-Received: by 2002:adf:e78d:0:b0:37d:4894:6895 with SMTP id ffacd0b85a97d-37d551e432cmr10975035f8f.15.1728988695058; Tue, 15 Oct 2024 03:38:15 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d7fa7a06dsm1241635f8f.5.2024.10.15.03.38.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 03:38:14 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/28] hw/arm: Add SPI to Allwinner A10 Date: Tue, 15 Oct 2024 11:37:51 +0100 Message-Id: <20241015103808.133024-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015103808.133024-1-peter.maydell@linaro.org> References: <20241015103808.133024-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Strahinja Jankovic The Allwinner A10 SPI controller is added to the Allwinner A10 description, so it is available when Cubieboard is emulated. Update the documentation for Cubieboard to indicate SPI availability. Signed-off-by: Strahinja Jankovic Message-id: 20241001221349.8319-3-strahinja.p.jankovic@gmail.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- docs/system/arm/cubieboard.rst | 1 + include/hw/arm/allwinner-a10.h | 2 ++ hw/arm/allwinner-a10.c | 8 ++++++++ hw/arm/Kconfig | 1 + 4 files changed, 12 insertions(+) diff --git a/docs/system/arm/cubieboard.rst b/docs/system/arm/cubieboard.rst index 58c4a2d3ea6..90d24c73a13 100644 --- a/docs/system/arm/cubieboard.rst +++ b/docs/system/arm/cubieboard.rst @@ -15,4 +15,5 @@ Emulated devices: - USB controller - SATA controller - TWI (I2C) controller +- SPI controller - Watchdog timer diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h index 67a9a17b862..e5815b0d12b 100644 --- a/include/hw/arm/allwinner-a10.h +++ b/include/hw/arm/allwinner-a10.h @@ -12,6 +12,7 @@ #include "hw/misc/allwinner-a10-ccm.h" #include "hw/misc/allwinner-a10-dramc.h" #include "hw/i2c/allwinner-i2c.h" +#include "hw/ssi/allwinner-a10-spi.h" #include "hw/watchdog/allwinner-wdt.h" #include "sysemu/block-backend.h" @@ -40,6 +41,7 @@ struct AwA10State { AllwinnerAHCIState sata; AwSdHostState mmc0; AWI2CState i2c0; + AWA10SPIState spi0; AwRtcState rtc; AwWdtState wdt; MemoryRegion sram_a; diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c index 08cdff61e46..9eb1aa73662 100644 --- a/hw/arm/allwinner-a10.c +++ b/hw/arm/allwinner-a10.c @@ -35,6 +35,7 @@ #define AW_A10_PIC_REG_BASE 0x01c20400 #define AW_A10_PIT_REG_BASE 0x01c20c00 #define AW_A10_UART0_REG_BASE 0x01c28000 +#define AW_A10_SPI0_BASE 0x01c05000 #define AW_A10_EMAC_BASE 0x01c0b000 #define AW_A10_EHCI_BASE 0x01c14000 #define AW_A10_OHCI_BASE 0x01c14400 @@ -80,6 +81,8 @@ static void aw_a10_init(Object *obj) object_initialize_child(obj, "i2c0", &s->i2c0, TYPE_AW_I2C); + object_initialize_child(obj, "spi0", &s->spi0, TYPE_AW_A10_SPI); + for (size_t i = 0; i < AW_A10_NUM_USB; i++) { object_initialize_child(obj, "ehci[*]", &s->ehci[i], TYPE_PLATFORM_EHCI); @@ -195,6 +198,11 @@ static void aw_a10_realize(DeviceState *dev, Error **errp) sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c0), 0, AW_A10_I2C0_BASE); sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c0), 0, qdev_get_gpio_in(dev, 7)); + /* SPI */ + sysbus_realize(SYS_BUS_DEVICE(&s->spi0), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi0), 0, AW_A10_SPI0_BASE); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->spi0), 0, qdev_get_gpio_in(dev, 10)); + /* WDT */ sysbus_realize(SYS_BUS_DEVICE(&s->wdt), &error_fatal); sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->wdt), 0, AW_A10_WDT_BASE, 1); diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index f1e981622a1..0d658ead093 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -328,6 +328,7 @@ config ALLWINNER_A10 select ALLWINNER_WDT select ALLWINNER_EMAC select ALLWINNER_I2C + select ALLWINNER_A10_SPI select AXP2XX_PMU select SERIAL_MM select UNIMP