* [PATCH] mx2 GPIO OCRx register
@ 2010-06-08 10:03 Teresa Gamez
2010-06-10 11:54 ` Sascha Hauer
0 siblings, 1 reply; 4+ messages in thread
From: Teresa Gamez @ 2010-06-08 10:03 UTC (permalink / raw)
To: barebox
The GPIO OCRx register has to be set correct or the output is not set as expected.
Signed-off-by: Teresa Gámez <T.Gamez@phytec.de>
---
Index: barebox-2010.06.0/arch/arm/mach-imx/gpio.c
===================================================================
--- barebox-2010.06.0/arch/arm/mach-imx/gpio.c 2010-06-02 10:36:28.000000000 +0200
+++ barebox-2010.06.0/arch/arm/mach-imx/gpio.c 2010-06-08 11:02:31.282473877 +0200
@@ -31,6 +31,8 @@
#if defined CONFIG_ARCH_IMX1 || defined CONFIG_ARCH_IMX21 || defined CONFIG_ARCH_IMX27
#define GPIO_DR 0x1c
#define GPIO_GDIR 0x00
+#define GPIO_OCR1 0x04
+#define GPIO_OCR2 0x08
#define GPIO_PSR 0x24
#define GPIO_ICR1 0x28
#define GPIO_ICR2 0x2C
@@ -103,6 +105,18 @@
if (!base)
return -EINVAL;
+#if defined GPIO_OCR1 && defined GPIO_OCR2
+ if (shift < 16) {
+ val = readl(base + GPIO_OCR1);
+ val |= (3 << (shift * 2));
+ writel(val, base + GPIO_OCR1);
+ } else {
+ val = readl(base + GPIO_OCR2);
+ val |= (3 << ((shift - 16) * 2));
+ writel(val, base + GPIO_OCR2);
+ }
+#endif
+
gpio_set_value(gpio, value);
val = readl(base + GPIO_GDIR);
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mx2 GPIO OCRx register
2010-06-08 10:03 [PATCH] mx2 GPIO OCRx register Teresa Gamez
@ 2010-06-10 11:54 ` Sascha Hauer
2010-06-18 11:41 ` Teresa Gamez
0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2010-06-10 11:54 UTC (permalink / raw)
To: Teresa Gamez; +Cc: barebox
Hi Teresa,
On Tue, Jun 08, 2010 at 12:03:02PM +0200, Teresa Gamez wrote:
> The GPIO OCRx register has to be set correct or the output is not set as expected.
No. The gpio functions are not expected to change the iomuxer. This is
what imx_gpio_mode() is for.
Sascha
>
> Signed-off-by: Teresa Gámez <T.Gamez@phytec.de>
> ---
> Index: barebox-2010.06.0/arch/arm/mach-imx/gpio.c
> ===================================================================
> --- barebox-2010.06.0/arch/arm/mach-imx/gpio.c 2010-06-02 10:36:28.000000000 +0200
> +++ barebox-2010.06.0/arch/arm/mach-imx/gpio.c 2010-06-08 11:02:31.282473877 +0200
> @@ -31,6 +31,8 @@
> #if defined CONFIG_ARCH_IMX1 || defined CONFIG_ARCH_IMX21 || defined CONFIG_ARCH_IMX27
> #define GPIO_DR 0x1c
> #define GPIO_GDIR 0x00
> +#define GPIO_OCR1 0x04
> +#define GPIO_OCR2 0x08
> #define GPIO_PSR 0x24
> #define GPIO_ICR1 0x28
> #define GPIO_ICR2 0x2C
> @@ -103,6 +105,18 @@
> if (!base)
> return -EINVAL;
>
> +#if defined GPIO_OCR1 && defined GPIO_OCR2
> + if (shift < 16) {
> + val = readl(base + GPIO_OCR1);
> + val |= (3 << (shift * 2));
> + writel(val, base + GPIO_OCR1);
> + } else {
> + val = readl(base + GPIO_OCR2);
> + val |= (3 << ((shift - 16) * 2));
> + writel(val, base + GPIO_OCR2);
> + }
> +#endif
> +
> gpio_set_value(gpio, value);
>
> val = readl(base + GPIO_GDIR);
>
>
> _______________________________________________
> 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] 4+ messages in thread
* Re: [PATCH] mx2 GPIO OCRx register
2010-06-10 11:54 ` Sascha Hauer
@ 2010-06-18 11:41 ` Teresa Gamez
2010-06-18 12:48 ` Sascha Hauer
0 siblings, 1 reply; 4+ messages in thread
From: Teresa Gamez @ 2010-06-18 11:41 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hello Sascha,
is it reasonable to create a gpio_mode commad then? Or is there an other
way to do this in the barebox shell?
Teresa
Am Donnerstag, den 10.06.2010, 13:54 +0200 schrieb Sascha Hauer:
> Hi Teresa,
>
> On Tue, Jun 08, 2010 at 12:03:02PM +0200, Teresa Gamez wrote:
> > The GPIO OCRx register has to be set correct or the output is not set as expected.
>
> No. The gpio functions are not expected to change the iomuxer. This is
> what imx_gpio_mode() is for.
>
> Sascha
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mx2 GPIO OCRx register
2010-06-18 11:41 ` Teresa Gamez
@ 2010-06-18 12:48 ` Sascha Hauer
0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2010-06-18 12:48 UTC (permalink / raw)
To: Teresa Gamez; +Cc: barebox
Hello Teresa,
On Fri, Jun 18, 2010 at 01:41:42PM +0200, Teresa Gamez wrote:
> Hello Sascha,
>
> is it reasonable to create a gpio_mode commad then? Or is there an other
> way to do this in the barebox shell?
A gpio_mode command should be fine. Maybe something like
'mux_mode <pin_no> <mode>'. We could then put a list of variables
into the environment:
PC5_PF_I2C2_SDA="69 0"
Sascha
--
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] 4+ messages in thread
end of thread, other threads:[~2010-06-18 12:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-08 10:03 [PATCH] mx2 GPIO OCRx register Teresa Gamez
2010-06-10 11:54 ` Sascha Hauer
2010-06-18 11:41 ` Teresa Gamez
2010-06-18 12:48 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox