mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM OMAP: gpiolib fix chip.base
@ 2012-10-09  9:53 Teresa Gámez
  2012-10-09  9:53 ` [PATCH 2/3] ARM OMAP: Remove usage of gpio lib calls in lowlevel code Teresa Gámez
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Teresa Gámez @ 2012-10-09  9:53 UTC (permalink / raw)
  To: barebox; +Cc: vicencb


Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
---
@ Vicente: Please check if the patches fix your problem

 arch/arm/mach-omap/gpio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap/gpio.c b/arch/arm/mach-omap/gpio.c
index 376e9a7..49ffbda 100644
--- a/arch/arm/mach-omap/gpio.c
+++ b/arch/arm/mach-omap/gpio.c
@@ -133,7 +133,7 @@ static int omap_gpio_probe(struct device_d *dev)
 	omapgpio = xzalloc(sizeof(*omapgpio));
 	omapgpio->base = dev_request_mem_region(dev, 0);
 	omapgpio->chip.ops = &omap_gpio_ops;
-	omapgpio->chip.base = -1;
+	omapgpio->chip.base = dev->id * 32;
 	omapgpio->chip.ngpio = 32;
 	omapgpio->chip.dev = dev;
 	gpiochip_add(&omapgpio->chip);
-- 
1.7.0.4


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

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

* [PATCH 2/3] ARM OMAP: Remove usage of gpio lib calls in lowlevel code
  2012-10-09  9:53 [PATCH 1/3] ARM OMAP: gpiolib fix chip.base Teresa Gámez
@ 2012-10-09  9:53 ` Teresa Gámez
  2012-10-09 22:50   ` vj
  2012-10-09  9:53 ` [PATCH 3/3] ARM OMAP: change region size for gpio banks Teresa Gámez
  2012-10-10  7:32 ` [PATCH 1/3] ARM OMAP: gpiolib fix chip.base Sascha Hauer
  2 siblings, 1 reply; 5+ messages in thread
From: Teresa Gámez @ 2012-10-09  9:53 UTC (permalink / raw)
  To: barebox; +Cc: vicencb

As the gpio functions are not available at this point, set the gpio manually.

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
---
 arch/arm/mach-omap/omap4_generic.c |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index a159dfc..81b39f9 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -484,11 +484,27 @@ enum omap_boot_src omap4_bootsrc(void)
 	return OMAP_BOOTSRC_UNKNOWN;
 }
 
+#define GPIO_MASK 0x1f
+
+static void __iomem *omap4_get_gpio_base(unsigned gpio)
+{
+	void __iomem *base;
+
+	if (gpio < 32)
+		base = (void *)0x4a310000;
+	else
+		base = (void *)(0x48053000 + ((gpio & ~GPIO_MASK) << 8));
+
+	return base;
+}
+
 #define I2C_SLAVE 0x12
 
 noinline int omap4_scale_vcores(unsigned vsel0_pin)
 {
+	void __iomem *base;
 	unsigned int rev = omap4_revision();
+	u32 val = 0;
 
 	/* For VC bypass only VCOREx_CGF_FORCE  is necessary and
 	 * VCOREx_CFG_VOLTAGE  changes can be discarded
@@ -510,8 +526,17 @@ noinline int omap4_scale_vcores(unsigned vsel0_pin)
 		 * VSEL1 is grounded on board. So the following selects
 		 * VSEL1 = 0 and VSEL0 = 1
 		 */
-		gpio_direction_output(vsel0_pin, 0);
-		gpio_set_value(vsel0_pin, 1);
+		base = omap4_get_gpio_base(vsel0_pin);
+
+		val = 1 << (vsel0_pin & GPIO_MASK);
+		writel(val, base + 0x190);
+
+		val =  readl(base + 0x134);
+		val &= (1 << (vsel0_pin & GPIO_MASK));
+		writel(val, base + 0x134);
+
+		val = 1 << (vsel0_pin & GPIO_MASK);
+		writel(val, base + 0x194);
 	}
 
 	/* set VCORE1 force VSEL */
-- 
1.7.0.4


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

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

* [PATCH 3/3] ARM OMAP: change region size for gpio banks
  2012-10-09  9:53 [PATCH 1/3] ARM OMAP: gpiolib fix chip.base Teresa Gámez
  2012-10-09  9:53 ` [PATCH 2/3] ARM OMAP: Remove usage of gpio lib calls in lowlevel code Teresa Gámez
