qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Cc: "Edgar E . Iglesias" <edgar.iglesias@xilinx.com>,
	qemu-arm@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
	"Alistair Francis" <alistair@alistair23.me>
Subject: Re: [PATCH] ssi: Display chip select polarity in monitor 'info qtree'
Date: Thu, 15 Oct 2020 20:16:24 +0200	[thread overview]
Message-ID: <d3c12ed9-9a7c-ff67-e8fa-c290ff396726@amsat.org> (raw)
In-Reply-To: <290a4128-dd09-7f05-1f2d-0a0f607de28b@amsat.org>

Cc'ing Markus for "Monitor" tree.

On 10/5/20 9:44 AM, Philippe Mathieu-Daudé wrote:
> Hi Peter,
> 
> Can you take this patch via your qemu-arm tree please?
> (most of SPI boards are ARM based)
> 
> On 9/27/20 11:19 AM, Philippe Mathieu-Daudé wrote:
>> It is sometime useful to verify a device chip select polarity
>> on a SPI bus. Since we have this information available, display
>> it in the 'info qtree' monitor output:
>>
>>    $ qemu-system-arm -M lm3s6965evb -monitor stdio -S
>>    (qemu) info qtree
>>    [...]
>>    dev: pl022, id ""
>>      gpio-out "sysbus-irq" 1
>>      mmio 0000000040008000/0000000000001000
>>      bus: ssi
>>        type SSI
>>        dev: ssd0323, id ""
>>          gpio-in "" 1
>>          gpio-in "ssi-gpio-cs" 1
>>          chip select polarity: high           <---
>>        dev: ssi-sd, id ""
>>          gpio-in "ssi-gpio-cs" 1
>>          chip select polarity: low            <---
>>          bus: sd-bus
>>            type sd-bus
>>            dev: sd-card, id ""
>>              spec_version = 2 (0x2)
>>              drive = "sd0"
>>              spi = true
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>   hw/ssi/ssi.c | 22 ++++++++++++++++++++++
>>   1 file changed, 22 insertions(+)
>>
>> diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c
>> index 4278d0e4440..4c9f8d66d23 100644
>> --- a/hw/ssi/ssi.c
>> +++ b/hw/ssi/ssi.c
>> @@ -17,6 +17,7 @@
>>   #include "migration/vmstate.h"
>>   #include "qemu/module.h"
>>   #include "qapi/error.h"
>> +#include "monitor/monitor.h"
>>   #include "qom/object.h"
>>   
>>   struct SSIBus {
>> @@ -26,10 +27,31 @@ struct SSIBus {
>>   #define TYPE_SSI_BUS "SSI"
>>   OBJECT_DECLARE_SIMPLE_TYPE(SSIBus, SSI_BUS)
>>   
>> +static void ssi_print_dev(Monitor *mon, DeviceState *dev, int indent)
>> +{
>> +    static const char *const polarity_s[] = {
>> +        [SSI_CS_NONE] = "unknown",
>> +        [SSI_CS_LOW]  = "low",
>> +        [SSI_CS_HIGH] = "high"
>> +    };
>> +    SSISlaveClass *ssc = SSI_SLAVE_GET_CLASS(dev);
>> +
>> +    monitor_printf(mon, "%*schip select polarity: %s\n",
>> +                   indent, "", polarity_s[ssc->cs_polarity]);
>> +}
>> +
>> +static void ssi_bus_class_init(ObjectClass *klass, void *data)
>> +{
>> +    BusClass *k = BUS_CLASS(klass);
>> +
>> +    k->print_dev = ssi_print_dev;
>> +}
>> +
>>   static const TypeInfo ssi_bus_info = {
>>       .name = TYPE_SSI_BUS,
>>       .parent = TYPE_BUS,
>>       .instance_size = sizeof(SSIBus),
>> +    .class_init = ssi_bus_class_init,
>>   };
>>   
>>   static void ssi_cs_default(void *opaque, int n, int level)
>>
> 


      reply	other threads:[~2020-10-15 18:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27  9:19 [PATCH] ssi: Display chip select polarity in monitor 'info qtree' Philippe Mathieu-Daudé
2020-09-30 23:53 ` Alistair Francis
2020-10-01  7:21 ` Cédric Le Goater
2020-10-05  7:44 ` Philippe Mathieu-Daudé
2020-10-15 18:16   ` Philippe Mathieu-Daudé [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3c12ed9-9a7c-ff67-e8fa-c290ff396726@amsat.org \
    --to=f4bug@amsat.org \
    --cc=alistair@alistair23.me \
    --cc=armbru@redhat.com \
    --cc=clg@kaod.org \
    --cc=edgar.iglesias@xilinx.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).