[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/23] hw/sd/pl181: Use named GPIOs
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 09/23] hw/sd/pl181: Use named GPIOs |
Date: |
Fri, 21 Aug 2020 19:29:02 +0200 |
To make the code easier to manage/review/use, rename the
cardstatus[0] variable as 'card_readonly' and name the GPIO
"card-read-only".
Similarly with cardstatus[1], renamed as 'card_inserted' and
name its GPIO "card-inserted".
Adapt the users accordingly by using the qdev_init_gpio_out_named()
function.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200705204630.4133-6-f4bug@amsat.org>
---
hw/arm/integratorcp.c | 4 ++--
hw/arm/realview.c | 4 ++--
hw/arm/vexpress.c | 4 ++--
hw/sd/pl181.c | 8 +++++---
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index f304c2b4f03..16c4d750a4f 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -645,9 +645,9 @@ static void integratorcp_init(MachineState *machine)
sysbus_create_simple(TYPE_INTEGRATOR_DEBUG, 0x1a000000, 0);
dev = sysbus_create_varargs("pl181", 0x1c000000, pic[23], pic[24], NULL);
- qdev_connect_gpio_out(dev, 0,
+ qdev_connect_gpio_out_named(dev, "card-read-only", 0,
qdev_get_gpio_in_named(icp, ICP_GPIO_MMC_WPROT, 0));
- qdev_connect_gpio_out(dev, 1,
+ qdev_connect_gpio_out_named(dev, "card-inserted", 0,
qdev_get_gpio_in_named(icp, ICP_GPIO_MMC_CARDIN, 0));
sysbus_create_varargs("pl041", 0x1d000000, pic[25], NULL);
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index c1ff172b136..3e2360c261f 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -234,8 +234,8 @@ static void realview_init(MachineState *machine,
mmc_irq[1] = qemu_irq_split(
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN),
qemu_irq_invert(qdev_get_gpio_in(gpio2, 0)));
- qdev_connect_gpio_out(dev, 0, mmc_irq[0]);
- qdev_connect_gpio_out(dev, 1, mmc_irq[1]);
+ qdev_connect_gpio_out_named(dev, "card-read-only", 0, mmc_irq[0]);
+ qdev_connect_gpio_out_named(dev, "card-inserted", 0, mmc_irq[1]);
sysbus_create_simple("pl031", 0x10017000, pic[10]);
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 1dc971c34f2..049a0ec2c73 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -624,9 +624,9 @@ static void vexpress_common_init(MachineState *machine)
dev = sysbus_create_varargs("pl181", map[VE_MMCI], pic[9], pic[10], NULL);
/* Wire up MMC card detect and read-only signals */
- qdev_connect_gpio_out(dev, 0,
+ qdev_connect_gpio_out_named(dev, "card-read-only", 0,
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT));
- qdev_connect_gpio_out(dev, 1,
+ qdev_connect_gpio_out_named(dev, "card-inserted", 0,
qdev_get_gpio_in(sysctl,
ARM_SYSCTL_GPIO_MMC_CARDIN));
sysbus_create_simple("pl050_keyboard", map[VE_KMI0], pic[12]);
diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c
index 86219c851d3..ab4cd733a4d 100644
--- a/hw/sd/pl181.c
+++ b/hw/sd/pl181.c
@@ -60,7 +60,8 @@ typedef struct PL181State {
uint32_t fifo[PL181_FIFO_LEN]; /* TODO use Fifo32 */
qemu_irq irq[2];
/* GPIO outputs for 'card is readonly' and 'card inserted' */
- qemu_irq cardstatus[2];
+ qemu_irq card_readonly;
+ qemu_irq card_inserted;
} PL181State;
static const VMStateDescription vmstate_pl181 = {
@@ -479,7 +480,7 @@ static void pl181_reset(DeviceState *d)
s->mask[1] = 0;
/* We can assume our GPIO outputs have been wired up now */
- sd_set_cb(s->card, s->cardstatus[0], s->cardstatus[1]);
+ sd_set_cb(s->card, s->card_readonly, s->card_inserted);
/* Since we're still using the legacy SD API the card is not plugged
* into any bus, and we must reset it manually.
*/
@@ -496,7 +497,8 @@ static void pl181_init(Object *obj)
sysbus_init_mmio(sbd, &s->iomem);
sysbus_init_irq(sbd, &s->irq[0]);
sysbus_init_irq(sbd, &s->irq[1]);
- qdev_init_gpio_out(dev, s->cardstatus, 2);
+ qdev_init_gpio_out_named(dev, &s->card_readonly, "card-read-only", 1);
+ qdev_init_gpio_out_named(dev, &s->card_inserted, "card-inserted", 1);
}
static void pl181_realize(DeviceState *dev, Error **errp)
--
2.26.2
- [PULL 00/23] SD/MMC patches for 2020-08-21, Philippe Mathieu-Daudé, 2020/08/21
- [PULL 01/23] hw/sd/pxa2xx_mmci: Do not create SD card within the SD host controller, Philippe Mathieu-Daudé, 2020/08/21
- [PULL 02/23] hw/sd/pxa2xx_mmci: Trivial simplification, Philippe Mathieu-Daudé, 2020/08/21
- [PULL 03/23] hw/lm32/milkymist: Un-inline milkymist_memcard_create(), Philippe Mathieu-Daudé, 2020/08/21
- [PULL 04/23] hw/sd/milkymist: Create the SDBus at init(), Philippe Mathieu-Daudé, 2020/08/21
- [PULL 05/23] hw/sd/milkymist: Do not create SD card within the SD host controller, Philippe Mathieu-Daudé, 2020/08/21
- [PULL 06/23] hw/sd/pl181: Replace fprintf(stderr, "*\n") with error_report(), Philippe Mathieu-Daudé, 2020/08/21
- [PULL 07/23] hw/sd/pl181: Rename pl181_send_command() as pl181_do_command(), Philippe Mathieu-Daudé, 2020/08/21
- [PULL 08/23] hw/sd/pl181: Add TODO to use Fifo32 API, Philippe Mathieu-Daudé, 2020/08/21
- [PULL 09/23] hw/sd/pl181: Use named GPIOs,
Philippe Mathieu-Daudé <=
- [PULL 11/23] hw/sd/pl181: Do not create SD card within the SD host controller, Philippe Mathieu-Daudé, 2020/08/21
- [PULL 10/23] hw/sd/pl181: Expose a SDBus and connect the SDCard to it, Philippe Mathieu-Daudé, 2020/08/21
- [PULL 12/23] hw/sd/pl181: Replace disabled fprintf()s by trace events, Philippe Mathieu-Daudé, 2020/08/21
- [PULL 13/23] hw/sd/sdcard: Make sd_data_ready() static, Philippe Mathieu-Daudé, 2020/08/21
- [PULL 14/23] hw/sd: Move sdcard legacy API to 'hw/sd/sdcard_legacy.h', Philippe Mathieu-Daudé, 2020/08/21
- [PULL 15/23] hw/sd: Rename read/write_data() as read/write_byte(), Philippe Mathieu-Daudé, 2020/08/21
- [PULL 16/23] hw/sd: Rename sdbus_write_data() as sdbus_write_byte(), Philippe Mathieu-Daudé, 2020/08/21
- [PULL 17/23] hw/sd: Rename sdbus_read_data() as sdbus_read_byte(), Philippe Mathieu-Daudé, 2020/08/21
- [PULL 20/23] hw/sd: Add sdbus_read_data() to read multiples bytes on the data line, Philippe Mathieu-Daudé, 2020/08/21
- [PULL 19/23] hw/sd: Use sdbus_write_data() instead of sdbus_write_byte when possible, Philippe Mathieu-Daudé, 2020/08/21