mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Define and use OMAP4 GPIO macros rather than magic constants.
@ 2012-12-05 14:34 Robert P. J. Day
  2012-12-05 18:55 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Robert P. J. Day @ 2012-12-05 14:34 UTC (permalink / raw)
  To: U-Boot Version 2 (barebox)


Add and use meaningful macro names for OMAP4 GPIO addresses, and add a
comment to explain the 0x100 offset for OMAP4.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

---

diff --git a/arch/arm/mach-omap/include/mach/omap4-silicon.h b/arch/arm/mach-omap/include/mach/omap4-silicon.h
index 71ffe39..008eafb 100644
--- a/arch/arm/mach-omap/include/mach/omap4-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap4-silicon.h
@@ -101,6 +101,21 @@
 #define OMAP44XX_MMC4_BASE		(OMAP44XX_L4_PER_BASE + 0x0D1100)
 #define OMAP44XX_MMC5_BASE		(OMAP44XX_L4_PER_BASE + 0x0D5100)

+/* GPIO
+ *
+ *  Note that, while the GPIO controller is the same as on an OMAP3,
+ * the base address has an additional offset of 0x100, which you can
+ * see being added here so that the OMAP_GPIO_* macros you see in
+ * mach-omap/gpio.c don't need to be adjusted based on the platform.
+ */
+
+#define OMAP44XX_GPIO1_BASE		(OMAP44XX_L4_WKUP_BASE + 0x10100)
+#define OMAP44XX_GPIO2_BASE		(OMAP44XX_L4_PER_BASE  + 0x55100)
+#define OMAP44XX_GPIO3_BASE		(OMAP44XX_L4_PER_BASE  + 0x57100)
+#define OMAP44XX_GPIO4_BASE		(OMAP44XX_L4_PER_BASE  + 0x59100)
+#define OMAP44XX_GPIO5_BASE		(OMAP44XX_L4_PER_BASE  + 0x5B100)
+#define OMAP44XX_GPIO6_BASE		(OMAP44XX_L4_PER_BASE  + 0x5D100)
+
 /* GPMC */
 #define OMAP_GPMC_BASE		0x50000000

diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index c756664..dc1dbae 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -611,17 +611,17 @@ const struct gpmc_config omap4_nand_cfg = {

 static int omap4_gpio_init(void)
 {
-	add_generic_device("omap-gpio", 0, NULL, 0x4a310100,
+	add_generic_device("omap-gpio", 0, NULL, OMAP44XX_GPIO1_BASE,
 				0xf00, IORESOURCE_MEM, NULL);
-	add_generic_device("omap-gpio", 1, NULL, 0x48055100,
+	add_generic_device("omap-gpio", 1, NULL, OMAP44XX_GPIO2_BASE,
 				0xf00, IORESOURCE_MEM, NULL);
-	add_generic_device("omap-gpio", 2, NULL, 0x48057100,
+	add_generic_device("omap-gpio", 2, NULL, OMAP44XX_GPIO3_BASE,
 				0xf00, IORESOURCE_MEM, NULL);
-	add_generic_device("omap-gpio", 3, NULL, 0x48059100,
+	add_generic_device("omap-gpio", 3, NULL, OMAP44XX_GPIO4_BASE,
 				0xf00, IORESOURCE_MEM, NULL);
-	add_generic_device("omap-gpio", 4, NULL, 0x4805b100,
+	add_generic_device("omap-gpio", 4, NULL, OMAP44XX_GPIO5_BASE,
 				0xf00, IORESOURCE_MEM, NULL);
-	add_generic_device("omap-gpio", 5, NULL, 0x4805d100,
+	add_generic_device("omap-gpio", 5, NULL, OMAP44XX_GPIO6_BASE,
 				0xf00, IORESOURCE_MEM, NULL);

 	return 0;

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Define and use OMAP4 GPIO macros rather than magic constants.
  2012-12-05 14:34 [PATCH] Define and use OMAP4 GPIO macros rather than magic constants Robert P. J. Day
@ 2012-12-05 18:55 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2012-12-05 18:55 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: U-Boot Version 2 (barebox)

On Wed, Dec 05, 2012 at 09:34:12AM -0500, Robert P. J. Day wrote:
> 
> Add and use meaningful macro names for OMAP4 GPIO addresses, and add a
> comment to explain the 0x100 offset for OMAP4.
> 
> Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

Applied, thanks

Sascha

> 
> ---
> 
> diff --git a/arch/arm/mach-omap/include/mach/omap4-silicon.h b/arch/arm/mach-omap/include/mach/omap4-silicon.h
> index 71ffe39..008eafb 100644
> --- a/arch/arm/mach-omap/include/mach/omap4-silicon.h
> +++ b/arch/arm/mach-omap/include/mach/omap4-silicon.h
> @@ -101,6 +101,21 @@
>  #define OMAP44XX_MMC4_BASE		(OMAP44XX_L4_PER_BASE + 0x0D1100)
>  #define OMAP44XX_MMC5_BASE		(OMAP44XX_L4_PER_BASE + 0x0D5100)
> 
> +/* GPIO
> + *
> + *  Note that, while the GPIO controller is the same as on an OMAP3,
> + * the base address has an additional offset of 0x100, which you can
> + * see being added here so that the OMAP_GPIO_* macros you see in
> + * mach-omap/gpio.c don't need to be adjusted based on the platform.
> + */
> +
> +#define OMAP44XX_GPIO1_BASE		(OMAP44XX_L4_WKUP_BASE + 0x10100)
> +#define OMAP44XX_GPIO2_BASE		(OMAP44XX_L4_PER_BASE  + 0x55100)
> +#define OMAP44XX_GPIO3_BASE		(OMAP44XX_L4_PER_BASE  + 0x57100)
> +#define OMAP44XX_GPIO4_BASE		(OMAP44XX_L4_PER_BASE  + 0x59100)
> +#define OMAP44XX_GPIO5_BASE		(OMAP44XX_L4_PER_BASE  + 0x5B100)
> +#define OMAP44XX_GPIO6_BASE		(OMAP44XX_L4_PER_BASE  + 0x5D100)
> +
>  /* GPMC */
>  #define OMAP_GPMC_BASE		0x50000000
> 
> diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
> index c756664..dc1dbae 100644
> --- a/arch/arm/mach-omap/omap4_generic.c
> +++ b/arch/arm/mach-omap/omap4_generic.c
> @@ -611,17 +611,17 @@ const struct gpmc_config omap4_nand_cfg = {
> 
>  static int omap4_gpio_init(void)
>  {
> -	add_generic_device("omap-gpio", 0, NULL, 0x4a310100,
> +	add_generic_device("omap-gpio", 0, NULL, OMAP44XX_GPIO1_BASE,
>  				0xf00, IORESOURCE_MEM, NULL);
> -	add_generic_device("omap-gpio", 1, NULL, 0x48055100,
> +	add_generic_device("omap-gpio", 1, NULL, OMAP44XX_GPIO2_BASE,
>  				0xf00, IORESOURCE_MEM, NULL);
> -	add_generic_device("omap-gpio", 2, NULL, 0x48057100,
> +	add_generic_device("omap-gpio", 2, NULL, OMAP44XX_GPIO3_BASE,
>  				0xf00, IORESOURCE_MEM, NULL);
> -	add_generic_device("omap-gpio", 3, NULL, 0x48059100,
> +	add_generic_device("omap-gpio", 3, NULL, OMAP44XX_GPIO4_BASE,
>  				0xf00, IORESOURCE_MEM, NULL);
> -	add_generic_device("omap-gpio", 4, NULL, 0x4805b100,
> +	add_generic_device("omap-gpio", 4, NULL, OMAP44XX_GPIO5_BASE,
>  				0xf00, IORESOURCE_MEM, NULL);
> -	add_generic_device("omap-gpio", 5, NULL, 0x4805d100,
> +	add_generic_device("omap-gpio", 5, NULL, OMAP44XX_GPIO6_BASE,
>  				0xf00, IORESOURCE_MEM, NULL);
> 
>  	return 0;
> 
> -- 
> 
> ========================================================================
> Robert P. J. Day                                 Ottawa, Ontario, CANADA
>                         http://crashcourse.ca
> 
> Twitter:                                       http://twitter.com/rpjday
> LinkedIn:                               http://ca.linkedin.com/in/rpjday
> ========================================================================
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-05 18:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-05 14:34 [PATCH] Define and use OMAP4 GPIO macros rather than magic constants Robert P. J. Day
2012-12-05 18:55 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox