* [U-Boot] [PATCH 1/2] OMAP5: Fix gpio_bank_54xx setting
@ 2013-06-21 8:47 Axel Lin
2013-06-21 8:50 ` [U-Boot] [PATCH 2/2] OMAP: gpio: Introduce get_omap_gpio_count() function to get gpio count Axel Lin
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2013-06-21 8:47 UTC (permalink / raw)
To: u-boot
OMAP54XX and DRA7XX SoCs have 8 banks per 32 GPIOs, that is, 256 in total.
Fix the gpio bank setting.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
arch/arm/cpu/armv7/omap5/hwinit.c | 4 +++-
arch/arm/include/asm/arch-omap5/gpio.h | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/arm/cpu/armv7/omap5/hwinit.c b/arch/arm/cpu/armv7/omap5/hwinit.c
index daf124e..11ba36b 100644
--- a/arch/arm/cpu/armv7/omap5/hwinit.c
+++ b/arch/arm/cpu/armv7/omap5/hwinit.c
@@ -43,13 +43,15 @@ DECLARE_GLOBAL_DATA_PTR;
u32 *const omap_si_rev = (u32 *)OMAP_SRAM_SCRATCH_OMAP_REV;
-static struct gpio_bank gpio_bank_54xx[6] = {
+static struct gpio_bank gpio_bank_54xx[8] = {
{ (void *)OMAP54XX_GPIO1_BASE, METHOD_GPIO_24XX },
{ (void *)OMAP54XX_GPIO2_BASE, METHOD_GPIO_24XX },
{ (void *)OMAP54XX_GPIO3_BASE, METHOD_GPIO_24XX },
{ (void *)OMAP54XX_GPIO4_BASE, METHOD_GPIO_24XX },
{ (void *)OMAP54XX_GPIO5_BASE, METHOD_GPIO_24XX },
{ (void *)OMAP54XX_GPIO6_BASE, METHOD_GPIO_24XX },
+ { (void *)OMAP54XX_GPIO7_BASE, METHOD_GPIO_24XX },
+ { (void *)OMAP54XX_GPIO8_BASE, METHOD_GPIO_24XX },
};
const struct gpio_bank *const omap_gpio_bank = gpio_bank_54xx;
diff --git a/arch/arm/include/asm/arch-omap5/gpio.h b/arch/arm/include/asm/arch-omap5/gpio.h
index c14dff0..f507a35 100644
--- a/arch/arm/include/asm/arch-omap5/gpio.h
+++ b/arch/arm/include/asm/arch-omap5/gpio.h
@@ -46,5 +46,7 @@
#define OMAP54XX_GPIO4_BASE 0x48059000
#define OMAP54XX_GPIO5_BASE 0x4805B000
#define OMAP54XX_GPIO6_BASE 0x4805D000
+#define OMAP54XX_GPIO7_BASE 0x48051000
+#define OMAP54XX_GPIO8_BASE 0x48053000
#endif /* _GPIO_OMAP5_H */
--
1.8.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* [U-Boot] [PATCH 2/2] OMAP: gpio: Introduce get_omap_gpio_count() function to get gpio count
2013-06-21 8:47 [U-Boot] [PATCH 1/2] OMAP5: Fix gpio_bank_54xx setting Axel Lin
@ 2013-06-21 8:50 ` Axel Lin
2013-06-21 10:09 ` Lubomir Popov
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2013-06-21 8:50 UTC (permalink / raw)
To: u-boot
Now the omap_gpio driver is used by AM33XX, OMAP3/4, OMAP54XX and DRA7XX SoCs.
These SoCs have various gpio count. Thus introduce get_omap_gpio_count()
function to get correct gpio count.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
arch/arm/cpu/armv7/am33xx/board.c | 5 +++++
arch/arm/cpu/armv7/omap3/board.c | 5 +++++
arch/arm/cpu/armv7/omap4/hwinit.c | 5 +++++
arch/arm/cpu/armv7/omap5/hwinit.c | 5 +++++
arch/arm/include/asm/omap_gpio.h | 1 +
drivers/gpio/omap_gpio.c | 2 +-
6 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c
index 885fb2d..405d649 100644
--- a/arch/arm/cpu/armv7/am33xx/board.c
+++ b/arch/arm/cpu/armv7/am33xx/board.c
@@ -51,6 +51,11 @@ static const struct gpio_bank gpio_bank_am33xx[4] = {
const struct gpio_bank *const omap_gpio_bank = gpio_bank_am33xx;
+unsigned int get_omap_gpio_count(void)
+{
+ return ARRAY_SIZE(gpio_bank_am33xx) * 32;
+}
+
#if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
int cpu_mmc_init(bd_t *bis)
{
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index b72fadc..950b13f 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -65,6 +65,11 @@ static const struct gpio_bank gpio_bank_34xx[6] = {
const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx;
+unsigned int get_omap_gpio_count(void)
+{
+ return ARRAY_SIZE(gpio_bank_34xx) * 32;
+}
+
#ifdef CONFIG_SPL_BUILD
/*
* We use static variables because global data is not ready yet.
diff --git a/arch/arm/cpu/armv7/omap4/hwinit.c b/arch/arm/cpu/armv7/omap4/hwinit.c
index 81f5a48..3212980 100644
--- a/arch/arm/cpu/armv7/omap4/hwinit.c
+++ b/arch/arm/cpu/armv7/omap4/hwinit.c
@@ -51,6 +51,11 @@ static const struct gpio_bank gpio_bank_44xx[6] = {
const struct gpio_bank *const omap_gpio_bank = gpio_bank_44xx;
+unsigned int get_omap_gpio_count(void)
+{
+ return ARRAY_SIZE(gpio_bank_44xx) * 32;
+}
+
#ifdef CONFIG_SPL_BUILD
/*
* Some tuning of IOs for optimal power and performance
diff --git a/arch/arm/cpu/armv7/omap5/hwinit.c b/arch/arm/cpu/armv7/omap5/hwinit.c
index 11ba36b..58c77e7 100644
--- a/arch/arm/cpu/armv7/omap5/hwinit.c
+++ b/arch/arm/cpu/armv7/omap5/hwinit.c
@@ -56,6 +56,11 @@ static struct gpio_bank gpio_bank_54xx[8] = {
const struct gpio_bank *const omap_gpio_bank = gpio_bank_54xx;
+unsigned int get_omap_gpio_count(void)
+{
+ return ARRAY_SIZE(gpio_bank_54xx) * 32;
+}
+
#ifdef CONFIG_SPL_BUILD
/* LPDDR2 specific IO settings */
static void io_settings_lpddr2(void)
diff --git a/arch/arm/include/asm/omap_gpio.h b/arch/arm/include/asm/omap_gpio.h
index 1ebfa86..5e25707 100644
--- a/arch/arm/include/asm/omap_gpio.h
+++ b/arch/arm/include/asm/omap_gpio.h
@@ -46,6 +46,7 @@ struct gpio_bank {
};
extern const struct gpio_bank *const omap_gpio_bank;
+extern unsigned int get_omap_gpio_count(void);
#define METHOD_GPIO_24XX 4
diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
index a30d7f0..1088803 100644
--- a/drivers/gpio/omap_gpio.c
+++ b/drivers/gpio/omap_gpio.c
@@ -55,7 +55,7 @@ static inline int get_gpio_index(int gpio)
int gpio_is_valid(int gpio)
{
- return (gpio >= 0) && (gpio < 192);
+ return (gpio >= 0) && (gpio < get_omap_gpio_count());
}
static int check_gpio(int gpio)
--
1.8.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* [U-Boot] [PATCH 2/2] OMAP: gpio: Introduce get_omap_gpio_count() function to get gpio count
2013-06-21 8:50 ` [U-Boot] [PATCH 2/2] OMAP: gpio: Introduce get_omap_gpio_count() function to get gpio count Axel Lin
@ 2013-06-21 10:09 ` Lubomir Popov
0 siblings, 0 replies; 3+ messages in thread
From: Lubomir Popov @ 2013-06-21 10:09 UTC (permalink / raw)
To: u-boot
Axel,
Why do you introduce a function when this stuff is constant and known
to the compiler? Just put a #define in every header. You are now
uselessly inflating code...
Regards,
Lubo
On 21/06/13 11:50, Axel Lin wrote:
> Now the omap_gpio driver is used by AM33XX, OMAP3/4, OMAP54XX and DRA7XX SoCs.
> These SoCs have various gpio count. Thus introduce get_omap_gpio_count()
> function to get correct gpio count.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> arch/arm/cpu/armv7/am33xx/board.c | 5 +++++
> arch/arm/cpu/armv7/omap3/board.c | 5 +++++
> arch/arm/cpu/armv7/omap4/hwinit.c | 5 +++++
> arch/arm/cpu/armv7/omap5/hwinit.c | 5 +++++
> arch/arm/include/asm/omap_gpio.h | 1 +
> drivers/gpio/omap_gpio.c | 2 +-
> 6 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c
> index 885fb2d..405d649 100644
> --- a/arch/arm/cpu/armv7/am33xx/board.c
> +++ b/arch/arm/cpu/armv7/am33xx/board.c
> @@ -51,6 +51,11 @@ static const struct gpio_bank gpio_bank_am33xx[4] = {
>
> const struct gpio_bank *const omap_gpio_bank = gpio_bank_am33xx;
>
> +unsigned int get_omap_gpio_count(void)
> +{
> + return ARRAY_SIZE(gpio_bank_am33xx) * 32;
> +}
> +
> #if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
> int cpu_mmc_init(bd_t *bis)
> {
> diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
> index b72fadc..950b13f 100644
> --- a/arch/arm/cpu/armv7/omap3/board.c
> +++ b/arch/arm/cpu/armv7/omap3/board.c
> @@ -65,6 +65,11 @@ static const struct gpio_bank gpio_bank_34xx[6] = {
>
> const struct gpio_bank *const omap_gpio_bank = gpio_bank_34xx;
>
> +unsigned int get_omap_gpio_count(void)
> +{
> + return ARRAY_SIZE(gpio_bank_34xx) * 32;
> +}
> +
> #ifdef CONFIG_SPL_BUILD
> /*
> * We use static variables because global data is not ready yet.
> diff --git a/arch/arm/cpu/armv7/omap4/hwinit.c b/arch/arm/cpu/armv7/omap4/hwinit.c
> index 81f5a48..3212980 100644
> --- a/arch/arm/cpu/armv7/omap4/hwinit.c
> +++ b/arch/arm/cpu/armv7/omap4/hwinit.c
> @@ -51,6 +51,11 @@ static const struct gpio_bank gpio_bank_44xx[6] = {
>
> const struct gpio_bank *const omap_gpio_bank = gpio_bank_44xx;
>
> +unsigned int get_omap_gpio_count(void)
> +{
> + return ARRAY_SIZE(gpio_bank_44xx) * 32;
> +}
> +
> #ifdef CONFIG_SPL_BUILD
> /*
> * Some tuning of IOs for optimal power and performance
> diff --git a/arch/arm/cpu/armv7/omap5/hwinit.c b/arch/arm/cpu/armv7/omap5/hwinit.c
> index 11ba36b..58c77e7 100644
> --- a/arch/arm/cpu/armv7/omap5/hwinit.c
> +++ b/arch/arm/cpu/armv7/omap5/hwinit.c
> @@ -56,6 +56,11 @@ static struct gpio_bank gpio_bank_54xx[8] = {
>
> const struct gpio_bank *const omap_gpio_bank = gpio_bank_54xx;
>
> +unsigned int get_omap_gpio_count(void)
> +{
> + return ARRAY_SIZE(gpio_bank_54xx) * 32;
> +}
> +
> #ifdef CONFIG_SPL_BUILD
> /* LPDDR2 specific IO settings */
> static void io_settings_lpddr2(void)
> diff --git a/arch/arm/include/asm/omap_gpio.h b/arch/arm/include/asm/omap_gpio.h
> index 1ebfa86..5e25707 100644
> --- a/arch/arm/include/asm/omap_gpio.h
> +++ b/arch/arm/include/asm/omap_gpio.h
> @@ -46,6 +46,7 @@ struct gpio_bank {
> };
>
> extern const struct gpio_bank *const omap_gpio_bank;
> +extern unsigned int get_omap_gpio_count(void);
>
> #define METHOD_GPIO_24XX 4
>
> diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
> index a30d7f0..1088803 100644
> --- a/drivers/gpio/omap_gpio.c
> +++ b/drivers/gpio/omap_gpio.c
> @@ -55,7 +55,7 @@ static inline int get_gpio_index(int gpio)
>
> int gpio_is_valid(int gpio)
> {
> - return (gpio >= 0) && (gpio < 192);
> + return (gpio >= 0) && (gpio < get_omap_gpio_count());
> }
>
> static int check_gpio(int gpio)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-21 10:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-21 8:47 [U-Boot] [PATCH 1/2] OMAP5: Fix gpio_bank_54xx setting Axel Lin
2013-06-21 8:50 ` [U-Boot] [PATCH 2/2] OMAP: gpio: Introduce get_omap_gpio_count() function to get gpio count Axel Lin
2013-06-21 10:09 ` Lubomir Popov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox