From patchwork Tue Jun 23 11:38:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 191473 Delivered-To: patch@linaro.org Received: by 2002:a92:1f07:0:0:0:0:0 with SMTP id i7csp1914762ile; Tue, 23 Jun 2020 05:10:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHvz6/fsQwWfxhuwd3ZicGi6kyPSOAOzU0OG4/5zqjYKUM6gmZTgyx9ITLzAD8iZG4eoi0 X-Received: by 2002:a25:af06:: with SMTP id a6mr37980147ybh.271.1592914204407; Tue, 23 Jun 2020 05:10:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592914204; cv=none; d=google.com; s=arc-20160816; b=uT37ax7QZKeM+VqeG1vrSJMSl9ZjK8+/O92Mhr67JSSOO0ZjtVxdUL31Btzx+S9skc OQoXCCnt+aWOVuzOTvfhQjyZLR8/2lHMubVAv/xeNzF9miIaEuUM1SSz9NoTUr8wcI+u jakzudUuPADM3p5GSWNZzdlenFW6+b7n8jYgr7uTPcfJSHwRr2+VfdxEO/3/8YF+keqM Af2JD4uyGGFV2TsA6cnn2DsTczc3gMpFdKuNM970sGH4jBVwba9HIAktxHmoEh+lgY6B XXz6O+lQe/sJJfIVC8dSVMw/XmjC4tHA0Fm+eChl1n40lMOl60769EeVeoKuyCqCix0G IW0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=tymhxqXyDEbTmZSCGO7IT18a7NBET9izMcg9/EiMo9E=; b=ojvafFUEsu9rEaYh9NO3ARQMaN5KfM1STote4iBAwHJX4PKhqXunnqfrjMJLksZfsK 80/o0iLlDsLCcYbJfXTjPfsjGAqpK7EUbb2twRit6VrO8GD69sWgte8KsCtwkwZnvgoj INsen2o1SI0/CvYbDNb/ymg+48LJJ5vB3gYHrdcYKBEjsbK+39oFLiTGu4CUyPA4cIt/ QCsjtvHF2/5sCB2kJGYBQQpx2GuB9f5pCATnjKvop+7422ywPMI+gnKtiY9GjvLQdzCA 0Ll8aUoo67A03/oPJxyAr1M2EIj0ZwK3UGt7gNy1ceVP3arA2tez121UEk6DevEWzL1F EAag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t2hG5wLJ; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l7si18110187ybj.78.2020.06.23.05.10.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jun 2020 05:10:04 -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=t2hG5wLJ; 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 Received: from localhost ([::1]:47046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnhkZ-0001aq-M0 for patch@linaro.org; Tue, 23 Jun 2020 08:10:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnhHL-0003bG-Uo for qemu-devel@nongnu.org; Tue, 23 Jun 2020 07:39:53 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:37593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jnhHJ-0003Ri-QL for qemu-devel@nongnu.org; Tue, 23 Jun 2020 07:39:51 -0400 Received: by mail-wm1-x329.google.com with SMTP id y20so2860316wmi.2 for ; Tue, 23 Jun 2020 04:39:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=tymhxqXyDEbTmZSCGO7IT18a7NBET9izMcg9/EiMo9E=; b=t2hG5wLJmwiFTv1+8/9HxuTVTuSw4TFMViTVZsuP3FQ06IV/GQMnfku0xpeQFhKcv3 KePEoPpMx8BXp9LkOnGeGP5tI85KBAFgxTq2uoxg8XHNIOtbFjnzC1/XoIxozuDNb42/ LEWE+DjFh7AlJycaG3rGxG3FRijbCgDck9JInmyfsh+fGs43DhLqwtZZhMFzgJviZgcw 1DuTgaXbnm+LWPI2rEPieTqkbaNIUEi85wVrkvuFvOzGO3bUe9SMnuz+gBjVLree6jHX Sq1SOplAwJl54KBZxkNrZOmeZG5+ahxs+D898RAJWS+lB/JqCfDFebm1hzcH17lmEq1Q uqNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tymhxqXyDEbTmZSCGO7IT18a7NBET9izMcg9/EiMo9E=; b=YjqJgFc6hbwQfB9IDrVAJY7CoacotVmHNUz7VrQIbaAANiS/qqcXtKG2WxzvVPovqQ QZ8sHR3Apa3LTCBc+Hbc+Ij3oT++nYNcIfcJs7NSGlXI/6PeLWrwdM4vlVn+mTT9DZe3 stiLybN613My9tHAePFA8hAhNGkNx8XjxQdV5fv3O9vDZMwq7YmW/muaLaTe7BqxYj3A lRgKg5/dEuO7ndqWA34U0tsDuqV2rjKov52xoKh7DhJKWWPviaAIt/HGD0iNSwo9wkMI mA+eGC/bfK0TsPczW37NBGyVzc9QI6scBR+9xOGfzwOSzPauZgVHgRUvT3UbG4GiQJtw SdjQ== X-Gm-Message-State: AOAM531RqNp2EKtJkRpkDfHVJA/JgT2rg/080ZVcQCJawLhrVK3wraOg EPl160YeaRd3WlSzoUmUB7EvaUUudBDPgw== X-Received: by 2002:a05:600c:410f:: with SMTP id j15mr535731wmi.128.1592912387885; Tue, 23 Jun 2020 04:39:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m10sm4022177wru.4.2020.06.23.04.39.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 04:39:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 36/42] hw/arm/mps2: Add SPI devices Date: Tue, 23 Jun 2020 12:38:58 +0100 Message-Id: <20200623113904.28805-37-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200623113904.28805-1-peter.maydell@linaro.org> References: <20200623113904.28805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" From: Philippe Mathieu-Daudé >From 'Application Note AN385', chapter 3.9, SPI: The SMM implements five PL022 SPI modules. Two pairs of modules share the same OR-gated IRQ. Signed-off-by: Philippe Mathieu-Daudé Message-id: 20200617072539.32686-12-f4bug@amsat.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/mps2.c | 24 ++++++++++++++++++++++++ hw/arm/Kconfig | 6 +++--- 2 files changed, 27 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c index e1061232254..daa26f68d79 100644 --- a/hw/arm/mps2.c +++ b/hw/arm/mps2.c @@ -39,6 +39,7 @@ #include "hw/timer/cmsdk-apb-dualtimer.h" #include "hw/misc/mps2-scc.h" #include "hw/misc/mps2-fpgaio.h" +#include "hw/ssi/pl022.h" #include "hw/net/lan9118.h" #include "net/net.h" #include "hw/watchdog/cmsdk-apb-watchdog.h" @@ -341,6 +342,29 @@ static void mps2_common_init(MachineState *machine) qdev_prop_set_uint32(DEVICE(&mms->fpgaio), "prescale-clk", 25000000); sysbus_realize(SYS_BUS_DEVICE(&mms->fpgaio), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(&mms->fpgaio), 0, 0x40028000); + sysbus_create_simple(TYPE_PL022, 0x40025000, /* External ADC */ + qdev_get_gpio_in(armv7m, 22)); + for (i = 0; i < 2; i++) { + static const int spi_irqno[] = {11, 24}; + static const hwaddr spibase[] = {0x40020000, /* APB */ + 0x40021000, /* LCD */ + 0x40026000, /* Shield0 */ + 0x40027000}; /* Shield1 */ + DeviceState *orgate_dev; + Object *orgate; + int j; + + orgate = object_new(TYPE_OR_IRQ); + object_property_set_int(orgate, 2, "num-lines", &error_fatal); + orgate_dev = DEVICE(orgate); + qdev_realize(orgate_dev, NULL, &error_fatal); + qdev_connect_gpio_out(orgate_dev, 0, + qdev_get_gpio_in(armv7m, spi_irqno[i])); + for (j = 0; j < 2; j++) { + sysbus_create_simple(TYPE_PL022, spibase[2 * i + j], + qdev_get_gpio_in(orgate_dev, j)); + } + } /* In hardware this is a LAN9220; the LAN9118 is software compatible * except that it doesn't support the checksum-offload feature. diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 5c8f689b3dd..90ed584e7ac 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -59,7 +59,7 @@ config HIGHBANK select ARM_TIMER # sp804 select ARM_V7M select PL011 # UART - select PL022 # Serial port + select PL022 # SPI select PL031 # RTC select PL061 # GPIO select PL310 # cache controller @@ -222,7 +222,7 @@ config STELLARIS select CMSDK_APB_WATCHDOG select I2C select PL011 # UART - select PL022 # Serial port + select PL022 # SPI select PL061 # GPIO select SSD0303 # OLED display select SSD0323 # OLED display @@ -401,7 +401,7 @@ config MPS2 select MPS2_FPGAIO select MPS2_SCC select OR_IRQ - select PL022 # Serial port + select PL022 # SPI select PL080 # DMA controller select SPLIT_IRQ select UNIMP