From: Lubomir Popov <lpopov@mm-sol.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] gpio: omap_gpio: Fix valid gpio range for AM33XX
Date: Fri, 21 Jun 2013 09:59:24 +0300 [thread overview]
Message-ID: <51C3F9CC.2040509@mm-sol.com> (raw)
In-Reply-To: <1371784037.19200.1.camel@phoenix>
Hi Axel,
On 21/06/13 06:07, Axel Lin wrote:
> AM33XX has 4 gpio banks, thus the valid gpio range should be 0 ... 127.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> v2: define OMAP_MAX_GPIO and use it.
> This change is mainly based on Stefan's comment, however I use
> OMAP_MAX_GPIO instead of CONFIG_OMAP_MAX_GPIO because having CONFIG_ prefix
> seems meaning it can be configurable in configs.
>
> drivers/gpio/omap_gpio.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
> index a30d7f0..6fa57c9 100644
> --- a/drivers/gpio/omap_gpio.c
> +++ b/drivers/gpio/omap_gpio.c
> @@ -40,6 +40,12 @@
> #include <asm/io.h>
> #include <asm/errno.h>
>
> +#if defined(CONFIG_AM33XX)
> +#define OMAP_MAX_GPIO 128
> +#else
> +#define OMAP_MAX_GPIO 192
> +#endif
Please be aware that OMAP54XX and DRA7XX SoCs have 8 banks per 32 GPIOs,
that is, 256 in total. The DRA7xx config defines CONFIG_DRA7XX, but also
includes omap5_common.h, where CONFIG_OMAP54XX is defined (due to sharing
of many internal IPs with the OMAP5, including GPIO). The above definitions
should be changed to something like:
#if defined(CONFIG_OMAP54XX)
#define OMAP_MAX_GPIO 256 /* OMAP54XX and DRA7XX */
#else
#if defined (CONFIG_AM33XX)
#define OMAP_MAX_GPIO 128
#else
#define OMAP_MAX_GPIO 192 /* All other OMAP3/4 */
#endif
#endif
> +
> #define OMAP_GPIO_DIR_OUT 0
> #define OMAP_GPIO_DIR_IN 1
>
> @@ -55,7 +61,7 @@ static inline int get_gpio_index(int gpio)
>
> int gpio_is_valid(int gpio)
> {
> - return (gpio >= 0) && (gpio < 192);
> + return (gpio >= 0) && (gpio < OMAP_MAX_GPIO);
> }
>
> static int check_gpio(int gpio)
>
Regards,
Lubo
next prev parent reply other threads:[~2013-06-21 6:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-21 3:07 [U-Boot] [PATCH v2] gpio: omap_gpio: Fix valid gpio range for AM33XX Axel Lin
2013-06-21 5:23 ` Stefan Roese
2013-06-21 6:59 ` Lubomir Popov [this message]
2013-06-21 7:13 ` Axel Lin
2013-06-21 7:29 ` Lubomir Popov
2013-06-21 7:44 ` Lubomir Popov
2013-06-21 8:44 ` Heiko Schocher
2013-06-21 8:45 ` Axel Lin
2013-06-21 10:04 ` Lubomir Popov
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=51C3F9CC.2040509@mm-sol.com \
--to=lpopov@mm-sol.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