summaryrefslogtreecommitdiffstats
path: root/c/src
diff options
context:
space:
mode:
authorPavel Pisa <ppisa@pikron.com>2014-08-16 16:15:17 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-08-20 13:42:26 +0200
commit0a66c1266f1f0968345b2a0bcb7acbeeba0c1d82 (patch)
tree2783ca48daf0babc94eaa7b3aebddf5296ac2ea3 /c/src
parentscore: PR2179: Fix initially locked PI mutex (diff)
downloadrtems-0a66c1266f1f0968345b2a0bcb7acbeeba0c1d82.tar.bz2
lpc24xx/lpc17xx: lpc24xx_pin_set_function() keep LPC4088 W type pin in digital mode for non-analog function.
The problem wit incorrect switching of pins into analog mode manifestes on LPC4088 based board. LPC4088 implements pin P1.17 (ENET_MDIO) as new W type (digital pin with analog option). The pin was listed as D category on LPC1788 which does not have analog mode control bit. If analog option is not explicitly switched off on LPC4088 then the pin does not work as digital pin. Code tested on LPC1788 and no problems has been observed even that manual specifies the IOCON_ADMODE field as reserved and should be written as zero. But even RTEMS lpc24xx_gpio_config sets this bit unconditionally. Signed-off-by: Pavel Pisa <ppisa@pikron.com>
Diffstat (limited to 'c/src')
-rw-r--r--c/src/lib/libbsp/arm/lpc24xx/misc/io.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/c/src/lib/libbsp/arm/lpc24xx/misc/io.c b/c/src/lib/libbsp/arm/lpc24xx/misc/io.c
index 45e0c948a3..c28b5182f0 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/misc/io.c
+++ b/c/src/lib/libbsp/arm/lpc24xx/misc/io.c
@@ -395,9 +395,14 @@ lpc24xx_pin_set_function(
rtems_interrupt_enable(level);
#else
uint32_t iocon_extra = 0;
+ uint32_t iocon_not_analog = IOCON_ADMODE;
/* TODO */
switch (pin_range.fields.type) {
+ case LPC17XX_PIN_TYPE_ADC:
+ case LPC17XX_PIN_TYPE_DAC:
+ iocon_not_analog = 0;
+ break;
case LPC17XX_PIN_TYPE_I2C_FAST_PLUS:
iocon_extra |= IOCON_HS;
break;
@@ -408,7 +413,7 @@ lpc24xx_pin_set_function(
break;
}
- *iocon = IOCON_FUNC(pin_range.fields.function) | iocon_extra;
+ *iocon = IOCON_FUNC(pin_range.fields.function) | iocon_extra | iocon_not_analog;
#endif
return RTEMS_SUCCESSFUL;