[U-Boot] [RFC PATCH 0/3] at91: remove legacy gpio API

This RFC is to remove the need for legacy at91 gpio API in favor of switching to generic gpio API.
Please comment, especially on new gpio macros.
Andreas Bießmann (3): at91: add new gpio pin macros at91sam9263ek: remove ATMEL_LEGACY at91: use generic gpio API for AT91_LED
arch/arm/cpu/arm926ejs/at91/led.c | 43 +++++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-at91/gpio.h | 34 ++++++++++++++++++++++---- board/atmel/at91sam9263ek/led.c | 12 +++------ include/configs/at91sam9263ek.h | 13 +++++----- 4 files changed, 82 insertions(+), 20 deletions(-)

Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com --- arch/arm/include/asm/arch-at91/gpio.h | 34 ++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/arch/arm/include/asm/arch-at91/gpio.h b/arch/arm/include/asm/arch-at91/gpio.h index 0700427..f9ca11e 100644 --- a/arch/arm/include/asm/arch-at91/gpio.h +++ b/arch/arm/include/asm/arch-at91/gpio.h @@ -227,8 +227,32 @@ static inline unsigned pin_to_mask(unsigned pin) at91_set_pio_value((x - PIN_BASE) / 32,(x % 32), y) #define at91_get_gpio_value(x) \ at91_get_pio_value((x - PIN_BASE) / 32,(x % 32)) -#else -#define at91_set_gpio_value(x, y) at91_set_pio_value(x, y) -#define at91_get_gpio_value(x) at91_get_pio_value(x) -#endif -#endif +#else /* CONFIG_ATMEL_LEGACY */ + +#define GPIO_PIOA_BASE (0) +#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32) +#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32) +#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32) +#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32) +#define GPIO_PIN_PA(x) (GPIO_PIOA_BASE + (x)) +#define GPIO_PIN_PB(x) (GPIO_PIOB_BASE + (x)) +#define GPIO_PIN_PC(x) (GPIO_PIOC_BASE + (x)) +#define GPIO_PIN_PD(x) (GPIO_PIOD_BASE + (x)) +#define GPIO_PIN_PE(x) (GPIO_PIOE_BASE + (x)) + +#define at91_gpio_to_port(gpio) (gpio / 32) +#define at91_gpio_to_pin(gpio) (gpio % 32) + +/* remove after transition to generic gpio API of all users */ +#define at91_set_gpio_value(x, y) \ + at91_set_pio_value(at91_gpio_to_port(x), at91_gpio_to_pin(x), y) +#define at91_get_gpio_value(x) \ + at91_get_pio_value(at91_gpio_to_port(x), at91_gpio_to_pin(x)) + +#define at91_set_gpio_input(x, y) \ + at91_set_pio_input(at91_gpio_to_port(x), at91_gpio_to_pin(x), y) +#define at91_set_gpio_output(x, y) \ + at91_set_pio_output(at91_gpio_to_port(x), at91_gpio_to_pin(x), y) + +#endif /* CONFIG_ATMEL_LEGACY */ +#endif /* __ASM_ARCH_AT91_GPIO_H */

Hi Andreas,
On 10/29/2013 20:53, Andreas Bießmann wrote:
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
arch/arm/include/asm/arch-at91/gpio.h | 34 ++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/arch/arm/include/asm/arch-at91/gpio.h b/arch/arm/include/asm/arch-at91/gpio.h index 0700427..f9ca11e 100644 --- a/arch/arm/include/asm/arch-at91/gpio.h +++ b/arch/arm/include/asm/arch-at91/gpio.h @@ -227,8 +227,32 @@ static inline unsigned pin_to_mask(unsigned pin) at91_set_pio_value((x - PIN_BASE) / 32,(x % 32), y) #define at91_get_gpio_value(x) \ at91_get_pio_value((x - PIN_BASE) / 32,(x % 32)) -#else -#define at91_set_gpio_value(x, y) at91_set_pio_value(x, y) -#define at91_get_gpio_value(x) at91_get_pio_value(x) -#endif -#endif +#else /* CONFIG_ATMEL_LEGACY */
+#define GPIO_PIOA_BASE (0) +#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32) +#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32) +#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32) +#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32) +#define GPIO_PIN_PA(x) (GPIO_PIOA_BASE + (x)) +#define GPIO_PIN_PB(x) (GPIO_PIOB_BASE + (x)) +#define GPIO_PIN_PC(x) (GPIO_PIOC_BASE + (x)) +#define GPIO_PIN_PD(x) (GPIO_PIOD_BASE + (x)) +#define GPIO_PIN_PE(x) (GPIO_PIOE_BASE + (x))
+#define at91_gpio_to_port(gpio) (gpio / 32) +#define at91_gpio_to_pin(gpio) (gpio % 32)
This is an exception for at91sam9x5 and at91sam9n12 SoCs, which PIOB and PIOD are not 32 pins. PIOB only has 19 pins, while PIOD only has 22 pins.
+/* remove after transition to generic gpio API of all users */ +#define at91_set_gpio_value(x, y) \
- at91_set_pio_value(at91_gpio_to_port(x), at91_gpio_to_pin(x), y)
+#define at91_get_gpio_value(x) \
- at91_get_pio_value(at91_gpio_to_port(x), at91_gpio_to_pin(x))
+#define at91_set_gpio_input(x, y) \
- at91_set_pio_input(at91_gpio_to_port(x), at91_gpio_to_pin(x), y)
+#define at91_set_gpio_output(x, y) \
- at91_set_pio_output(at91_gpio_to_port(x), at91_gpio_to_pin(x), y)
+#endif /* CONFIG_ATMEL_LEGACY */ +#endif /* __ASM_ARCH_AT91_GPIO_H */
Best Regards, Bo Shen

