* [PATCH] ssi: Display chip select polarity in monitor 'info qtree'
@ 2020-09-27 9:19 Philippe Mathieu-Daudé
2020-09-30 23:53 ` Alistair Francis
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-27 9:19 UTC (permalink / raw)
To: qemu-devel
Cc: Edgar E . Iglesias, qemu-arm, Cédric Le Goater,
Alistair Francis, Philippe Mathieu-Daudé
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)
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ssi: Display chip select polarity in monitor 'info qtree'
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é
2 siblings, 0 replies; 5+ messages in thread
From: Alistair Francis @ 2020-09-30 23:53 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Edgar E . Iglesias, qemu-arm, qemu-devel@nongnu.org Developers,
Alistair Francis, Cédric Le Goater
On Sun, Sep 27, 2020 at 2:20 AM Philippe Mathieu-Daudé <f4bug@amsat.org> 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>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> 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)
> --
> 2.26.2
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ssi: Display chip select polarity in monitor 'info qtree'
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é
2 siblings, 0 replies; 5+ messages in thread
From: Cédric Le Goater @ 2020-10-01 7:21 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Edgar E . Iglesias, qemu-arm, Alistair Francis
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>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Cédric Le Goater <clg@kaod.org>
Thanks,
C.
dev: aspeed.spi2-ast2600, id ""
gpio-out "sysbus-irq" 2
num-cs = 1 (0x1)
inject-failure = false
sdram-base = 0 (0x0)
mmio 000000001e641000/0000000000000100
mmio 0000000050000000/0000000010000000
bus: spi
type SSI
dev: aspeed.spi1-ast2600, id ""
gpio-out "sysbus-irq" 2
num-cs = 1 (0x1)
inject-failure = false
sdram-base = 0 (0x0)
mmio 000000001e630000/0000000000000100
mmio 0000000030000000/0000000010000000
bus: spi
type SSI
dev: mx66l1g45g, id ""
gpio-in "ssi-gpio-cs" 1
nonvolatile-cfg = 36863 (0x8fff)
spansion-cr1nv = 0 (0x0)
spansion-cr2nv = 8 (0x8)
spansion-cr3nv = 2 (0x2)
spansion-cr4nv = 16 (0x10)
drive = "mtd2"
chip select polarity: low
dev: aspeed.fmc-ast2600, id ""
gpio-out "sysbus-irq" 3
num-cs = 2 (0x2)
inject-failure = false
sdram-base = 2147483648 (0x80000000)
mmio 000000001e620000/0000000000000100
mmio 0000000020000000/0000000010000000
bus: spi
type SSI
dev: mx66l1g45g, id ""
gpio-in "ssi-gpio-cs" 1
nonvolatile-cfg = 36863 (0x8fff)
spansion-cr1nv = 0 (0x0)
spansion-cr2nv = 8 (0x8)
spansion-cr3nv = 2 (0x2)
spansion-cr4nv = 16 (0x10)
drive = "mtd1"
chip select polarity: low
dev: mx66l1g45g, id ""
gpio-in "ssi-gpio-cs" 1
nonvolatile-cfg = 36863 (0x8fff)
spansion-cr1nv = 0 (0x0)
spansion-cr2nv = 8 (0x8)
spansion-cr3nv = 2 (0x2)
spansion-cr4nv = 16 (0x10)
drive = "mtd0"
chip select polarity: low
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ssi: Display chip select polarity in monitor 'info qtree'
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é
2 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-05 7:44 UTC (permalink / raw)
To: qemu-devel
Cc: Edgar E . Iglesias, qemu-arm, Cédric Le Goater, Alistair Francis
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)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ssi: Display chip select polarity in monitor 'info qtree'
2020-10-05 7:44 ` Philippe Mathieu-Daudé
@ 2020-10-15 18:16 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-15 18:16 UTC (permalink / raw)
To: qemu-devel, Markus Armbruster
Cc: Edgar E . Iglesias, qemu-arm, Cédric Le Goater, Alistair Francis
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)
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-15 18:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.