From: Tom <Tom.Rix@windriver.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/8] nomadik_gpio: get base address from platform code
Date: Sun, 28 Mar 2010 12:35:14 -0500 [thread overview]
Message-ID: <4BAF9352.6000407@windriver.com> (raw)
In-Reply-To: <1268888542-29586-1-git-send-email-rabin.vincent@stericsson.com>
Rabin Vincent wrote:
> Change the Nomadik GPIO driver to get the base addresses from platform
> specific code, since it will be used on multiple platforms with
> different base addresses.
>
> Acked-by: Alessandro Rubini <rubini@unipv.it>
> Acked-by: Michael Brandt <michael.brandt@stericsson.com>
> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
> ---
> board/st/nhk8815/nhk8815.c | 7 +++++++
> drivers/gpio/nomadik_gpio.c | 9 +--------
> include/nomadik_gpio.h | 2 ++
> 3 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/board/st/nhk8815/nhk8815.c b/board/st/nhk8815/nhk8815.c
> index 4f5f94f..79c91a7 100644
> --- a/board/st/nhk8815/nhk8815.c
> +++ b/board/st/nhk8815/nhk8815.c
> @@ -32,6 +32,13 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> +unsigned long nmk_gpio_base[] = {
> + NOMADIK_GPIO0_BASE,
> + NOMADIK_GPIO1_BASE,
> + NOMADIK_GPIO2_BASE,
> + NOMADIK_GPIO3_BASE
> +};
> +
Should added #if-def CONFIG_NOMADIK_GPIO, to not include this global if
it is not used.
> #ifdef CONFIG_SHOW_BOOT_PROGRESS
> void show_boot_progress(int progress)
> {
> diff --git a/drivers/gpio/nomadik_gpio.c b/drivers/gpio/nomadik_gpio.c
> index e8a7bca..deb2beb 100644
> --- a/drivers/gpio/nomadik_gpio.c
> +++ b/drivers/gpio/nomadik_gpio.c
> @@ -24,13 +24,6 @@
> #include <asm/io.h>
> #include <nomadik_gpio.h>
>
> -static unsigned long gpio_base[4] = {
> - NOMADIK_GPIO0_BASE,
> - NOMADIK_GPIO1_BASE,
> - NOMADIK_GPIO2_BASE,
> - NOMADIK_GPIO3_BASE
> -};
> -
> enum gpio_registers {
> GPIO_DAT = 0x00, /* data register */
> GPIO_DATS = 0x04, /* data set */
> @@ -45,7 +38,7 @@ enum gpio_registers {
>
> static inline unsigned long gpio_to_base(int gpio)
> {
> - return gpio_base[gpio / 32];
> + return nmk_gpio_base[gpio / 32];
Should a check on the input.
(gpio / 32) < NMK_GPIO_BASE_INDEX_MAX
Add
#define NMK_GPIO_BASE_INDEX_MAX 4
Different values per board
Ok to change the name NMK_GPIO_BASE_INDEX_MAX
to something you like.
> }
>
> static inline u32 gpio_to_bit(int gpio)
> diff --git a/include/nomadik_gpio.h b/include/nomadik_gpio.h
> index 1d3c9ce..2822db4 100644
> --- a/include/nomadik_gpio.h
> +++ b/include/nomadik_gpio.h
> @@ -34,6 +34,8 @@ enum nmk_af { /* alternate function settings */
> GPIO_ALT_C
> };
>
> +extern unsigned long nmk_gpio_base[];
> +
> extern void nmk_gpio_af(int gpio, int alternate_function);
> extern void nmk_gpio_dir(int gpio, int dir);
> extern void nmk_gpio_set(int gpio, int val);
Tom
next prev parent reply other threads:[~2010-03-28 17:35 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-18 4:20 [U-Boot] [PATCH 0/8] ST-Ericsson Ux500 support Rabin Vincent
2010-03-18 4:20 ` [U-Boot] [PATCH 1/8] Nomadik: move timer code to drivers/misc Rabin Vincent
2010-03-28 17:30 ` Tom
2010-04-06 11:16 ` Rabin VINCENT
2010-04-06 11:30 ` Alessandro Rubini
2010-03-18 4:28 ` [U-Boot] [PATCH 2/8] Nomadik: move gpio driver to drivers/gpio Rabin Vincent
2010-03-28 17:32 ` Tom
2010-04-06 11:25 ` Rabin VINCENT
2010-03-18 5:02 ` [U-Boot] [PATCH 3/8] nomadik_gpio: get base address from platform code Rabin Vincent
2010-03-28 17:35 ` Tom [this message]
2010-03-18 5:08 ` [U-Boot] [PATCH 4/8] nomadik_mtu: support configurable clock rates Rabin Vincent
2010-03-28 17:36 ` Tom
2010-03-18 5:10 ` [U-Boot] [PATCH 5/8] ARM Cortex A8: ifdef code calling lowlevel init Rabin Vincent
2010-03-28 17:38 ` Tom
2010-03-18 5:10 ` [U-Boot] [PATCH 6/8] ux500: add SoC-specific code Rabin Vincent
2010-03-28 17:42 ` Tom
2010-04-07 6:15 ` Rabin VINCENT
2010-03-18 5:10 ` [U-Boot] [PATCH 7/8] pl01x: add support for Ux500 variant of pl011 Rabin Vincent
2010-03-28 17:45 ` Tom
2010-03-18 5:33 ` [U-Boot] [PATCH 8/8] mop500: add board-specific files Rabin Vincent
2010-03-28 17:49 ` Tom
2010-04-08 13:41 ` Rabin VINCENT
2010-04-09 22:28 ` Wolfgang Denk
2010-04-17 21:46 ` Tom Rix
2010-03-21 19:42 ` [U-Boot] [PATCH 0/8] ST-Ericsson Ux500 support Wolfgang Denk
2010-03-28 17:27 ` Tom
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=4BAF9352.6000407@windriver.com \
--to=tom.rix@windriver.com \
--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