summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Brunck <holger.brunck@keymile.com>2015-11-17 10:53:25 +0100
committerTom Rini <trini@konsulko.com>2015-11-18 15:28:52 -0500
commit74edc607d6cd6102ac181232c5bb6562a733ea7b (patch)
tree12f780e8cc4dfe3141ecf0b9988cc138bb85cc20
parentc1e121e4bda65e2e8fa4df3ed5001a2aee123216 (diff)
downloadu-boot-imx-74edc607d6cd6102ac181232c5bb6562a733ea7b.zip
u-boot-imx-74edc607d6cd6102ac181232c5bb6562a733ea7b.tar.gz
u-boot-imx-74edc607d6cd6102ac181232c5bb6562a733ea7b.tar.bz2
powerpc/82xx: make set/get_pin for km82xx more flexible
The get_pin and set_pin funciton was only used for pins on Port D and therefore the value was hard coded in the function. Enhance this with a parameter, that we are able to use this functions for other ports too. Signed-off-by: Holger Brunck <holger.brunck@keymile.com> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
-rw-r--r--board/keymile/km82xx/km82xx.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index c599b40..03cd10c 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -343,7 +343,7 @@ int last_stage_init(void)
}
#ifdef CONFIG_MGCOGE3NE
-static void set_pin(int state, unsigned long mask);
+static void set_pin(int state, unsigned long mask, int port);
/*
* For mgcoge3ne boards, the mgcoge3un control is controlled from
@@ -357,11 +357,11 @@ static void handle_mgcoge3un_reset(void)
if (bobcatreset) {
if (strcmp(bobcatreset, "true") == 0) {
puts("Forcing bobcat reset\n");
- set_pin(0, 0x00000004); /* clear PD29 to reset arm */
+ set_pin(0, 0x00000004, 3); /* clear PD29 (reset arm) */
udelay(1000);
- set_pin(1, 0x00000004);
+ set_pin(1, 0x00000004, 3);
} else
- set_pin(1, 0x00000004); /* set PD29 to not reset arm */
+ set_pin(1, 0x00000004, 3); /* don't reset arm */
}
}
#endif
@@ -410,9 +410,9 @@ int hush_init_var(void)
#define SDA_MASK 0x00010000
#define SCL_MASK 0x00020000
-static void set_pin(int state, unsigned long mask)
+static void set_pin(int state, unsigned long mask, int port)
{
- ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
+ ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, port);
if (state)
setbits_be32(&iop->pdat, mask);
@@ -422,9 +422,9 @@ static void set_pin(int state, unsigned long mask)
setbits_be32(&iop->pdir, mask);
}
-static int get_pin(unsigned long mask)
+static int get_pin(unsigned long mask, int port)
{
- ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
+ ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, port);
clrbits_be32(&iop->pdir, mask);
return 0 != (in_be32(&iop->pdat) & mask);
@@ -432,22 +432,22 @@ static int get_pin(unsigned long mask)
void set_sda(int state)
{
- set_pin(state, SDA_MASK);
+ set_pin(state, SDA_MASK, 3);
}
void set_scl(int state)
{
- set_pin(state, SCL_MASK);
+ set_pin(state, SCL_MASK, 3);
}
int get_sda(void)
{
- return get_pin(SDA_MASK);
+ return get_pin(SDA_MASK, 3);
}
int get_scl(void)
{
- return get_pin(SCL_MASK);
+ return get_pin(SCL_MASK, 3);
}
#if defined(CONFIG_HARD_I2C)