]> code.ossystems Code Review - meta-freescale.git/blob
0a08427a168781d17f1e0217d99a647bd6fec87c
[meta-freescale.git] /
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
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
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.
12
13 - On rev0 boards (with DA9053), the log is :
14 detected i.MX53 rev 2.1
15 MCIMX53-START board 1.0
16
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
21
22 Signed-off-by: Eric BĂ©nard <eric@eukrea.com>
23 ---
24 Upstream-Status: Applied for 2012.04.0
25
26  arch/arm/boards/freescale-mx53-loco/board.c |   51 +++++++++++++++++++++++++++
27  1 files changed, 51 insertions(+), 0 deletions(-)
28
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[] = {
34         },
35  };
36  
37 +/*
38 + * Revision to be passed to kernel. The kernel provided
39 + * by freescale relies on this.
40 + *
41 + * C --> CPU type
42 + * S --> Silicon revision
43 + * B --> Board rev
44 + *
45 + * 31    20     16     12    8      4     0
46 + *        | Cmaj | Cmin | B  | Smaj | Smin|
47 + *
48 + * e.g 0x00053120 --> i.MX35, Cpu silicon rev 2.0, Board rev 2
49 +*/
50 +static unsigned int loco_system_rev = 0x00053000;
51 +
52 +static void set_silicon_rev( int rev)
53 +{
54 +       loco_system_rev = loco_system_rev | (rev & 0xFF);
55 +}
56 +
57 +static void set_board_rev(int rev)
58 +{
59 +       loco_system_rev =  (loco_system_rev & ~(0xF << 8)) | (rev & 0xF) << 8;
60 +}
61 +
62  static int loco_mem_init(void)
63  {
64         arm_add_mem_device("ram0", 0x70000000, SZ_512M);
65 @@ -149,6 +174,8 @@ static int loco_devices_init(void)
66  
67         loco_fec_reset();
68  
69 +       set_silicon_rev(imx_silicon_revision());
70 +
71         armlinux_set_bootparams((void *)0x70000100);
72         armlinux_set_architecture(MACH_TYPE_MX53_LOCO);
73  
74 @@ -177,3 +204,27 @@ static int loco_console_init(void)
75  }
76  
77  console_initcall(loco_console_init);
78 +
79 +static int loco_pmic_init(void)
80 +{
81 +       struct mc34708 *mc34708;
82 +       int rev;
83 +
84 +       mc34708 = mc34708_get();
85 +       if (!mc34708) {
86 +               /* so we have a DA9053 based board */
87 +               printf("MCIMX53-START board 1.0\n");
88 +               armlinux_set_revision(loco_system_rev);
89 +               return 0;
90 +       }
91 +
92 +       /* get the board revision from fuse */
93 +       rev = readl(MX53_IIM_BASE_ADDR + 0x878);
94 +       set_board_rev(rev);
95 +       printf("MCIMX53-START-R board 1.0 rev %c\n", (rev == 1) ? 'A' : 'B' );
96 +       armlinux_set_revision(loco_system_rev);
97 +
98 +       return 0;
99 +}
100 +
101 +late_initcall(loco_pmic_init);
102 -- 
103 1.7.7.6
104