@ 2012-10-09  9:53 ` Teresa Gámez
  2012-10-10  7:32 ` [PATCH 1/3] ARM OMAP: gpiolib fix chip.base Sascha Hauer
  2 siblings, 0 replies; 5+ messages in thread
From: Teresa Gámez @ 2012-10-09  9:53 UTC (permalink / raw)
  To: barebox; +Cc: vicencb

- increased the region size for OMAP3, as it was not correct
- decrease region size for OMAP4 to prevent overlapping.

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
---
 arch/arm/mach-omap/omap3_generic.c |   12 ++++++------
 arch/arm/mach-omap/omap4_generic.c |   12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index 5028e9a..10eeacd 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -515,17 +515,17 @@ const struct gpmc_config omap3_nand_cfg = {
 static int omap3_gpio_init(void)
 {
 	add_generic_device("omap-gpio", 0, NULL, 0x48310000,
-					0x100, IORESOURCE_MEM, NULL);
+					0xf00, IORESOURCE_MEM, NULL);
 	add_generic_device("omap-gpio", 1, NULL, 0x49050000,
-					0x100, IORESOURCE_MEM, NULL);
+					0xf00, IORESOURCE_MEM, NULL);
 	add_generic_device("omap-gpio", 2, NULL, 0x49052000,
-					0x100, IORESOURCE_MEM, NULL);
+					0xf00, IORESOURCE_MEM, NULL);
 	add_generic_device("omap-gpio", 3, NULL, 0x49054000,
-					0x100, IORESOURCE_MEM, NULL);
+					0xf00, IORESOURCE_MEM, NULL);
 	add_generic_device("omap-gpio", 4, NULL, 0x49056000,
-					0x100, IORESOURCE_MEM, NULL);
+					0xf00, IORESOURCE_MEM, NULL);
 	add_generic_device("omap-gpio", 5, NULL, 0x49058000,
-					0x100, IORESOURCE_MEM, NULL);
+					0xf00, IORESOURCE_MEM, NULL);
 
 	return 0;
 }
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index 81b39f9..76134f2 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -601,17 +601,17 @@ const struct gpmc_config omap4_nand_cfg = {
 static int omap4_gpio_init(void)
 {
 	add_generic_device("omap-gpio", 0, NULL, 0x4a310100,
-				0x1000, IORESOURCE_MEM, NULL);
+				0xf00, IORESOURCE_MEM, NULL);
 	add_generic_device("omap-gpio", 1, NULL, 0x48055100,
-				0x1000, IORESOURCE_MEM, NULL);
+				0xf00, IORESOURCE_MEM, NULL);
 	add_generic_device("omap-gpio", 2, NULL, 0x48057100,
-				0x1000, IORESOURCE_MEM, NULL);
+				0xf00, IORESOURCE_MEM, NULL);
 	add_generic_device("omap-gpio", 3, NULL, 0x48059100,
-				0x1000, IORESOURCE_MEM, NULL);
+				0xf00, IORESOURCE_MEM, NULL);
 	add_generic_device("omap-gpio", 4, NULL, 0x4805b100,
-				0x1000, IORESOURCE_MEM, NULL);
+				0xf00, IORESOURCE_MEM, NULL);
 	add_generic_device("omap-gpio", 5, NULL, 0x4805d100,
-				0x1000, IORESOURCE_MEM, NULL);
+				0xf00, IORESOURCE_MEM, NULL);
 
 	return 0;
 }
-- 
1.7.0.4


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

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

* Re: [PATCH 2/3] ARM OMAP: Remove usage of gpio lib calls in lowlevel code
  2012-10-09  9:53 ` [PATCH 2/3] ARM OMAP: Remove usage of gpio lib calls in lowlevel code Teresa Gámez
@ 2012-10-09 22:50   ` vj
  0 siblings, 0 replies; 5+ messages in thread
From: vj @ 2012-10-09 22:50 UTC (permalink / raw)
  To: Teresa Gámez; +Cc: barebox

