mx2 GPIO OCRx register
Subsystems (3)
PATCH 1/1 mx2 GPIO OCRx register
The GPIO OCRx register has to be set correct or the output is not set as expected.
---
arch/arm/mach-imx/gpio.c +14 -0
@@ -31,6 +31,8 @@#if definedCONFIG_ARCH_IMX1 || definedCONFIG_ARCH_IMX21 || definedCONFIG_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 definedGPIO_OCR1 && definedGPIO_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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerHi Teresa,
Quoted 1 line · Teresa Gamez
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
Quoted 41 lines
Signed-off-by Teresa Gámez <[email protected]>---
Index:barebox-2010.06.0/arch/arm/mach-imx/gpio.c
===================================================================arch/arm/mach-imx/gpio.c +14
-0@@ -31,6 +31,8 @@#if definedCONFIG_ARCH_IMX1 || definedCONFIG_ARCH_IMX21 || definedCONFIG_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 definedGPIO_OCR1 && definedGPIO_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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/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:
Quoted 9 lines
Hi Teresa,
Quoted 1 line · Teresa Gamez
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
maintainerHello Teresa,
Quoted 4 lines · Teresa Gamez
Hello Sascha,
is it reasonable to create a
gpio_modecommad 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
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox