From: Joel Stanley <joel@jms.id.au>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: Andrew Jeffery <andrew@aj.id.au>,
Rashmica Gupta <rashmica.g@gmail.com>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH v2 1/3] hw: aspeed_gpio: Fix memory size
Date: Tue, 13 Jul 2021 16:28:52 +0930 [thread overview]
Message-ID: <20210713065854.134634-2-joel@jms.id.au> (raw)
In-Reply-To: <20210713065854.134634-1-joel@jms.id.au>
The macro used to calculate the maximum memory size of the MMIO region
had a mistake, causing all GPIO models to create a mapping of 0x9D8.
The intent was to have it be 0x9D8 - 0x800.
This extra size doesn't matter on ast2400 and ast2500, which have a 4KB
region set aside for the GPIO controller.
On the ast2600 the 3.3V and 1.8V GPIO controllers are 2KB apart, so the
regions would overlap. Worse was the 1.8V controller would map over the
top of the following perianal, which happens to be the RTC.
The mmio region used by each device is a maximum of 2KB, so avoid the
calculations and hard code this as the maximum.
Fixes: 36d737ee82b2 ("hw/gpio: Add in AST2600 specific implementation")
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
hw/gpio/aspeed_gpio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c
index 6ae0116be70b..b3dec4448009 100644
--- a/hw/gpio/aspeed_gpio.c
+++ b/hw/gpio/aspeed_gpio.c
@@ -207,7 +207,6 @@
#define GPIO_1_8V_MEM_SIZE 0x9D8
#define GPIO_1_8V_REG_ARRAY_SIZE ((GPIO_1_8V_MEM_SIZE - \
GPIO_1_8V_REG_OFFSET) >> 2)
-#define GPIO_MAX_MEM_SIZE MAX(GPIO_3_6V_MEM_SIZE, GPIO_1_8V_MEM_SIZE)
static int aspeed_evaluate_irq(GPIOSets *regs, int gpio_prev_high, int gpio)
{
@@ -849,7 +848,7 @@ static void aspeed_gpio_realize(DeviceState *dev, Error **errp)
}
memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_gpio_ops, s,
- TYPE_ASPEED_GPIO, GPIO_MAX_MEM_SIZE);
+ TYPE_ASPEED_GPIO, 0x800);
sysbus_init_mmio(sbd, &s->iomem);
}
--
2.32.0
next prev parent reply other threads:[~2021-07-13 7:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-13 6:58 [PATCH v2 0/3] hw: aspeed_gpio: MMIO region fix and cleanups Joel Stanley
2021-07-13 6:58 ` Joel Stanley [this message]
2021-07-13 7:41 ` [PATCH v2 1/3] hw: aspeed_gpio: Fix memory size Rashmica Gupta
2021-07-19 16:02 ` [SPAM] " Cédric Le Goater
2021-07-27 8:02 ` Joel Stanley
2021-07-27 9:58 ` Peter Maydell
2021-07-13 6:58 ` [PATCH v2 2/3] hw: aspeed_gpio: Simplify 1.8V defines Joel Stanley
2021-07-13 7:46 ` Rashmica Gupta
2021-07-19 16:02 ` [SPAM] " Cédric Le Goater
2021-07-19 22:05 ` Philippe Mathieu-Daudé
2021-07-13 6:58 ` [PATCH v2 3/3] hw: aspeed_gpio: Clarify GPIO controller name Joel Stanley
2021-07-13 7:48 ` Rashmica Gupta
2021-07-19 16:02 ` [SPAM] " Cédric Le Goater
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=20210713065854.134634-2-joel@jms.id.au \
--to=joel@jms.id.au \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rashmica.g@gmail.com \
/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).