Hi Bo,
+Jens, he did the rewrite of the at91 gpio driver.
On 10/30/2013 10:56 AM, Bo Shen wrote:
On 10/29/2013 20:53, Andreas Bießmann wrote:
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
arch/arm/include/asm/arch-at91/gpio.h | 34 ++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/arch/arm/include/asm/arch-at91/gpio.h b/arch/arm/include/asm/arch-at91/gpio.h index 0700427..f9ca11e 100644 --- a/arch/arm/include/asm/arch-at91/gpio.h +++ b/arch/arm/include/asm/arch-at91/gpio.h @@ -227,8 +227,32 @@ static inline unsigned pin_to_mask(unsigned pin) at91_set_pio_value((x - PIN_BASE) / 32,(x % 32), y) #define at91_get_gpio_value(x) \ at91_get_pio_value((x - PIN_BASE) / 32,(x % 32)) -#else -#define at91_set_gpio_value(x, y) at91_set_pio_value(x, y) -#define at91_get_gpio_value(x) at91_get_pio_value(x) -#endif -#endif +#else /* CONFIG_ATMEL_LEGACY */
+#define GPIO_PIOA_BASE (0) +#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32) +#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32) +#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32) +#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32) +#define GPIO_PIN_PA(x) (GPIO_PIOA_BASE + (x)) +#define GPIO_PIN_PB(x) (GPIO_PIOB_BASE + (x)) +#define GPIO_PIN_PC(x) (GPIO_PIOC_BASE + (x)) +#define GPIO_PIN_PD(x) (GPIO_PIOD_BASE + (x)) +#define GPIO_PIN_PE(x) (GPIO_PIOE_BASE + (x))
+#define at91_gpio_to_port(gpio) (gpio / 32) +#define at91_gpio_to_pin(gpio) (gpio % 32)
This is an exception for at91sam9x5 and at91sam9n12 SoCs, which PIOB and PIOD are not 32 pins. PIOB only has 19 pins, while PIOD only has 22 pins.
I think this is a job for gpio_is_valid() then. How is this case handled in kernel?
Here are a few things to discuss. First of all I'd like to get some insights why the at91 gpio API was changed back in 2010. It was a plain number before and was changed to PORT + PIN as two separate parameters. Jens, could you please shed some light on this?
The second thing is this specific RFC implementation. It contains again different points.
a) it defines another way to get a plain number for a GPIO (GPIO_PIN_Px())
I know that the kernel uses AT91_PIN_Pxy notation for defining a GPIO number. The above approach is copied from AVR32 which I think is a bit better cause of smaller include file. This change however should be discussed here.
b) the fact that we shift back to a plain number for defining a GPIO
I'd like to have a plain number defining a GPIO (which doesn't need to correlate to a number in SoC spec's). It is just a plain number for feeding generic gpio API. Which I'd like to use in the drivers to be able to share with AVR32 or other generic stuff like status led API. Currently some drivers do not define the CONFIG_ATMEL_LEGACY (to hide the old defines) but use the PORT + PIN pair for example in pm9g45:
#define CONFIG_RED_LED AT91_PIO_PORTD, 31
and this is ugly!
Just to mention, I'd like to hide the current API of PORT + PIN as separate parameters but not delete it. It is Ok in at91 specific surrounding but where we share code with others we need to use that single number that represents a GPIO. Especially is it misleading approach in board headers to define the PORT + PIN tuple as an single parameter to be placed in by preprocessor.
Any comments?
Best regards
Andreas Bießmann

Am 30.10.2013 11:39, schrieb Andreas Bießmann:
Hi Bo,
+Jens, he did the rewrite of the at91 gpio driver.
I think this is a job for gpio_is_valid() then. How is this case handled in kernel?
Here are a few things to discuss. First of all I'd like to get some insights why the at91 gpio API was changed back in 2010. It was a plain number before and was changed to PORT + PIN as two separate parameters. Jens, could you please shed some light on this?
Sorry, but I don't remember me why we do this. I think, it was a compromise between number of changes and code size.
Regards
Jens

Hi Jens,
On 30.10.13 18:19, Jens Scharsig wrote:
Am 30.10.2013 11:39, schrieb Andreas Bießmann:
Hi Bo,
+Jens, he did the rewrite of the at91 gpio driver.
I think this is a job for gpio_is_valid() then. How is this case handled in kernel?
Here are a few things to discuss. First of all I'd like to get some insights why the at91 gpio API was changed back in 2010. It was a plain number before and was changed to PORT + PIN as two separate parameters. Jens, could you please shed some light on this?
Sorry, but I don't remember me why we do this. I think, it was a compromise between number of changes and code size.
found it: http://article.gmane.org/gmane.comp.boot-loaders.u-boot/74579
---8<--- Jens Scharsig wrote:
+#endif
+#define AT91_PIN_TO_MASK(x) (1<<x) +#define AT91_PORTPIN(PORT, PIN) ((0x0##PORT - 9) * 32 + ((PIN) & 0x1F)) +#define AT91_PIO_PORTA 0x0 +#define AT91_PIO_PORTB 0x1 +#define AT91_PIO_PORTC 0x2 +#define AT91_PIO_PORTD 0x3 +#define AT91_PIO_PORTE 0x4
Tom.Rix@windriver.com: Is this necessary? You are packing arguments that you are passing to the gpio functions. It would be better if there were seperate port, pin parameters than combining and then uncombining. Please change this. --->8---
I think we should shift toward the linux kernel at91_pio API which uses a single number for identifying the GPIO. Any complaints?
I think it would make sense to retain some PORT + MASK functions to easily switch multiple I/O in one go. What do you think about?
Best regards
Andreas Bießmann

