From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/6] dm: gpio: hi6220: Add a hi6220 GPIO driver model driver.
Date: Tue, 12 May 2015 20:36:30 +0200 [thread overview]
Message-ID: <201505122036.30435.marex@denx.de> (raw)
In-Reply-To: <1431437912-18988-3-git-send-email-peter.griffin@linaro.org>
On Tuesday, May 12, 2015 at 03:38:28 PM, Peter Griffin wrote:
Hi!
> This patch adds support for the GPIO perif found on hi6220
> SoC.
>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> arch/arm/include/asm/arch-armv8/gpio.h | 47 +++++++++++++++++
> drivers/gpio/Makefile | 2 +
> drivers/gpio/hi6220_gpio.c | 95
> ++++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+)
> create mode 100644 arch/arm/include/asm/arch-armv8/gpio.h
> create mode 100644 drivers/gpio/hi6220_gpio.c
>
> diff --git a/arch/arm/include/asm/arch-armv8/gpio.h
> b/arch/arm/include/asm/arch-armv8/gpio.h new file mode 100644
> index 0000000..162c2d9
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-armv8/gpio.h
> @@ -0,0 +1,47 @@
> +/*
> + * Copyright (C) 2015 Linaro
> + * Peter Griffin <peter.griffin@linaro.org>
> + *
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#ifndef _HI6220_GPIO_H_
> +#define _HI6220_GPIO_H_
> +
> +#define HI6220_GPIO0_BASE (void *)0xf8011000
You should drop the explicit cast, that's nasty.
Also, why don't you define this as a HI6220_GPIO_BASE(bank) instead?
That'd trim down the number of macros and from what I see, it should
be rather easy to do ...
#define HI6220_GPIO_BASE(bank)
(((bank < 4) ? 0xf8012000 : (0xf7020000 - 0x4000)) + (0x1000 * bank))
> +#define HI6220_GPIO1_BASE (void *)0xf8012000
> +#define HI6220_GPIO2_BASE (void *)0xf8013000
> +#define HI6220_GPIO3_BASE (void *)0xf8014000
> +#define HI6220_GPIO4_BASE (void *)0xf7020000
> +#define HI6220_GPIO5_BASE (void *)0xf7021000
> +#define HI6220_GPIO6_BASE (void *)0xf7022000
> +#define HI6220_GPIO7_BASE (void *)0xf7023000
> +#define HI6220_GPIO8_BASE (void *)0xf7024000
> +#define HI6220_GPIO9_BASE (void *)0xf7025000
> +#define HI6220_GPIO10_BASE (void *)0xf7026000
> +#define HI6220_GPIO11_BASE (void *)0xf7027000
> +#define HI6220_GPIO12_BASE (void *)0xf7028000
> +#define HI6220_GPIO13_BASE (void *)0xf7029000
> +#define HI6220_GPIO14_BASE (void *)0xf702a000
> +#define HI6220_GPIO15_BASE (void *)0xf702b000
> +#define HI6220_GPIO16_BASE (void *)0xf702c000
> +#define HI6220_GPIO17_BASE (void *)0xf702d000
> +#define HI6220_GPIO18_BASE (void *)0xf702e000
> +#define HI6220_GPIO19_BASE (void *)0xf702f000
But are these even used in the driver anywhere ?
> +#define BIT(x) (1 << (x))
This macro should be placed into common header files.
> +#define HI6220_GPIO_PER_BANK 8
> +#define HI6220_GPIO_DIR 0x400
> +
> +struct gpio_bank {
> + u8 *base; /* address of registers in physical memory */
Should be void __iomem *, no ?
> +};
> +
> +/* Information about a GPIO bank */
> +struct hikey_gpio_platdata {
> + int bank_index;
> + void *base; /* address of registers in physical memory */
> +};
> +
> +#endif /* _HI6220_GPIO_H_ */
[...]
next prev parent reply other threads:[~2015-05-12 18:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1431437912-18988-1-git-send-email-peter.griffin@linaro.org>
[not found] ` <1431437912-18988-2-git-send-email-peter.griffin@linaro.org>
2015-05-12 18:30 ` [U-Boot] [PATCH 1/6] usb: dwc2: Add support for v3 snpsid value Marek Vasut
2015-05-13 11:00 ` Peter Griffin
2015-05-13 20:05 ` Marek Vasut
[not found] ` <1431437912-18988-3-git-send-email-peter.griffin@linaro.org>
2015-05-12 18:36 ` Marek Vasut [this message]
2015-05-12 19:08 ` [U-Boot] [PATCH 2/6] dm: gpio: hi6220: Add a hi6220 GPIO driver model driver Tom Rini
2015-05-13 12:00 ` Peter Griffin
2015-05-13 20:01 ` Marek Vasut
[not found] ` <1431437912-18988-6-git-send-email-peter.griffin@linaro.org>
2015-05-12 18:39 ` [U-Boot] [PATCH 5/6] mmc: hi6220_dw_mmc: Add hi6220 glue code for dw_mmc controller Marek Vasut
2015-05-13 12:10 ` Peter Griffin
2015-05-12 13:25 [U-Boot] [PATCH 0/6] Add support for hi6220 SoC and HiKey 96boards CE board Peter Griffin
2015-05-12 13:25 ` [U-Boot] [PATCH 2/6] dm: gpio: hi6220: Add a hi6220 GPIO driver model driver Peter Griffin
2015-07-03 23:06 ` Simon Glass
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=201505122036.30435.marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/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