[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 36/42] hw/arm/mps2: Add SPI devices
From: |
Peter Maydell |
Subject: |
[PULL 36/42] hw/arm/mps2: Add SPI devices |
Date: |
Tue, 23 Jun 2020 12:38:58 +0100 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>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é <f4bug@amsat.org>
Message-id: 20200617072539.32686-12-f4bug@amsat.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/mps2.c | 24 ++++++++++++++++++++++++
hw/arm/Kconfig | 6 +++---
2 files changed, 27 insertions(+), 3 deletions(-)
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
--
2.20.1
- [PULL 24/42] target/arm: Remove unnecessary gen_io_end() calls, (continued)
- [PULL 24/42] target/arm: Remove unnecessary gen_io_end() calls, Peter Maydell, 2020/06/23
- [PULL 22/42] target/arm: Convert Neon VTRN to decodetree, Peter Maydell, 2020/06/23
- [PULL 25/42] target/arm: Remove dead code relating to SABA and UABA, Peter Maydell, 2020/06/23
- [PULL 26/42] hw/watchdog/cmsdk-apb-watchdog: Add trace event for lock status, Peter Maydell, 2020/06/23
- [PULL 28/42] hw/i2c/versatile_i2c: Add SCL/SDA definitions, Peter Maydell, 2020/06/23
- [PULL 27/42] hw/i2c/versatile_i2c: Add definitions for register addresses, Peter Maydell, 2020/06/23
- [PULL 30/42] hw/arm: Use TYPE_VERSATILE_I2C instead of hardcoded string, Peter Maydell, 2020/06/23
- [PULL 29/42] hw/i2c: Add header for ARM SBCon two-wire serial bus interface, Peter Maydell, 2020/06/23
- [PULL 31/42] hw/arm/mps2: Document CMSDK/FPGA APB subsystem sections, Peter Maydell, 2020/06/23
- [PULL 34/42] hw/arm/mps2: Add CMSDK AHB GPIO peripherals as unimplemented devices, Peter Maydell, 2020/06/23
- [PULL 36/42] hw/arm/mps2: Add SPI devices,
Peter Maydell <=
- [PULL 37/42] hw/arm/mps2: Add I2C devices, Peter Maydell, 2020/06/23
- [PULL 32/42] hw/arm/mps2: Rename CMSDK AHB peripheral region, Peter Maydell, 2020/06/23
- [PULL 38/42] hw/arm/mps2: Add audio I2S interface as unimplemented device, Peter Maydell, 2020/06/23
- [PULL 39/42] hw/arm/mps2-tz: Use the ARM SBCon two-wire serial bus interface, Peter Maydell, 2020/06/23
- [PULL 41/42] tests/qtest/arm-cpu-features: Add feature setting tests, Peter Maydell, 2020/06/23
- [PULL 40/42] target/arm: Check supported KVM features globally (not per vCPU), Peter Maydell, 2020/06/23
- [PULL 35/42] hw/arm/mps2: Map the FPGA I/O block, Peter Maydell, 2020/06/23
- [PULL 42/42] arm/virt: Add memory hot remove support, Peter Maydell, 2020/06/23
- [PULL 33/42] hw/arm/mps2: Add CMSDK APB watchdog device, Peter Maydell, 2020/06/23
- Re: [PULL 00/42] target-arm queue, no-reply, 2020/06/23