Hello Andreas,
Am 30.10.2013 19:59, schrieb Andreas Bießmann:
Hi Jens,
On 30.10.13 18:19, Jens Scharsig wrote:
Am 30.10.2013 11:39, schrieb Andreas Bießmann:
Hi Bo,
+Jens, he did the rewrite of the at91 gpio driver.
I think this is a job for gpio_is_valid() then. How is this case handled in kernel?
Here are a few things to discuss. First of all I'd like to get some insights why the at91 gpio API was changed back in 2010. It was a plain number before and was changed to PORT + PIN as two separate parameters. Jens, could you please shed some light on this?
Sorry, but I don't remember me why we do this. I think, it was a compromise between number of changes and code size.
found it: http://article.gmane.org/gmane.comp.boot-loaders.u-boot/74579
---8<--- Jens Scharsig wrote:
+#endif
+#define AT91_PIN_TO_MASK(x) (1<<x) +#define AT91_PORTPIN(PORT, PIN) ((0x0##PORT - 9) * 32 + ((PIN)& 0x1F)) +#define AT91_PIO_PORTA 0x0 +#define AT91_PIO_PORTB 0x1 +#define AT91_PIO_PORTC 0x2 +#define AT91_PIO_PORTD 0x3 +#define AT91_PIO_PORTE 0x4
Tom.Rix@windriver.com: Is this necessary? You are packing arguments that you are passing to the gpio functions. It would be better if there were seperate port, pin parameters than combining and then uncombining. Please change this. --->8---
I think we should shift toward the linux kernel at91_pio API which uses a single number for identifying the GPIO. Any complaints?
Full Ack.
I think it would make sense to retain some PORT + MASK functions to easily switch multiple I/O in one go. What do you think about?
That would be good.
bye, Heiko

Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
--- board/atmel/at91sam9263ek/led.c | 12 ++++-------- include/configs/at91sam9263ek.h | 13 ++++++------- 2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/board/atmel/at91sam9263ek/led.c b/board/atmel/at91sam9263ek/led.c index e317d99..8ed8de2 100644 --- a/board/atmel/at91sam9263ek/led.c +++ b/board/atmel/at91sam9263ek/led.c @@ -8,7 +8,7 @@
#include <common.h> #include <asm/io.h> -#include <asm/arch/gpio.h> +#include <asm/gpio.h> #include <asm/arch/at91_pmc.h> #include <asm/arch/at91sam9263.h>
@@ -20,11 +20,7 @@ void coloured_LED_init(void) writel(1 << ATMEL_ID_PIOB | 1 << ATMEL_ID_PIOCDE, &pmc->pcer);
- at91_set_gpio_output(CONFIG_RED_LED, 1); - at91_set_gpio_output(CONFIG_GREEN_LED, 1); - at91_set_gpio_output(CONFIG_YELLOW_LED, 1); - - at91_set_gpio_value(CONFIG_RED_LED, 0); - at91_set_gpio_value(CONFIG_GREEN_LED, 1); - at91_set_gpio_value(CONFIG_YELLOW_LED, 1); + gpio_direction_output(CONFIG_RED_LED, 0); + gpio_direction_output(CONFIG_GREEN_LED, 1); + gpio_direction_output(CONFIG_YELLOW_LED, 1); } diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h index 40e167c..3a80e7d 100644 --- a/include/configs/at91sam9263ek.h +++ b/include/configs/at91sam9263ek.h @@ -52,8 +52,7 @@ /* * Hardware drivers */ -#define CONFIG_ATMEL_LEGACY -#define CONFIG_AT91_GPIO 1 +#define CONFIG_AT91_GPIO #define CONFIG_AT91_GPIO_PULLUP 1
/* serial console */ @@ -76,9 +75,9 @@
/* LED */ #define CONFIG_AT91_LED -#define CONFIG_RED_LED AT91_PIN_PB7 /* the power led */ -#define CONFIG_GREEN_LED AT91_PIN_PB8 /* the user1 led */ -#define CONFIG_YELLOW_LED AT91_PIN_PC29 /* the user2 led */ +#define CONFIG_RED_LED GPIO_PIN_PA(7) /* the power led */ +#define CONFIG_GREEN_LED GPIO_PIN_PB(8) /* the user1 led */ +#define CONFIG_YELLOW_LED GPIO_PIN_PC(29) /* the user2 led */
#define CONFIG_BOOTDELAY 3
@@ -267,8 +266,8 @@ #define CONFIG_SYS_NAND_MASK_ALE (1 << 21) /* our CLE is AD22 */ #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) -#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD15 -#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PA22 +#define CONFIG_SYS_NAND_ENABLE_PIN GPIO_PIN_PD(15) +#define CONFIG_SYS_NAND_READY_PIN GPIO_PIN_PA(22) #endif
/* Ethernet */

Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com --- arch/arm/cpu/arm926ejs/at91/led.c | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/arch/arm/cpu/arm926ejs/at91/led.c b/arch/arm/cpu/arm926ejs/at91/led.c index 5dd9048..9dcba7a 100644 --- a/arch/arm/cpu/arm926ejs/at91/led.c +++ b/arch/arm/cpu/arm926ejs/at91/led.c @@ -7,6 +7,9 @@ */
#include <common.h> + +#ifdef CONFIG_ATMEL_LEGACY + #include <asm/io.h> #include <asm/arch/at91_pmc.h> #include <asm/arch/at91_pio.h> @@ -47,3 +50,43 @@ void yellow_led_off(void) at91_set_gpio_value(CONFIG_YELLOW_LED, 1); } #endif +#else /* CONFIG_ATMEL_LEGACY */ + +#include <asm/gpio.h> + +#ifdef CONFIG_RED_LED +void red_led_on(void) +{ + gpio_set_value(CONFIG_RED_LED, 1); +} + +void red_led_off(void) +{ + gpio_set_value(CONFIG_RED_LED, 0); +} +#endif + +#ifdef CONFIG_GREEN_LED +void green_led_on(void) +{ + gpio_set_value(CONFIG_GREEN_LED, 0); +} + +void green_led_off(void) +{ + gpio_set_value(CONFIG_GREEN_LED, 1); +} +#endif + +#ifdef CONFIG_YELLOW_LED +void yellow_led_on(void) +{ + gpio_set_value(CONFIG_YELLOW_LED, 0); +} + +void yellow_led_off(void) +{ + gpio_set_value(CONFIG_YELLOW_LED, 1); +} +#endif +#endif /* CONFIG_ATMEL_LEGACY */

This series adds new macros to name a GPIO, it uses again a single number (as the legacy at91_pio api does). It converts the at91-nand and the at91-led stuff to use these new GPIO numbers. But it is not the whole thing at once, I have another RFC to add new portmux API which is more close to the hardware, it will work with a port number plus mask. This will be sent soon, but too late for 2014.01.
This series however had an RFC in the MW and will therefore end up in the 2014.01 release.
For all waiting on this change, I hopefully merge it next week and send another PR to Albert.
Andreas Bießmann (4): at91: add new gpio pin definitions at91: redefine legacy GPIO PIN_BASE at91: nand: switch atmel_nand to generic GPIO API at91: switch coloured LED to gpio API
arch/arm/cpu/arm926ejs/at91/led.c | 16 +++++++--------- arch/arm/include/asm/arch-at91/gpio.h | 26 ++++++++++++++++++++++++-- board/BuS/vl_ma2sc/vl_ma2sc.c | 5 +++-- board/egnite/ethernut5/ethernut5.c | 3 ++- board/esd/meesc/meesc.c | 5 +++-- board/esd/otc570/otc570.c | 5 +++-- board/eukrea/cpu9260/cpu9260.c | 5 +++-- board/ronetix/pm9261/led.c | 14 +++++++------- board/ronetix/pm9261/pm9261.c | 5 +++-- board/ronetix/pm9263/led.c | 10 +++++----- board/ronetix/pm9263/pm9263.c | 5 +++-- board/ronetix/pm9g45/pm9g45.c | 5 +++-- drivers/gpio/at91_gpio.c | 4 +--- drivers/mtd/nand/atmel_nand.c | 8 +++----- include/configs/at91sam9n12ek.h | 4 ++-- include/configs/cpu9260.h | 4 ++-- include/configs/ethernut5.h | 2 +- include/configs/meesc.h | 4 ++-- include/configs/otc570.h | 4 ++-- include/configs/pm9261.h | 10 +++++----- include/configs/pm9263.h | 8 ++++---- include/configs/pm9g45.h | 8 ++++---- include/configs/vl_ma2sc.h | 4 ++-- 23 files changed, 94 insertions(+), 70 deletions(-)

