summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZubairLK <ZubairLK@users.noreply.github.com>2015-07-16 13:09:07 +0300
committerZubairLK <ZubairLK@users.noreply.github.com>2015-07-16 13:09:07 +0300
commit33c8075d019902d411f974f3d85b085732adfa7b (patch)
treed87d03e3426210218d0332134203ae037d6acb2d
parenta30f816f77893486ea5ee610972733bf2962c897 (diff)
parent5da5eb5eb58d28d00caeddaffcb04d9e772f1d6e (diff)
downloadCI20_u-boot-33c8075d019902d411f974f3d85b085732adfa7b.tar.xz
Merge pull request #5 from mpredfearn/ci20-v2013.10-revision-detect
Ci20 v2013.10 revision detect
-rw-r--r--arch/mips/cpu/xburst/jz4780/sdram.c5
-rw-r--r--board/imgtec/ci20/ci20.c29
2 files changed, 33 insertions, 1 deletions
diff --git a/arch/mips/cpu/xburst/jz4780/sdram.c b/arch/mips/cpu/xburst/jz4780/sdram.c
index 8d54412b4..953a50dc0 100644
--- a/arch/mips/cpu/xburst/jz4780/sdram.c
+++ b/arch/mips/cpu/xburst/jz4780/sdram.c
@@ -27,6 +27,11 @@
#include <asm/io.h>
#include <asm/arch/jz4780.h>
+#ifdef __CONFIG_CI20_H__
+/* Configured for Ci20 - we can get the board revision from here */
+extern int ci20_revision;
+#endif /* ci20 */
+
#ifdef CONFIG_SYS_DDR3_H5TQ2G83CFR
#include "sdram/H5TQ2G83CFR.h"
#endif
diff --git a/board/imgtec/ci20/ci20.c b/board/imgtec/ci20/ci20.c
index 767efb189..3d8dfe838 100644
--- a/board/imgtec/ci20/ci20.c
+++ b/board/imgtec/ci20/ci20.c
@@ -29,6 +29,13 @@
#include <asm/arch/nand.h>
#include <asm/jz_mmc.h>
+#define CI20_GPIO_REV_PORT (2) /* Port C */
+#define CI20_GPIO_REV_SHIFT (18) /* Bit 18 */
+#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;
@@ -167,7 +174,27 @@ int board_eth_init(bd_t *bis)
/* U-Boot common routines */
int checkboard(void)
{
- puts("Board: ci20 (Ingenic XBurst JZ4780 SoC)\n");
+ int val;
+
+ gpio_port_direction_input(CI20_GPIO_REV_PORT, CI20_GPIO_REV_SHIFT);
+ gpio_port_direction_input(CI20_GPIO_REV_PORT, CI20_GPIO_REV_SHIFT+1);
+
+ /* Re-enable pullups (gpio_port_direction_input turns them off) */
+ writel(CI20_GPIO_REV_MASK, GPIO_PXPENC(CI20_GPIO_REV_PORT));
+
+ /* Read PC18/19 for version */
+ val = readl(GPIO_PXPIN(CI20_GPIO_REV_PORT));
+ val = (val & CI20_GPIO_REV_MASK) >> CI20_GPIO_REV_SHIFT;
+
+ /* pulldowns invert the revision number */
+ switch (val) {
+#define CI20_REV(a, b) case(b): ci20_revision = a; break
+ 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
+ }
+
+ printf("Board: ci20 (r%d) (Ingenic XBurst JZ4780 SoC)\n", ci20_revision);
return 0;
}