1 From 99324818889fb34c36dd8d15b920bea78bdced35 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Eric=20B=C3=A9nard?= <eric@eukrea.com>
3 Date: Tue, 21 Feb 2012 01:09:15 +0100
4 Subject: [PATCH 6/7] mx53-loco: add board revision support
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 - this is taken from freescale-mx35-3-stack/3stack.c and allows
10 this board to run Freescale's kernel which relies on the system
11 revision to configure the correct PMIC.
13 - On rev0 boards (with DA9053), the log is :
14 detected i.MX53 rev 2.1
15 MCIMX53-START board 1.0
17 On newer boards (rev A or B with MC34708), the log is :
18 mc34708-i2c@mc34708-i2c0: MC34708 ID: 0x0014
19 detected i.MX53 rev 2.1
20 MCIMX53-START-R board 1.0 rev B
22 Signed-off-by: Eric Bénard <eric@eukrea.com>
24 Upstream-Status: Applied for 2012.04.0
26 arch/arm/boards/freescale-mx53-loco/board.c | 51 +++++++++++++++++++++++++++
27 1 files changed, 51 insertions(+), 0 deletions(-)
29 diff --git a/arch/arm/boards/freescale-mx53-loco/board.c b/arch/arm/boards/freescale-mx53-loco/board.c
30 index 14c053a..115a8a3 100644
31 --- a/arch/arm/boards/freescale-mx53-loco/board.c
32 +++ b/arch/arm/boards/freescale-mx53-loco/board.c
33 @@ -103,6 +103,31 @@ static struct i2c_board_info i2c_devices[] = {
38 + * Revision to be passed to kernel. The kernel provided
39 + * by freescale relies on this.
42 + * S --> Silicon revision
46 + * | Cmaj | Cmin | B | Smaj | Smin|
48 + * e.g 0x00053120 --> i.MX35, Cpu silicon rev 2.0, Board rev 2
50 +static unsigned int loco_system_rev = 0x00053000;
52 +static void set_silicon_rev( int rev)
54 + loco_system_rev = loco_system_rev | (rev & 0xFF);
57 +static void set_board_rev(int rev)
59 + loco_system_rev = (loco_system_rev & ~(0xF << 8)) | (rev & 0xF) << 8;
62 static int loco_mem_init(void)
64 arm_add_mem_device("ram0", 0x70000000, SZ_512M);
65 @@ -149,6 +174,8 @@ static int loco_devices_init(void)
69 + set_silicon_rev(imx_silicon_revision());
71 armlinux_set_bootparams((void *)0x70000100);
72 armlinux_set_architecture(MACH_TYPE_MX53_LOCO);
74 @@ -177,3 +204,27 @@ static int loco_console_init(void)
77 console_initcall(loco_console_init);
79 +static int loco_pmic_init(void)
81 + struct mc34708 *mc34708;
84 + mc34708 = mc34708_get();
86 + /* so we have a DA9053 based board */
87 + printf("MCIMX53-START board 1.0\n");
88 + armlinux_set_revision(loco_system_rev);
92 + /* get the board revision from fuse */
93 + rev = readl(MX53_IIM_BASE_ADDR + 0x878);
95 + printf("MCIMX53-START-R board 1.0 rev %c\n", (rev == 1) ? 'A' : 'B' );
96 + armlinux_set_revision(loco_system_rev);
101 +late_initcall(loco_pmic_init);