From: Rashmica Gupta <rashmica.g@gmail.com>
To: "Joel Stanley" <joel@jms.id.au>, "Cédric Le Goater" <clg@kaod.org>
Cc: Andrew Jeffery <andrew@aj.id.au>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 2/3] hw: aspeed_gpio: Simplify 1.8V defines
Date: Tue, 13 Jul 2021 17:46:02 +1000 [thread overview]
Message-ID: <d788cdcc6e10846ceef50ce65cdd281f5661e01a.camel@gmail.com> (raw)
In-Reply-To: <20210713065854.134634-3-joel@jms.id.au>
On Tue, 2021-07-13 at 16:28 +0930, Joel Stanley wrote:
> There's no need to define the registers relative to the 0x800 offset
> where the controller is mapped, as the device is instantiated as it's
> own model at the correct memory address.
>
> Simplify the defines and remove the offset to save future confusion.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
Makes sense, and it is cleaner.
Reviewed-by: Rashmica Gupta <rashmica.g@gmail.com>
> ---
> hw/gpio/aspeed_gpio.c | 73 +++++++++++++++++++++--------------------
> --
> 1 file changed, 36 insertions(+), 37 deletions(-)
>
> diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c
> index b3dec4448009..dc721aec5da7 100644
> --- a/hw/gpio/aspeed_gpio.c
> +++ b/hw/gpio/aspeed_gpio.c
> @@ -169,44 +169,43 @@
>
> /* AST2600 only - 1.8V gpios */
> /*
> - * The AST2600 has same 3.6V gpios as the AST2400 (memory offsets
> 0x0-0x198)
> - * and additional 1.8V gpios (memory offsets 0x800-0x9D4).
> + * The AST2600 two copies of the GPIO controller: the same 3.6V
> gpios as the
> + * AST2400 (memory offsets 0x0-0x198) and a second controller with
> 1.8V gpios
> + * (memory offsets 0x800-0x9D4).
> */
> -#define GPIO_1_8V_REG_OFFSET 0x800
> -#define GPIO_1_8V_ABCD_DATA_VALUE ((0x800 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_DIRECTION ((0x804 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_INT_ENABLE ((0x808 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_INT_SENS_0 ((0x80C -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_INT_SENS_1 ((0x810 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_INT_SENS_2 ((0x814 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_INT_STATUS ((0x818 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_RESET_TOLERANT ((0x81C -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_DATA_VALUE ((0x820 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_DIRECTION ((0x824 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_INT_ENABLE ((0x828 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_INT_SENS_0 ((0x82C -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_INT_SENS_1 ((0x830 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_INT_SENS_2 ((0x834 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_INT_STATUS ((0x838 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_RESET_TOLERANT ((0x83C -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_DEBOUNCE_1 ((0x840 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_DEBOUNCE_2 ((0x844 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_DEBOUNCE_1 ((0x848 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_DEBOUNCE_2 ((0x84C -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_DEBOUNCE_TIME_1 ((0x850 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_DEBOUNCE_TIME_2 ((0x854 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_DEBOUNCE_TIME_3 ((0x858 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_COMMAND_SRC_0 ((0x860 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_COMMAND_SRC_1 ((0x864 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_COMMAND_SRC_0 ((0x868 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_COMMAND_SRC_1 ((0x86C -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_DATA_READ ((0x8C0 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_DATA_READ ((0x8C4 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_ABCD_INPUT_MASK ((0x9D0 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#define GPIO_1_8V_E_INPUT_MASK ((0x9D4 -
> GPIO_1_8V_REG_OFFSET) >> 2)
> -#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_1_8V_ABCD_DATA_VALUE (0x000 >> 2)
> +#define GPIO_1_8V_ABCD_DIRECTION (0x004 >> 2)
> +#define GPIO_1_8V_ABCD_INT_ENABLE (0x008 >> 2)
> +#define GPIO_1_8V_ABCD_INT_SENS_0 (0x00C >> 2)
> +#define GPIO_1_8V_ABCD_INT_SENS_1 (0x010 >> 2)
> +#define GPIO_1_8V_ABCD_INT_SENS_2 (0x014 >> 2)
> +#define GPIO_1_8V_ABCD_INT_STATUS (0x018 >> 2)
> +#define GPIO_1_8V_ABCD_RESET_TOLERANT (0x01C >> 2)
> +#define GPIO_1_8V_E_DATA_VALUE (0x020 >> 2)
> +#define GPIO_1_8V_E_DIRECTION (0x024 >> 2)
> +#define GPIO_1_8V_E_INT_ENABLE (0x028 >> 2)
> +#define GPIO_1_8V_E_INT_SENS_0 (0x02C >> 2)
> +#define GPIO_1_8V_E_INT_SENS_1 (0x030 >> 2)
> +#define GPIO_1_8V_E_INT_SENS_2 (0x034 >> 2)
> +#define GPIO_1_8V_E_INT_STATUS (0x038 >> 2)
> +#define GPIO_1_8V_E_RESET_TOLERANT (0x03C >> 2)
> +#define GPIO_1_8V_ABCD_DEBOUNCE_1 (0x040 >> 2)
> +#define GPIO_1_8V_ABCD_DEBOUNCE_2 (0x044 >> 2)
> +#define GPIO_1_8V_E_DEBOUNCE_1 (0x048 >> 2)
> +#define GPIO_1_8V_E_DEBOUNCE_2 (0x04C >> 2)
> +#define GPIO_1_8V_DEBOUNCE_TIME_1 (0x050 >> 2)
> +#define GPIO_1_8V_DEBOUNCE_TIME_2 (0x054 >> 2)
> +#define GPIO_1_8V_DEBOUNCE_TIME_3 (0x058 >> 2)
> +#define GPIO_1_8V_ABCD_COMMAND_SRC_0 (0x060 >> 2)
> +#define GPIO_1_8V_ABCD_COMMAND_SRC_1 (0x064 >> 2)
> +#define GPIO_1_8V_E_COMMAND_SRC_0 (0x068 >> 2)
> +#define GPIO_1_8V_E_COMMAND_SRC_1 (0x06C >> 2)
> +#define GPIO_1_8V_ABCD_DATA_READ (0x0C0 >> 2)
> +#define GPIO_1_8V_E_DATA_READ (0x0C4 >> 2)
> +#define GPIO_1_8V_ABCD_INPUT_MASK (0x1D0 >> 2)
> +#define GPIO_1_8V_E_INPUT_MASK (0x1D4 >> 2)
> +#define GPIO_1_8V_MEM_SIZE 0x1D8
> +#define GPIO_1_8V_REG_ARRAY_SIZE (GPIO_1_8V_MEM_SIZE >> 2)
>
> static int aspeed_evaluate_irq(GPIOSets *regs, int gpio_prev_high,
> int gpio)
> {
next prev parent reply other threads:[~2021-07-13 7:47 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 ` [PATCH v2 1/3] hw: aspeed_gpio: Fix memory size Joel Stanley
2021-07-13 7:41 ` 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 [this message]
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=d788cdcc6e10846ceef50ce65cdd281f5661e01a.camel@gmail.com \
--to=rashmica.g@gmail.com \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=joel@jms.id.au \
--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).