From nobody Tue Feb 10 20:48:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.44 as permitted sender) client-ip=209.85.221.44; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f44.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.44 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1599771280; cv=none; d=zohomail.com; s=zohoarc; b=R0uuP+y3w/DFeSpofEXmLaDTeoGjRAgZ9H3ReS4Ia2MRC51vBrxQKj3psoyFdU50zvyZCZ35pY8Nwecr7WnsYsdcGljA6vzx8ZoVgLrQIthEooBcYo3sxeObFNSFAobFTJerAr0cAs/A/KWKKjkjmoSLONmsnFWcAhWrDKVVr7I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599771280; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vnMbp0E6IauzdwSblFJxUFoyT1SAl8asRcn4brlYdgU=; b=KrEbRx993A8qlBylbU/Pp4CYKU/zOPZf5n9gIqOjOHyTX+Oqe7psbLly3a8Uet1/fe3Sbz386GbbLpfRhBchDyg3UJgfV+38ILlRlSz3Q33ZDjj9yrlrnHVK1zyeLrexKo7mMX2PA5zfTG74FJWqKoKBP69rjo1Wv+scegsI0og= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.44 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mx.zohomail.com with SMTPS id 1599771280005425.4197405221897; Thu, 10 Sep 2020 13:54:40 -0700 (PDT) Received: by mail-wr1-f44.google.com with SMTP id g4so8652380wrs.5 for ; Thu, 10 Sep 2020 13:54:39 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id t1sm5089317wmi.16.2020.09.10.13.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 13:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vnMbp0E6IauzdwSblFJxUFoyT1SAl8asRcn4brlYdgU=; b=XV/kzY7Rl5zm+9oYL6HBoDbfOFK8NMcdGh4lEQSoNJ2nc/om3QgskwbeKSCivkQ5V/ GlbhDfh3bm4wDe2y/0L+bxwg1UXcTW6zuzOMnsMRKkqPEy2f8b5pkymq4BMlGXeGTEUO MhftaWIPF9kfezdWA5biVEyHUOw2demUTgXQWxzWR1d3SH6a6UMCnUozVt8K6vzwE+ec 2eENy/AkaNNpxvuWoLN+Cpk2sWBh0L12vRFryRh0OHxCH7pCGQb9Dg/BY3UxVF2Rz+Y9 ZzNP1GXUiNWbnjh9g8IwhvBlvarlEXGn9/lzvlGIU5ds3fZgix6JnSMukccCPakV/34T LvCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=vnMbp0E6IauzdwSblFJxUFoyT1SAl8asRcn4brlYdgU=; b=EeuEh0LbeNOCWxacHZHNbbw6YoF7d6sBLJWirQ3DwHXnQ2facyZcwU1giLxYQVQbqZ /a7onuYOOwaJQZXSiS412yf5Wa728MjPfrY3Dtp+Nw4HJsEt1Qkv73ZbRTpoj0xOtqU8 0mFb7Zxch5oRxXUq2BE3ikgmUg/0URPkZbjXW+p5EPwdas0S37677z9+D5RwnmBsKP9v j7G1QCedwpw8MQV+lBLqNrIsz4Jsu+jQv4/BCi4CYjz372g3aOQ/7n0wUQzPKJFz1hEa 7UW7Gsk4MtmySQuwWnCcbA/HD21zS9WLYXMLmowZ/UggfW69sNJrLlyYllYI8JSFLRhg V65g== X-Gm-Message-State: AOAM532KxOE4egTFMnshU0ygMyeg9/k8/X+JMIMqt3oBSJnDFjDG+uhw huAaRIKdBDIzax1k6oR+IIs= X-Google-Smtp-Source: ABdhPJyIXE/lNORdgK9VDBE4yzTW77L8ihNEThRs6429JUOKxxEr6ywM216QfBQjM8MrgEYGDuxOVg== X-Received: by 2002:adf:f58b:: with SMTP id f11mr10910155wro.250.1599771278004; Thu, 10 Sep 2020 13:54:38 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Paolo Bonzini , Luc Michel , Andrzej Zaborowski , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Joel Stanley , Peter Maydell , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Jeffery , qemu-arm@nongnu.org Subject: [PATCH v5 5/7] hw/misc/mps2-fpgaio: Use the LED device Date: Thu, 10 Sep 2020 22:54:27 +0200 Message-Id: <20200910205429.727766-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200910205429.727766-1-f4bug@amsat.org> References: <20200910205429.727766-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Per the 'ARM MPS2 and MPS2+ FPGA Prototyping Boards Technical Reference Manual' (100112_0200_07_en): 2.1 Overview of the MPS2 and MPS2+ hardware The MPS2 and MPS2+ FPGA Prototyping Boards contain the following components and interfaces: * User switches and user LEDs: - Two green LEDs and two push buttons that connect to the FPGA. - Eight green LEDs and one 8-way dip switch that connect to the MCC. Add the 2 LEDs connected to the FPGA. This remplaces the 'mps2_fpgaio_leds' trace events by the generic 'led_set_intensity' event. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/misc/mps2-fpgaio.h | 2 ++ hw/misc/mps2-fpgaio.c | 19 ++++++++++++++----- hw/misc/Kconfig | 1 + hw/misc/trace-events | 1 - 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/include/hw/misc/mps2-fpgaio.h b/include/hw/misc/mps2-fpgaio.h index 69e265cd4b2..901880cc3a7 100644 --- a/include/hw/misc/mps2-fpgaio.h +++ b/include/hw/misc/mps2-fpgaio.h @@ -22,6 +22,7 @@ #define MPS2_FPGAIO_H =20 #include "hw/sysbus.h" +#include "hw/misc/led.h" =20 #define TYPE_MPS2_FPGAIO "mps2-fpgaio" #define MPS2_FPGAIO(obj) OBJECT_CHECK(MPS2FPGAIO, (obj), TYPE_MPS2_FPGAIO) @@ -32,6 +33,7 @@ typedef struct { =20 /*< public >*/ MemoryRegion iomem; + LEDState *led[2]; =20 uint32_t led0; uint32_t prescale; diff --git a/hw/misc/mps2-fpgaio.c b/hw/misc/mps2-fpgaio.c index 2f3fbeef348..86ca78eb235 100644 --- a/hw/misc/mps2-fpgaio.c +++ b/hw/misc/mps2-fpgaio.c @@ -24,6 +24,7 @@ #include "migration/vmstate.h" #include "hw/registerfields.h" #include "hw/misc/mps2-fpgaio.h" +#include "hw/misc/led.h" #include "hw/qdev-properties.h" #include "qemu/timer.h" =20 @@ -176,12 +177,9 @@ static void mps2_fpgaio_write(void *opaque, hwaddr off= set, uint64_t value, =20 switch (offset) { case A_LED0: - /* LED bits [1:0] control board LEDs. We don't currently have - * a mechanism for displaying this graphically, so use a trace eve= nt. - */ - trace_mps2_fpgaio_leds(value & 0x02 ? '*' : '.', - value & 0x01 ? '*' : '.'); s->led0 =3D value & 0x3; + led_set_state(s->led[0], value & 0x01); + led_set_state(s->led[1], value & 0x02); break; case A_PRESCALE: resync_counter(s); @@ -251,6 +249,16 @@ static void mps2_fpgaio_init(Object *obj) sysbus_init_mmio(sbd, &s->iomem); } =20 +static void mps2_fpgaio_realize(DeviceState *dev, Error **errp) +{ + MPS2FPGAIO *s =3D MPS2_FPGAIO(dev); + + s->led[0] =3D led_create_simple(OBJECT(dev), GPIO_POLARITY_ACTIVE_HIGH, + LED_COLOR_GREEN, "USERLED0"); + s->led[1] =3D led_create_simple(OBJECT(dev), GPIO_POLARITY_ACTIVE_HIGH, + LED_COLOR_GREEN, "USERLED1"); +} + static bool mps2_fpgaio_counters_needed(void *opaque) { /* Currently vmstate.c insists all subsections have a 'needed' functio= n */ @@ -299,6 +307,7 @@ static void mps2_fpgaio_class_init(ObjectClass *klass, = void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->vmsd =3D &mps2_fpgaio_vmstate; + dc->realize =3D mps2_fpgaio_realize; dc->reset =3D mps2_fpgaio_reset; device_class_set_props(dc, mps2_fpgaio_properties); } diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig index 5c151fa3a83..0cecad45aad 100644 --- a/hw/misc/Kconfig +++ b/hw/misc/Kconfig @@ -93,6 +93,7 @@ config MIPS_ITU =20 config MPS2_FPGAIO bool + select LED =20 config MPS2_SCC bool diff --git a/hw/misc/trace-events b/hw/misc/trace-events index 89d15f05f9a..43b9e0cf250 100644 --- a/hw/misc/trace-events +++ b/hw/misc/trace-events @@ -93,7 +93,6 @@ mps2_scc_cfg_read(unsigned function, unsigned device, uin= t32_t value) "MPS2 SCC mps2_fpgaio_read(uint64_t offset, uint64_t data, unsigned size) "MPS2 FPGA= IO read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" mps2_fpgaio_write(uint64_t offset, uint64_t data, unsigned size) "MPS2 FPG= AIO write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" mps2_fpgaio_reset(void) "MPS2 FPGAIO: reset" -mps2_fpgaio_leds(char led1, char led0) "MPS2 FPGAIO LEDs: %c%c" =20 # msf2-sysreg.c msf2_sysreg_write(uint64_t offset, uint32_t val, uint32_t prev) "msf2-sysr= eg write: addr 0x%08" PRIx64 " data 0x%" PRIx32 " prev 0x%" PRIx32 --=20 2.26.2