diff mbox

[U-Boot,v2,4/9] dm: at91: Add platform data for GPIO on at91sam9260-based boards

Message ID 1414609743-19092-5-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Oct. 29, 2014, 7:08 p.m. UTC
These boards all have the same GPIO arrangement, so add some common platform
data that can be used by all boards. Remove the configs which are no longer
required.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Use PA/PB/PC instead of A/B/C for GPIO port names

 arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c | 14 ++++++++++++++
 arch/arm/include/asm/arch-at91/at91sam9260.h      |  4 +++-
 2 files changed, 17 insertions(+), 1 deletion(-)

Comments

Simon Glass Nov. 23, 2014, 12:55 p.m. UTC | #1
On 29 October 2014 at 20:08, Simon Glass <sjg@chromium.org> wrote:
> These boards all have the same GPIO arrangement, so add some common platform
> data that can be used by all boards. Remove the configs which are no longer
> required.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Use PA/PB/PC instead of A/B/C for GPIO port names
>
>  arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c | 14 ++++++++++++++
>  arch/arm/include/asm/arch-at91/at91sam9260.h      |  4 +++-
>  2 files changed, 17 insertions(+), 1 deletion(-)

Applied to u-boot-dm.
diff mbox

Patch

diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c
index cae4abc..840edd5 100644
--- a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c
+++ b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c
@@ -7,6 +7,7 @@ 
  */
 
 #include <common.h>
+#include <dm.h>
 #include <asm/io.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pmc.h>
@@ -207,3 +208,16 @@  void at91_mci_hw_init(void)
 #endif
 }
 #endif
+
+/* Platform data for the GPIOs */
+static const struct at91_port_platdata at91sam9260_plat[] = {
+	{ ATMEL_BASE_PIOA, "PA" },
+	{ ATMEL_BASE_PIOB, "PB" },
+	{ ATMEL_BASE_PIOC, "PC" },
+};
+
+U_BOOT_DEVICES(at91sam9260_gpios) = {
+	{ "gpio_at91", &at91sam9260_plat[0] },
+	{ "gpio_at91", &at91sam9260_plat[1] },
+	{ "gpio_at91", &at91sam9260_plat[2] },
+};
diff --git a/arch/arm/include/asm/arch-at91/at91sam9260.h b/arch/arm/include/asm/arch-at91/at91sam9260.h
index 2e902ee..4d46def 100644
--- a/arch/arm/include/asm/arch-at91/at91sam9260.h
+++ b/arch/arm/include/asm/arch-at91/at91sam9260.h
@@ -136,9 +136,11 @@ 
 /*
  * Other misc defines
  */
+#ifndef CONFIG_DM_GPIO
 #define ATMEL_PIO_PORTS		3		/* these SoCs have 3 PIO */
-#define ATMEL_PMC_UHP		AT91SAM926x_PMC_UHP
 #define ATMEL_BASE_PIO		ATMEL_BASE_PIOA
+#endif
+#define ATMEL_PMC_UHP		AT91SAM926x_PMC_UHP
 
 /*
  * SoC specific defines