summaryrefslogtreecommitdiff
path: root/include/asm-ppc
diff options
context:
space:
mode:
authorLawrence R. Johnson <lrj@acm.org>2008-01-03 18:54:00 -0500
committerStefan Roese <sr@denx.de>2008-01-04 11:38:45 +0100
commit5ab884b254ca2e707ab50545cd705f30108cf491 (patch)
treefa6a58b9ed000c496f2b4fc77f9605eaebcfe3b0 /include/asm-ppc
parent196404cdc1de495d6182e84731c200fc5748df15 (diff)
downloadu-boot-imx-5ab884b254ca2e707ab50545cd705f30108cf491.zip
u-boot-imx-5ab884b254ca2e707ab50545cd705f30108cf491.tar.gz
u-boot-imx-5ab884b254ca2e707ab50545cd705f30108cf491.tar.bz2
ppc4xx: Add functionality to GPIO support
This patch makes two additions to GPIO support: First, it adds function gpio_read_in_bit() to read the a bit from the GPIO Input Register (GPIOx_IR) in the same way that function gpio_read_out_bit() reads a bit from the GPIO Output Register (GPIOx_OR). Second, it modifies function gpio_set_chip_configuration() to provide an additional option for configuring the GPIO from the "CFG_4xx_GPIO_TABLE". According to the 440EPx User's Manual, when an alternate output is used, the three-state control is configured in one of two ways, depending on the particular output. The first option is to select the corresponding alternate three-state control in the GPIOx_TRSH/L registers. The second option is to select the GPIO Three-State Control Register (GPIOx_TCR) in the GPIOx_TRSH/L registers, and set the corresponding bit in the GPIOx_TCR register to enable the output. For example, the Manual specifies configuring the GPIO00 Alternate 1 Signal (PreAddr07) to use the alternate three-state control (first option), and specifies configuring the GPIO32 Alternate 1 Signal (USB2OM0) with the output enabled in the GPIOx_TCR register (second option). Currently, gpio_set_chip_configuration() configures all alternate signal outputs to use the first option. This patch allow the second option to be selected by setting the "out_val" element in the table entry to "GPIO_OUT_1". The first option is used when the "out_val" element is set to "GPIO_OUT_0". Because "out_val" is not currently used when an alternate signal is selected, and because all current GPIO tables set "out_val" to "GPIO_OUT_0" for all alternate signals, this patch should not change any existing configurations. Signed-off-by: Larry Johnson <lrj@acm.org>
Diffstat (limited to 'include/asm-ppc')
-rw-r--r--include/asm-ppc/gpio.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/asm-ppc/gpio.h b/include/asm-ppc/gpio.h
index d0c3eba..c3a4a88 100644
--- a/include/asm-ppc/gpio.h
+++ b/include/asm-ppc/gpio.h
@@ -88,6 +88,7 @@ typedef struct {
void gpio_config(int pin, int in_out, int gpio_alt, int out_val);
void gpio_write_bit(int pin, int val);
int gpio_read_out_bit(int pin);
+int gpio_read_in_bit(int pin);
void gpio_set_chip_configuration(void);
#endif /* __ASM_PPC_GPIO_H */