summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/gpio.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-10-08 00:11:29 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2007-10-08 00:11:29 +0200
commitc00393f996494a1f6357afc43c963f58247288d0 (patch)
treed9399000ac761d9768a3d4e609793f2facf3a528 /arch/arm/mach-imx/gpio.c
parentb5a1e4366099f7b0ed77a7d0e2de4927fdffe635 (diff)
downloadbarebox-c00393f996494a1f6357afc43c963f58247288d0.tar.gz
barebox-c00393f996494a1f6357afc43c963f58247288d0.tar.xz
against high density code
Diffstat (limited to 'arch/arm/mach-imx/gpio.c')
-rw-r--r--arch/arm/mach-imx/gpio.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/arch/arm/mach-imx/gpio.c b/arch/arm/mach-imx/gpio.c
index 8b1cfcbb6d..9e667e32e5 100644
--- a/arch/arm/mach-imx/gpio.c
+++ b/arch/arm/mach-imx/gpio.c
@@ -35,52 +35,54 @@ void imx_gpio_mode(int gpio_mode)
/* Pullup enable */
if(gpio_mode & GPIO_PUEN)
- PUEN(port) |= (1<<pin);
+ PUEN(port) |= (1 << pin);
else
- PUEN(port) &= ~(1<<pin);
+ PUEN(port) &= ~(1 << pin);
/* Data direction */
if(gpio_mode & GPIO_OUT)
- DDIR(port) |= 1<<pin;
+ DDIR(port) |= 1 << pin;
else
- DDIR(port) &= ~(1<<pin);
+ DDIR(port) &= ~(1 << pin);
/* Primary / alternate function */
if(gpio_mode & GPIO_AF)
- GPR(port) |= (1<<pin);
+ GPR(port) |= (1 << pin);
else
- GPR(port) &= ~(1<<pin);
+ GPR(port) &= ~(1 << pin);
/* use as gpio? */
if( ocr == 3 )
- GIUS(port) |= (1<<pin);
+ GIUS(port) |= (1 << pin);
else
- GIUS(port) &= ~(1<<pin);
+ GIUS(port) &= ~(1 << pin);
/* Output / input configuration */
/* FIXME: I'm not very sure about OCR and ICONF, someone
* should have a look over it
*/
- if(pin<16) {
+ if (pin < 16) {
tmp = OCR1(port);
- tmp &= ~( 3<<(pin*2));
- tmp |= (ocr << (pin*2));
+ tmp &= ~(3 << (pin * 2));
+ tmp |= (ocr << (pin * 2));
OCR1(port) = tmp;
if( gpio_mode & GPIO_AOUT )
- ICONFA1(port) &= ~( 3<<(pin*2));
+ ICONFA1(port) &= ~(3 << (pin * 2));
if( gpio_mode & GPIO_BOUT )
- ICONFB1(port) &= ~( 3<<(pin*2));
+ ICONFB1(port) &= ~(3 << (pin * 2));
} else {
+ pin -= 16;
+
tmp = OCR2(port);
- tmp &= ~( 3<<((pin-16)*2));
- tmp |= (ocr << ((pin-16)*2));
+ tmp &= ~(3 << (pin * 2));
+ tmp |= (ocr << (pin * 2));
OCR2(port) = tmp;
if( gpio_mode & GPIO_AOUT )
- ICONFA2(port) &= ~( 3<<((pin-16)*2));
+ ICONFA2(port) &= ~(3 << (pin * 2));
if( gpio_mode & GPIO_BOUT )
- ICONFB2(port) &= ~( 3<<((pin-16)*2));
+ ICONFB2(port) &= ~(3 << (pin * 2));
}
}