This patch define new names for GPIO pins on at91 devices. Follow up patches will convert the whole infrastructure to use these new definitions.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com --- arch/arm/include/asm/arch-at91/gpio.h | 24 +++++++++++++++++++++++- drivers/gpio/at91_gpio.c | 4 +--- 2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/arch/arm/include/asm/arch-at91/gpio.h b/arch/arm/include/asm/arch-at91/gpio.h index 0700427..b340afe 100644 --- a/arch/arm/include/asm/arch-at91/gpio.h +++ b/arch/arm/include/asm/arch-at91/gpio.h @@ -231,4 +231,26 @@ static inline unsigned pin_to_mask(unsigned pin) #define at91_set_gpio_value(x, y) at91_set_pio_value(x, y) #define at91_get_gpio_value(x) at91_get_pio_value(x) #endif -#endif + +#define GPIO_PIOA_BASE (0) +#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32) +#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32) +#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32) +#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32) +#define GPIO_PIN_PA(x) (GPIO_PIOA_BASE + (x)) +#define GPIO_PIN_PB(x) (GPIO_PIOB_BASE + (x)) +#define GPIO_PIN_PC(x) (GPIO_PIOC_BASE + (x)) +#define GPIO_PIN_PD(x) (GPIO_PIOD_BASE + (x)) +#define GPIO_PIN_PE(x) (GPIO_PIOE_BASE + (x)) + +static inline unsigned at91_gpio_to_port(unsigned gpio) +{ + return gpio / 32; +} + +static inline unsigned at91_gpio_to_pin(unsigned gpio) +{ + return gpio % 32; +} + +#endif /* __ASM_ARCH_AT91_GPIO_H */ diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index af09786..8b76666 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -14,6 +14,7 @@ #include <asm/sizes.h> #include <asm/arch/hardware.h> #include <asm/arch/at91_pio.h> +#include <asm/arch/gpio.h>
static struct at91_port *at91_pio_get_port(unsigned port) { @@ -356,9 +357,6 @@ int at91_get_pio_value(unsigned port, unsigned pin)
/* Common GPIO API */
-#define at91_gpio_to_port(gpio) (gpio / 32) -#define at91_gpio_to_pin(gpio) (gpio % 32) - int gpio_request(unsigned gpio, const char *label) { return 0;

Hi Andreas,
On 11/29/2013 07:13 PM, Andreas Bießmann wrote:
This patch define new names for GPIO pins on at91 devices. Follow up patches will convert the whole infrastructure to use these new definitions.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
arch/arm/include/asm/arch-at91/gpio.h | 24 +++++++++++++++++++++++- drivers/gpio/at91_gpio.c | 4 +--- 2 files changed, 24 insertions(+), 4 deletions(-)
For this series, tested OK on at91sam9n12ek and at91sam9x5ek board. Thanks.
Tested-by: Bo Shen voice.shen@atmel.com
Best Regards, Bo Shen

Dear Andreas Devel,
Andreas Devel andreas.devel@googlemail.com writes:
This patch define new names for GPIO pins on at91 devices. Follow up patches will convert the whole infrastructure to use these new definitions.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com Tested-by: Bo Shen voice.shen@atmel.com
arch/arm/include/asm/arch-at91/gpio.h | 24 +++++++++++++++++++++++- drivers/gpio/at91_gpio.c | 4 +--- 2 files changed, 24 insertions(+), 4 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

In order to get the very same value for legacy pin definitions and new gpio definitions set the legacy PIN_BASE to 0.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com --- arch/arm/include/asm/arch-at91/gpio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/arch-at91/gpio.h b/arch/arm/include/asm/arch-at91/gpio.h index b340afe..ff6142b 100644 --- a/arch/arm/include/asm/arch-at91/gpio.h +++ b/arch/arm/include/asm/arch-at91/gpio.h @@ -16,7 +16,7 @@
#ifdef CONFIG_ATMEL_LEGACY
-#define PIN_BASE 32 +#define PIN_BASE 0
#define MAX_GPIO_BANKS 5

Dear Andreas Devel,
Andreas Devel andreas.devel@googlemail.com writes:
In order to get the very same value for legacy pin definitions and new gpio definitions set the legacy PIN_BASE to 0.
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
arch/arm/include/asm/arch-at91/gpio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com --- board/BuS/vl_ma2sc/vl_ma2sc.c | 5 +++-- board/egnite/ethernut5/ethernut5.c | 3 ++- board/esd/meesc/meesc.c | 5 +++-- board/esd/otc570/otc570.c | 5 +++-- board/eukrea/cpu9260/cpu9260.c | 5 +++-- board/ronetix/pm9261/pm9261.c | 5 +++-- board/ronetix/pm9263/pm9263.c | 5 +++-- board/ronetix/pm9g45/pm9g45.c | 5 +++-- drivers/mtd/nand/atmel_nand.c | 8 +++----- include/configs/at91sam9n12ek.h | 4 ++-- include/configs/cpu9260.h | 4 ++-- include/configs/ethernut5.h | 2 +- include/configs/meesc.h | 4 ++-- include/configs/otc570.h | 4 ++-- include/configs/pm9261.h | 4 ++-- include/configs/pm9263.h | 4 ++-- include/configs/pm9g45.h | 4 ++-- include/configs/vl_ma2sc.h | 4 ++-- 18 files changed, 43 insertions(+), 37 deletions(-)
diff --git a/board/BuS/vl_ma2sc/vl_ma2sc.c b/board/BuS/vl_ma2sc/vl_ma2sc.c index e2ae6fd..ccfb6da 100644 --- a/board/BuS/vl_ma2sc/vl_ma2sc.c +++ b/board/BuS/vl_ma2sc/vl_ma2sc.c @@ -10,6 +10,7 @@ #include <common.h> #include <asm/sizes.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/arch/hardware.h> #include <asm/arch/clk.h> #include <asm/arch/at91_matrix.h> @@ -66,10 +67,10 @@ static void vl_ma2sc_nand_hw_init(void)
/* Configure RDY/BSY */ #ifdef CONFIG_SYS_NAND_READY_PIN - at91_set_pio_input(CONFIG_SYS_NAND_READY_PIN, 1); + gpio_direction_input(CONFIG_SYS_NAND_READY_PIN); #endif /* Enable NandFlash */ - at91_set_pio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); + gpio_direction_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); } #endif
diff --git a/board/egnite/ethernut5/ethernut5.c b/board/egnite/ethernut5/ethernut5.c index 1f5eea5..b45213c 100644 --- a/board/egnite/ethernut5/ethernut5.c +++ b/board/egnite/ethernut5/ethernut5.c @@ -71,6 +71,7 @@ #include <asm/arch/at91_spi.h> #include <asm/arch/gpio.h> #include <asm/io.h> +#include <asm/gpio.h>
#include "ethernut5_pwrman.h"
@@ -141,7 +142,7 @@ static void ethernut5_nand_hw_init(void) /* Ready pin is optional. */ at91_set_pio_input(CONFIG_SYS_NAND_READY_PIN, 1); #endif - at91_set_pio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); + gpio_direction_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); } #endif
diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c index 9bf6739..c5994e0 100644 --- a/board/esd/meesc/meesc.c +++ b/board/esd/meesc/meesc.c @@ -12,6 +12,7 @@
#include <common.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/arch/at91sam9_smc.h> #include <asm/arch/at91_common.h> #include <asm/arch/at91_pmc.h> @@ -74,10 +75,10 @@ static void meesc_nand_hw_init(void) &smc->cs[3].mode);
/* Configure RDY/BSY */ - at91_set_pio_input(CONFIG_SYS_NAND_READY_PIN, 1); + gpio_direction_input(CONFIG_SYS_NAND_READY_PIN);
/* Enable NandFlash */ - at91_set_pio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); + gpio_direction_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); } #endif /* CONFIG_CMD_NAND */
diff --git a/board/esd/otc570/otc570.c b/board/esd/otc570/otc570.c index acc1b31..4751d0a 100644 --- a/board/esd/otc570/otc570.c +++ b/board/esd/otc570/otc570.c @@ -12,6 +12,7 @@
#include <common.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/arch/at91sam9_smc.h> #include <asm/arch/at91_common.h> #include <asm/arch/at91_pmc.h> @@ -82,10 +83,10 @@ static void otc570_nand_hw_init(void) &smc->cs[3].mode);
/* Configure RDY/BSY */ - at91_set_pio_input(CONFIG_SYS_NAND_READY_PIN, 1); + gpio_direction_input(CONFIG_SYS_NAND_READY_PIN);
/* Enable NandFlash */ - at91_set_pio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); + gpio_direction_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); } #endif /* CONFIG_CMD_NAND */
diff --git a/board/eukrea/cpu9260/cpu9260.c b/board/eukrea/cpu9260/cpu9260.c index 5e1524e..9dc6dcc 100644 --- a/board/eukrea/cpu9260/cpu9260.c +++ b/board/eukrea/cpu9260/cpu9260.c @@ -12,6 +12,7 @@
#include <common.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/arch/at91sam9260.h> #include <asm/arch/at91sam9_smc.h> #include <asm/arch/at91_common.h> @@ -79,10 +80,10 @@ static void cpu9260_nand_hw_init(void) writel(1 << ATMEL_ID_PIOC, &pmc->pcer);
/* Configure RDY/BSY */ - at91_set_pio_input(CONFIG_SYS_NAND_READY_PIN, 1); + gpio_direction_input(CONFIG_SYS_NAND_READY_PIN);
/* Enable NandFlash */ - at91_set_pio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); + gpio_direction_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); } #endif
diff --git a/board/ronetix/pm9261/pm9261.c b/board/ronetix/pm9261/pm9261.c index a2a569b..a634383 100644 --- a/board/ronetix/pm9261/pm9261.c +++ b/board/ronetix/pm9261/pm9261.c @@ -11,6 +11,7 @@ #include <common.h> #include <asm/sizes.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/arch/at91sam9_smc.h> #include <asm/arch/at91_common.h> #include <asm/arch/at91_pmc.h> @@ -73,10 +74,10 @@ static void pm9261_nand_hw_init(void) &pmc->pcer);
/* Configure RDY/BSY */ - at91_set_pio_input(CONFIG_SYS_NAND_READY_PIN, 1); + gpio_direction_input(CONFIG_SYS_NAND_READY_PIN);
/* Enable NandFlash */ - at91_set_pio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); + gpio_direction_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
at91_set_a_periph(AT91_PIO_PORTC, 0, 0); /* NANDOE */ at91_set_a_periph(AT91_PIO_PORTC, 1, 0); /* NANDWE */ diff --git a/board/ronetix/pm9263/pm9263.c b/board/ronetix/pm9263/pm9263.c index 48eba99..3cedeef 100644 --- a/board/ronetix/pm9263/pm9263.c +++ b/board/ronetix/pm9263/pm9263.c @@ -11,6 +11,7 @@ #include <common.h> #include <asm/sizes.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/arch/at91sam9_smc.h> #include <asm/arch/at91_common.h> #include <asm/arch/at91_pmc.h> @@ -67,10 +68,10 @@ static void pm9263_nand_hw_init(void) &smc->cs[3].mode);
/* Configure RDY/BSY */ - at91_set_pio_input(CONFIG_SYS_NAND_READY_PIN, 1); + gpio_direction_input(CONFIG_SYS_NAND_READY_PIN);
/* Enable NandFlash */ - at91_set_pio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); + gpio_direction_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); } #endif
diff --git a/board/ronetix/pm9g45/pm9g45.c b/board/ronetix/pm9g45/pm9g45.c index 5bb5a3c..c9f2747 100644 --- a/board/ronetix/pm9g45/pm9g45.c +++ b/board/ronetix/pm9g45/pm9g45.c @@ -14,6 +14,7 @@ #include <common.h> #include <asm/sizes.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/arch/at91sam9_smc.h> #include <asm/arch/at91_common.h> #include <asm/arch/at91_pmc.h> @@ -66,11 +67,11 @@ static void pm9g45_nand_hw_init(void)
#ifdef CONFIG_SYS_NAND_READY_PIN /* Configure RDY/BSY */ - at91_set_pio_input(CONFIG_SYS_NAND_READY_PIN, 1); + gpio_direction_input(CONFIG_SYS_NAND_READY_PIN); #endif
/* Enable NandFlash */ - at91_set_pio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); + gpio_direction_output(CONFIG_SYS_NAND_ENABLE_PIN, 1); } #endif
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index da83f06..99fc86c 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -12,9 +12,8 @@ */
#include <common.h> -#include <asm/arch/hardware.h> +#include <asm/gpio.h> #include <asm/arch/gpio.h> -#include <asm/arch/at91_pio.h>
#include <malloc.h> #include <nand.h> @@ -1146,8 +1145,7 @@ static void at91_nand_hwcontrol(struct mtd_info *mtd, IO_ADDR_W |= CONFIG_SYS_NAND_MASK_ALE;
#ifdef CONFIG_SYS_NAND_ENABLE_PIN - at91_set_gpio_value(CONFIG_SYS_NAND_ENABLE_PIN, - !(ctrl & NAND_NCE)); + gpio_set_value(CONFIG_SYS_NAND_ENABLE_PIN, !(ctrl & NAND_NCE)); #endif this->IO_ADDR_W = (void *) IO_ADDR_W; } @@ -1159,7 +1157,7 @@ static void at91_nand_hwcontrol(struct mtd_info *mtd, #ifdef CONFIG_SYS_NAND_READY_PIN static int at91_nand_ready(struct mtd_info *mtd) { - return at91_get_gpio_value(CONFIG_SYS_NAND_READY_PIN); + return gpio_get_value(CONFIG_SYS_NAND_READY_PIN); } #endif
diff --git a/include/configs/at91sam9n12ek.h b/include/configs/at91sam9n12ek.h index 4ec1799..e23549d 100644 --- a/include/configs/at91sam9n12ek.h +++ b/include/configs/at91sam9n12ek.h @@ -113,8 +113,8 @@ #define CONFIG_SYS_NAND_BASE 0x40000000 #define CONFIG_SYS_NAND_MASK_ALE (1 << 21) #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) -#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTD, 4 -#define CONFIG_SYS_NAND_READY_PIN AT91_PIO_PORTD, 5 +#define CONFIG_SYS_NAND_ENABLE_PIN GPIO_PIN_PD(4) +#define CONFIG_SYS_NAND_READY_PIN GPIO_PIN_PD(5)
/* PMECC & PMERRLOC */ #define CONFIG_ATMEL_NAND_HWECC diff --git a/include/configs/cpu9260.h b/include/configs/cpu9260.h index ccf36a5..f189b15 100644 --- a/include/configs/cpu9260.h +++ b/include/configs/cpu9260.h @@ -280,8 +280,8 @@ #define CONFIG_SYS_MAX_NAND_DEVICE 1 #define CONFIG_SYS_NAND_BASE 0x40000000 #define CONFIG_SYS_NAND_DBW_8 1 -#define CONFIG_SYS_NAND_READY_PIN AT91_PIO_PORTC, 13 -#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTC, 14 +#define CONFIG_SYS_NAND_READY_PIN GPIO_PIN_PC(13) +#define CONFIG_SYS_NAND_ENABLE_PIN GPIO_PIN_PC(14) #define CONFIG_SYS_NAND_MASK_ALE (1 << 21) #define CONFIG_SYS_NAND_MASK_CLE (1 << 22)
diff --git a/include/configs/ethernut5.h b/include/configs/ethernut5.h index 252df54..480d867 100644 --- a/include/configs/ethernut5.h +++ b/include/configs/ethernut5.h @@ -149,7 +149,7 @@ #define CONFIG_SYS_NAND_MASK_ALE (1 << 21) /* our CLE is AD22 */ #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) -#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTC, 14 +#define CONFIG_SYS_NAND_ENABLE_PIN GPIO_PIN_PC(14) #endif
/* JFFS2 */ diff --git a/include/configs/meesc.h b/include/configs/meesc.h index 91f6e2f..86ce5f2 100644 --- a/include/configs/meesc.h +++ b/include/configs/meesc.h @@ -143,8 +143,8 @@ # define CONFIG_SYS_NAND_DBW_8 # define CONFIG_SYS_NAND_MASK_ALE (1 << 21) # define CONFIG_SYS_NAND_MASK_CLE (1 << 22) -# define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTD, 15 -# define CONFIG_SYS_NAND_READY_PIN AT91_PIO_PORTA, 22 +# define CONFIG_SYS_NAND_ENABLE_PIN GPIO_PIN_PD(15) +# define CONFIG_SYS_NAND_READY_PIN GPIO_PIN_PA(22) #endif
/* Ethernet */ diff --git a/include/configs/otc570.h b/include/configs/otc570.h index 3f4e073..629967d 100644 --- a/include/configs/otc570.h +++ b/include/configs/otc570.h @@ -193,8 +193,8 @@ # define CONFIG_SYS_NAND_DBW_8 # define CONFIG_SYS_NAND_MASK_ALE (1 << 21) # define CONFIG_SYS_NAND_MASK_CLE (1 << 22) -# define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTD, 15 -# define CONFIG_SYS_NAND_READY_PIN AT91_PIO_PORTA, 22 +# define CONFIG_SYS_NAND_ENABLE_PIN GPIO_PIN_PD(15) +# define CONFIG_SYS_NAND_READY_PIN GPIO_PIN_PA(22) #endif
/* Ethernet */ diff --git a/include/configs/pm9261.h b/include/configs/pm9261.h index fc95cf0..9442d8f 100644 --- a/include/configs/pm9261.h +++ b/include/configs/pm9261.h @@ -221,8 +221,8 @@ #define CONFIG_SYS_NAND_MASK_ALE (1 << 22) /* our CLE is AD21 */ #define CONFIG_SYS_NAND_MASK_CLE (1 << 21) -#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTC, 14 -#define CONFIG_SYS_NAND_READY_PIN AT91_PIO_PORTA, 16 +#define CONFIG_SYS_NAND_ENABLE_PIN GPIO_PIN_PC(14) +#define CONFIG_SYS_NAND_READY_PIN GPIO_PIN_PA(16)
/* NOR flash */ #define CONFIG_SYS_FLASH_CFI 1 diff --git a/include/configs/pm9263.h b/include/configs/pm9263.h index 533e249..dffc336 100644 --- a/include/configs/pm9263.h +++ b/include/configs/pm9263.h @@ -241,8 +241,8 @@ #define CONFIG_SYS_NAND_MASK_ALE (1 << 21) /* our CLE is AD22 */ #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) -#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTD, 15 -#define CONFIG_SYS_NAND_READY_PIN AT91_PIO_PORTB, 30 +#define CONFIG_SYS_NAND_ENABLE_PIN GPIO_PIN_PD(15) +#define CONFIG_SYS_NAND_READY_PIN GPIO_PIN_PB(30)
#endif
diff --git a/include/configs/pm9g45.h b/include/configs/pm9g45.h index e0c388e..03a25c8 100644 --- a/include/configs/pm9g45.h +++ b/include/configs/pm9g45.h @@ -106,8 +106,8 @@ #define CONFIG_SYS_NAND_MASK_ALE (1 << 21) /* our CLE is AD22 */ #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) -#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTC, 14 -#define CONFIG_SYS_NAND_READY_PIN AT91_PIO_PORTD, 3 +#define CONFIG_SYS_NAND_ENABLE_PIN GPIO_PIN_PC(14) +#define CONFIG_SYS_NAND_READY_PIN GPIO_PIN_PD(3)
#endif
diff --git a/include/configs/vl_ma2sc.h b/include/configs/vl_ma2sc.h index 1489080..98cb9d7 100644 --- a/include/configs/vl_ma2sc.h +++ b/include/configs/vl_ma2sc.h @@ -320,8 +320,8 @@ #define CONFIG_SYS_NAND_DBW_8 1 #define CONFIG_SYS_NAND_MASK_ALE (1 << 21) /* our ALE is AD21 */ #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) /* our CLE is AD22 */ -#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTD, 15 -#define CONFIG_SYS_NAND_READY_PIN AT91_PIO_PORTB, 0 +#define CONFIG_SYS_NAND_ENABLE_PIN GPIO_PIN_PD(15) +#define CONFIG_SYS_NAND_READY_PIN GPIO_PIN_PB(0) #define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */ #endif