On Tue, Oct 9, 2012 at 11:53 AM, Teresa Gámez <t.gamez@phytec.de> wrote:
> As the gpio functions are not available at this point, set the gpio manually.
>
> Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
> ---
>  arch/arm/mach-omap/omap4_generic.c |   29 +++++++++++++++++++++++++++--
>  1 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
> index a159dfc..81b39f9 100644
> --- a/arch/arm/mach-omap/omap4_generic.c
> +++ b/arch/arm/mach-omap/omap4_generic.c
> @@ -484,11 +484,27 @@ enum omap_boot_src omap4_bootsrc(void)
>         return OMAP_BOOTSRC_UNKNOWN;
>  }
>
> +#define GPIO_MASK 0x1f
> +
> +static void __iomem *omap4_get_gpio_base(unsigned gpio)
> +{
> +       void __iomem *base;
> +
> +       if (gpio < 32)
> +               base = (void *)0x4a310000;
> +       else
> +               base = (void *)(0x48053000 + ((gpio & ~GPIO_MASK) << 8));
> +
> +       return base;
> +}
> +
>  #define I2C_SLAVE 0x12
>
>  noinline int omap4_scale_vcores(unsigned vsel0_pin)
>  {
> +       void __iomem *base;
>         unsigned int rev = omap4_revision();
> +       u32 val = 0;
>
>         /* For VC bypass only VCOREx_CGF_FORCE  is necessary and
>          * VCOREx_CFG_VOLTAGE  changes can be discarded
> @@ -510,8 +526,17 @@ noinline int omap4_scale_vcores(unsigned vsel0_pin)
>                  * VSEL1 is grounded on board. So the following selects
>                  * VSEL1 = 0 and VSEL0 = 1
>                  */
> -               gpio_direction_output(vsel0_pin, 0);
> -               gpio_set_value(vsel0_pin, 1);
> +               base = omap4_get_gpio_base(vsel0_pin);
> +
> +               val = 1 << (vsel0_pin & GPIO_MASK);
> +               writel(val, base + 0x190);
> +
> +               val =  readl(base + 0x134);
> +               val &= (1 << (vsel0_pin & GPIO_MASK));
> +               writel(val, base + 0x134);
> +
> +               val = 1 << (vsel0_pin & GPIO_MASK);
> +               writel(val, base + 0x194);
>         }
>
>         /* set VCORE1 force VSEL */
> --
> 1.7.0.4
>

Yes Teresa, this also works in my case.
Thanks,
  Vicente.

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

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

* Re: [PATCH 1/3] ARM OMAP: gpiolib fix chip.base
  2012-10-09  9:53 [PATCH 1/3] ARM OMAP: gpiolib fix chip.base Teresa Gámez
  2012-10-09  9:53 ` [PATCH 2/3] ARM OMAP: Remove usage of gpio lib calls in lowlevel code Teresa Gámez
  2012-10-09  9:53 ` [PATCH 3/3] ARM OMAP: change region size for gpio banks Teresa Gámez
@ 2012-10-10  7:32 ` Sascha Hauer
  2 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-10-10  7:32 UTC (permalink / raw)
  To: Teresa Gámez; +Cc: barebox, vicencb

On Tue, Oct 09, 2012 at 11:53:24AM +0200, Teresa Gámez wrote:
> 
> Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
> ---
> @ Vicente: Please check if the patches fix your problem
> 
>  arch/arm/mach-omap/gpio.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied this series to master.

Sascha

> 
> diff --git a/arch/arm/mach-omap/gpio.c b/arch/arm/mach-omap/gpio.c
> index 376e9a7..49ffbda 100644
> --- a/arch/arm/mach-omap/gpio.c
> +++ b/arch/arm/mach-omap/gpio.c
> @@ -133,7 +133,7 @@ static int omap_gpio_probe(struct device_d *dev)
>  	omapgpio = xzalloc(sizeof(*omapgpio));
>  	omapgpio->base = dev_request_mem_region(dev, 0);
>  	omapgpio->chip.ops = &omap_gpio_ops;
> -	omapgpio->chip.base = -1;
> +	omapgpio->chip.base = dev->id * 32;
>  	omapgpio->chip.ngpio = 32;
>  	omapgpio->chip.dev = dev;
>  	gpiochip_add(&omapgpio->chip);
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> 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] 5+ messages in thread

end of thread, other threads:[~2012-10-10  7:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-09  9:53 [PATCH 1/3] ARM OMAP: gpiolib fix chip.base Teresa Gámez
2012-10-09  9:53 ` [PATCH 2/3] ARM OMAP: Remove usage of gpio lib calls in lowlevel code Teresa Gámez
2012-10-09 22:50   ` vj
2012-10-09  9:53 ` [PATCH 3/3] ARM OMAP: change region size for gpio banks Teresa Gámez
2012-10-10  7:32 ` [PATCH 1/3] ARM OMAP: gpiolib fix chip.base Sascha Hauer

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