summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Redfearn <matt.redfearn@imgtec.com>2015-08-17 17:12:03 +0300
committerMatt Redfearn <matt.redfearn@imgtec.com>2015-08-17 17:12:03 +0300
commit6fa087dad330e2ea1ccc1fa4527b3f2d99c6348d (patch)
treef0fa761fab26aa29e2fdffbfaf1efe51879a3ce7
parent36f8a726856009948d41c63a2facf4216c45a296 (diff)
downloadCI20_u-boot-6fa087dad330e2ea1ccc1fa4527b3f2d99c6348d.tar.xz
Make revision detection a function rather than setting
a global flag as global data does not work in the SPL Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
-rw-r--r--board/imgtec/ci20/ci20.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/board/imgtec/ci20/ci20.c b/board/imgtec/ci20/ci20.c
index 3d8dfe838..538b371fc 100644
--- a/board/imgtec/ci20/ci20.c
+++ b/board/imgtec/ci20/ci20.c
@@ -34,8 +34,6 @@
#define CI20_GPIO_REV_BITS (3) /* 2 bits */
#define CI20_GPIO_REV_MASK (CI20_GPIO_REV_BITS << CI20_GPIO_REV_SHIFT)
-int ci20_revision = 0;
-
struct ci20_otp {
uint32_t serial_number;
uint32_t date;
@@ -171,8 +169,7 @@ int board_eth_init(bd_t *bis)
#endif /* CONFIG_DRIVER_DM9000 */
-/* U-Boot common routines */
-int checkboard(void)
+int ci20_revision(void)
{
int val;
@@ -188,13 +185,18 @@ int checkboard(void)
/* pulldowns invert the revision number */
switch (val) {
-#define CI20_REV(a, b) case(b): ci20_revision = a; break
+#define CI20_REV(a, b) case(b): return a
CI20_REV(1, 3); /* Rev 1 boards had no pulldowns - giving 3 */
CI20_REV(2, 1); /* Rev 2 boards pulldown port C bit 18 giving 1 */
#undef CI20_REV
}
+ return 0;
+}
- printf("Board: ci20 (r%d) (Ingenic XBurst JZ4780 SoC)\n", ci20_revision);
+/* U-Boot common routines */
+int checkboard(void)
+{
+ printf("Board: ci20 (r%d) (Ingenic XBurst JZ4780 SoC)\n", ci20_revision());
return 0;
}