Am 2013-11-29 12:13, schrieb Andreas Bießmann:
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
board/BuS/vl_ma2sc/vl_ma2sc.c | 5 +++-- board/egnite/ethernut5/ethernut5.c | 3 ++- board/esd/meesc/meesc.c | 5 +++-- board/esd/otc570/otc570.c | 5 +++-- board/eukrea/cpu9260/cpu9260.c | 5 +++-- board/ronetix/pm9261/pm9261.c | 5 +++-- board/ronetix/pm9263/pm9263.c | 5 +++-- board/ronetix/pm9g45/pm9g45.c | 5 +++-- drivers/mtd/nand/atmel_nand.c | 8 +++----- include/configs/at91sam9n12ek.h | 4 ++-- include/configs/cpu9260.h | 4 ++-- include/configs/ethernut5.h | 2 +- include/configs/meesc.h | 4 ++-- include/configs/otc570.h | 4 ++-- include/configs/pm9261.h | 4 ++-- include/configs/pm9263.h | 4 ++-- include/configs/pm9g45.h | 4 ++-- include/configs/vl_ma2sc.h | 4 ++-- 18 files changed, 43 insertions(+), 37 deletions(-)
I have successfully tested this patch for vl_ma2sc board
Acked-by: Jens Scharsig (BuS Elektronik)esw@bus-elektronik.de Tested-by: Jens Scharsig (BuS Elektronik)esw@bus-elektronik.de

