aboutsummaryrefslogtreecommitdiff
path: root/board/gdsys
diff options
context:
space:
mode:
authorMario Six2019-03-29 10:18:07 +0100
committerMario Six2019-05-21 08:03:38 +0200
commitb12b545836746217e9f417bd5c3b13557a201a34 (patch)
tree8c3726a702bd21511638e99cd6a3a73631197d21 /board/gdsys
parent9c454827f1d1939032ea2b7811a8e674655d58fb (diff)
gdsys: mpc8308: Use shadow register for output GPIO values
Since the gpio output status on MPC8xxx cannot be read back, it has to be buffered locally. Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc> Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'board/gdsys')
-rw-r--r--board/gdsys/mpc8308/hrcon.c4
-rw-r--r--board/gdsys/mpc8308/mpc8308.c19
-rw-r--r--board/gdsys/mpc8308/mpc8308.h3
-rw-r--r--board/gdsys/mpc8308/strider.c2
4 files changed, 25 insertions, 3 deletions
diff --git a/board/gdsys/mpc8308/hrcon.c b/board/gdsys/mpc8308/hrcon.c
index 79e3b25de8c..d14a28ec94d 100644
--- a/board/gdsys/mpc8308/hrcon.c
+++ b/board/gdsys/mpc8308/hrcon.c
@@ -287,8 +287,8 @@ void mpc8308_setup_hw(void)
/*
* set "startup-finished"-gpios
*/
- setbits_be32(&immr->gpio[0].dir, (BIT(31 - 11) | BIT(31 - 12)));
- setbits_be32(&immr->gpio[0].dat, BIT(31 - 12));
+ setbits_be32(&immr->gpio[0].dir, BIT(31 - 11) | BIT(31 - 12));
+ setbits_gpio0_out(BIT(31 - 12));
}
int mpc8308_get_fpga_done(uint fpga)
diff --git a/board/gdsys/mpc8308/mpc8308.c b/board/gdsys/mpc8308/mpc8308.c
index 9fe1d66c605..a53135b8fd0 100644
--- a/board/gdsys/mpc8308/mpc8308.c
+++ b/board/gdsys/mpc8308/mpc8308.c
@@ -24,6 +24,25 @@
DECLARE_GLOBAL_DATA_PTR;
+/* as gpio output status cannot be read back, we have to buffer it locally */
+u32 gpio0_out;
+
+void setbits_gpio0_out(u32 mask)
+{
+ immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+
+ gpio0_out |= mask;
+ out_be32(&immr->gpio[0].dat, gpio0_out);
+}
+
+void clrbits_gpio0_out(u32 mask)
+{
+ immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+
+ gpio0_out &= ~mask;
+ out_be32(&immr->gpio[0].dat, gpio0_out);
+}
+
int get_fpga_state(uint dev)
{
return gd->arch.fpga_state[dev];
diff --git a/board/gdsys/mpc8308/mpc8308.h b/board/gdsys/mpc8308/mpc8308.h
index dc07d564eb5..1e4f24fb2ae 100644
--- a/board/gdsys/mpc8308/mpc8308.h
+++ b/board/gdsys/mpc8308/mpc8308.h
@@ -1,6 +1,9 @@
#ifndef __MPC8308_H_
#define __MPC8308_H_
+void setbits_gpio0_out(u32 mask);
+void clrbits_gpio0_out(u32 mask);
+
/* functions to be provided by board implementation */
void mpc8308_init(void);
void mpc8308_set_fpga_reset(unsigned state);
diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c
index b1997f453ae..1fdea675bda 100644
--- a/board/gdsys/mpc8308/strider.c
+++ b/board/gdsys/mpc8308/strider.c
@@ -343,7 +343,7 @@ void mpc8308_setup_hw(void)
* set "startup-finished"-gpios
*/
setbits_be32(&immr->gpio[0].dir, BIT(31 - 11) | BIT(31 - 12));
- setbits_be32(&immr->gpio[0].dat, BIT(31 - 12));
+ setbits_gpio0_out(BIT(31 - 12));
}
int mpc8308_get_fpga_done(uint fpga)