On Fri, 2013-11-29 at 12:13 +0100, Andreas Bießmann wrote:
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
board/BuS/vl_ma2sc/vl_ma2sc.c | 5 +++-- board/egnite/ethernut5/ethernut5.c | 3 ++- board/esd/meesc/meesc.c | 5 +++-- board/esd/otc570/otc570.c | 5 +++-- board/eukrea/cpu9260/cpu9260.c | 5 +++-- board/ronetix/pm9261/pm9261.c | 5 +++-- board/ronetix/pm9263/pm9263.c | 5 +++-- board/ronetix/pm9g45/pm9g45.c | 5 +++-- drivers/mtd/nand/atmel_nand.c | 8 +++----- include/configs/at91sam9n12ek.h | 4 ++-- include/configs/cpu9260.h | 4 ++-- include/configs/ethernut5.h | 2 +- include/configs/meesc.h | 4 ++-- include/configs/otc570.h | 4 ++-- include/configs/pm9261.h | 4 ++-- include/configs/pm9263.h | 4 ++-- include/configs/pm9g45.h | 4 ++-- include/configs/vl_ma2sc.h | 4 ++-- 18 files changed, 43 insertions(+), 37 deletions(-)
Acked-by: Scott Wood scottwood@freescale.com
-Scott

Dear Andreas Devel,
Andreas Devel andreas.devel@googlemail.com writes:
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com Acked-by: Jens Scharsig (BuS Elektronik)esw@bus-elektronik.de Tested-by: Jens Scharsig (BuS Elektronik)esw@bus-elektronik.de Acked-by: Scott Wood scottwood@freescale.com
board/BuS/vl_ma2sc/vl_ma2sc.c | 5 +++-- board/egnite/ethernut5/ethernut5.c | 3 ++- board/esd/meesc/meesc.c | 5 +++-- board/esd/otc570/otc570.c | 5 +++-- board/eukrea/cpu9260/cpu9260.c | 5 +++-- board/ronetix/pm9261/pm9261.c | 5 +++-- board/ronetix/pm9263/pm9263.c | 5 +++-- board/ronetix/pm9g45/pm9g45.c | 5 +++-- drivers/mtd/nand/atmel_nand.c | 8 +++----- include/configs/at91sam9n12ek.h | 4 ++-- include/configs/cpu9260.h | 4 ++-- include/configs/ethernut5.h | 2 +- include/configs/meesc.h | 4 ++-- include/configs/otc570.h | 4 ++-- include/configs/pm9261.h | 4 ++-- include/configs/pm9263.h | 4 ++-- include/configs/pm9g45.h | 4 ++-- include/configs/vl_ma2sc.h | 4 ++-- 18 files changed, 43 insertions(+), 37 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com --- arch/arm/cpu/arm926ejs/at91/led.c | 16 +++++++--------- board/ronetix/pm9261/led.c | 14 +++++++------- board/ronetix/pm9263/led.c | 10 +++++----- include/configs/pm9261.h | 6 +++--- include/configs/pm9263.h | 4 ++-- include/configs/pm9g45.h | 4 ++-- 6 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/at91/led.c b/arch/arm/cpu/arm926ejs/at91/led.c index 5dd9048..46ed055 100644 --- a/arch/arm/cpu/arm926ejs/at91/led.c +++ b/arch/arm/cpu/arm926ejs/at91/led.c @@ -7,43 +7,41 @@ */
#include <common.h> -#include <asm/io.h> -#include <asm/arch/at91_pmc.h> -#include <asm/arch/at91_pio.h> +#include <asm/gpio.h> #include <asm/arch/gpio.h>
#ifdef CONFIG_RED_LED void red_led_on(void) { - at91_set_gpio_value(CONFIG_RED_LED, 1); + gpio_set_value(CONFIG_RED_LED, 1); }
void red_led_off(void) { - at91_set_gpio_value(CONFIG_RED_LED, 0); + gpio_set_value(CONFIG_RED_LED, 0); } #endif
#ifdef CONFIG_GREEN_LED void green_led_on(void) { - at91_set_gpio_value(CONFIG_GREEN_LED, 0); + gpio_set_value(CONFIG_GREEN_LED, 0); }
void green_led_off(void) { - at91_set_gpio_value(CONFIG_GREEN_LED, 1); + gpio_set_value(CONFIG_GREEN_LED, 1); } #endif
#ifdef CONFIG_YELLOW_LED void yellow_led_on(void) { - at91_set_gpio_value(CONFIG_YELLOW_LED, 0); + gpio_set_value(CONFIG_YELLOW_LED, 0); }
void yellow_led_off(void) { - at91_set_gpio_value(CONFIG_YELLOW_LED, 1); + gpio_set_value(CONFIG_YELLOW_LED, 1); } #endif diff --git a/board/ronetix/pm9261/led.c b/board/ronetix/pm9261/led.c index 223a516..cc4c2a0 100644 --- a/board/ronetix/pm9261/led.c +++ b/board/ronetix/pm9261/led.c @@ -8,9 +8,9 @@ */
#include <common.h> +#include <asm/gpio.h> #include <asm/arch/at91_pmc.h> #include <asm/arch/gpio.h> -#include <asm/io.h>
void coloured_LED_init(void) { @@ -19,11 +19,11 @@ void coloured_LED_init(void) /* Enable clock */ writel(1 << ATMEL_ID_PIOC, &pmc->pcer);
- at91_set_pio_output(CONFIG_RED_LED, 1); - at91_set_pio_output(CONFIG_GREEN_LED, 1); - at91_set_pio_output(CONFIG_YELLOW_LED, 1); + gpio_direction_output(CONFIG_RED_LED, 1); + gpio_direction_output(CONFIG_GREEN_LED, 1); + gpio_direction_output(CONFIG_YELLOW_LED, 1);
- at91_set_pio_value(CONFIG_RED_LED, 0); - at91_set_pio_value(CONFIG_GREEN_LED, 1); - at91_set_pio_value(CONFIG_YELLOW_LED, 1); + gpio_set_value(CONFIG_RED_LED, 0); + gpio_set_value(CONFIG_GREEN_LED, 1); + gpio_set_value(CONFIG_YELLOW_LED, 1); } diff --git a/board/ronetix/pm9263/led.c b/board/ronetix/pm9263/led.c index 44e3430..bfc2310 100644 --- a/board/ronetix/pm9263/led.c +++ b/board/ronetix/pm9263/led.c @@ -8,9 +8,9 @@ */
#include <common.h> +#include <asm/gpio.h> #include <asm/arch/at91_pmc.h> #include <asm/arch/gpio.h> -#include <asm/io.h>
void coloured_LED_init(void) { @@ -19,9 +19,9 @@ void coloured_LED_init(void) /* Enable clock */ writel(1 << ATMEL_ID_PIOB, &pmc->pcer);
- at91_set_pio_output(CONFIG_RED_LED, 1); - at91_set_pio_output(CONFIG_GREEN_LED, 1); + gpio_direction_output(CONFIG_RED_LED, 1); + gpio_direction_output(CONFIG_GREEN_LED, 1);
- at91_set_pio_value(CONFIG_RED_LED, 0); - at91_set_pio_value(CONFIG_GREEN_LED, 1); + gpio_set_value(CONFIG_RED_LED, 0); + gpio_set_value(CONFIG_GREEN_LED, 1); } diff --git a/include/configs/pm9261.h b/include/configs/pm9261.h index 9442d8f..0f3cfba 100644 --- a/include/configs/pm9261.h +++ b/include/configs/pm9261.h @@ -166,9 +166,9 @@
/* LED */ #define CONFIG_AT91_LED -#define CONFIG_RED_LED AT91_PIO_PORTC, 12 -#define CONFIG_GREEN_LED AT91_PIO_PORTC, 13 -#define CONFIG_YELLOW_LED AT91_PIO_PORTC, 15 +#define CONFIG_RED_LED GPIO_PIN_PC(12) +#define CONFIG_GREEN_LED GPIO_PIN_PC(13) +#define CONFIG_YELLOW_LED GPIO_PIN_PC(15)
#define CONFIG_BOOTDELAY 3
diff --git a/include/configs/pm9263.h b/include/configs/pm9263.h index dffc336..d9c04d1 100644 --- a/include/configs/pm9263.h +++ b/include/configs/pm9263.h @@ -179,8 +179,8 @@
/* LED */ #define CONFIG_AT91_LED -#define CONFIG_RED_LED AT91_PIO_PORTB, 7 /* this is the power led */ -#define CONFIG_GREEN_LED AT91_PIO_PORTB, 8 /* this is the user1 led */ +#define CONFIG_RED_LED GPIO_PIN_PB(7) /* this is the power led */ +#define CONFIG_GREEN_LED GPIO_PIN_PB(8) /* this is the user1 led */
#define CONFIG_BOOTDELAY 3
diff --git a/include/configs/pm9g45.h b/include/configs/pm9g45.h index 03a25c8..f78e0ec 100644 --- a/include/configs/pm9g45.h +++ b/include/configs/pm9g45.h @@ -54,8 +54,8 @@
/* LED */ #define CONFIG_AT91_LED -#define CONFIG_RED_LED AT91_PIO_PORTD, 31 /* this is the user1 led */ -#define CONFIG_GREEN_LED AT91_PIO_PORTD, 0 /* this is the user2 led */ +#define CONFIG_RED_LED GPIO_PIN_PD(31) /* this is the user1 led */ +#define CONFIG_GREEN_LED GPIO_PIN_PD(0) /* this is the user2 led */
#define CONFIG_BOOTDELAY 3

Dear Andreas Devel,
Andreas Devel andreas.devel@googlemail.com writes:
Signed-off-by: Andreas Bießmann andreas.devel@googlemail.com
arch/arm/cpu/arm926ejs/at91/led.c | 16 +++++++--------- board/ronetix/pm9261/led.c | 14 +++++++------- board/ronetix/pm9263/led.c | 10 +++++----- include/configs/pm9261.h | 6 +++--- include/configs/pm9263.h | 4 ++-- include/configs/pm9g45.h | 4 ++-- 6 files changed, 26 insertions(+), 28 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann
participants (6)
-
Andreas Bießmann
-
Bo Shen
-
esw@bus-elektronik.de
-
Heiko Schocher
-
Jens Scharsig
-
Scott Wood