diff options
author | Dinh Nguyen <Dinh.Nguyen@freescale.com> | 2010-11-15 12:30:01 -0500 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-11-28 13:51:47 -0500 |
commit | 9ab4650f718a0e1cb8792bab4ef97efca4ac75c2 (patch) | |
tree | b04138d06accafc9861098238260f815d35edb8a /arch/arm/mach-imx | |
parent | b66ff7a2cd411a2245c984793a7eb98ee91771f9 (diff) |
ARM: imx: Get the silicon version from the IIM module
Instead of reading the silicon version from ROM, we should
read the SREV register from the IIM.
Freescale has dropped all support for MX51 REV1.0, only MX51
REV 2.0 and 3.0 are valid.
Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r-- | arch/arm/mach-imx/clock-imx27.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-imx/cpu-imx27.c | 14 |
2 files changed, 24 insertions, 12 deletions
diff --git a/arch/arm/mach-imx/clock-imx27.c b/arch/arm/mach-imx/clock-imx27.c index 98a25bada783..2202b88667b5 100644 --- a/arch/arm/mach-imx/clock-imx27.c +++ b/arch/arm/mach-imx/clock-imx27.c | |||
@@ -125,7 +125,7 @@ static int clk_cpu_set_parent(struct clk *clk, struct clk *parent) | |||
125 | if (clk->parent == parent) | 125 | if (clk->parent == parent) |
126 | return 0; | 126 | return 0; |
127 | 127 | ||
128 | if (mx27_revision() >= CHIP_REV_2_0) { | 128 | if (mx27_revision() >= IMX_CHIP_REVISION_2_0) { |
129 | if (parent == &mpll_main1_clk) { | 129 | if (parent == &mpll_main1_clk) { |
130 | cscr |= CCM_CSCR_ARM_SRC; | 130 | cscr |= CCM_CSCR_ARM_SRC; |
131 | } else { | 131 | } else { |
@@ -174,7 +174,7 @@ static int set_rate_cpu(struct clk *clk, unsigned long rate) | |||
174 | div--; | 174 | div--; |
175 | 175 | ||
176 | reg = __raw_readl(CCM_CSCR); | 176 | reg = __raw_readl(CCM_CSCR); |
177 | if (mx27_revision() >= CHIP_REV_2_0) { | 177 | if (mx27_revision() >= IMX_CHIP_REVISION_2_0) { |
178 | reg &= ~(3 << 12); | 178 | reg &= ~(3 << 12); |
179 | reg |= div << 12; | 179 | reg |= div << 12; |
180 | reg &= ~(CCM_CSCR_FPM | CCM_CSCR_SPEN); | 180 | reg &= ~(CCM_CSCR_FPM | CCM_CSCR_SPEN); |
@@ -244,7 +244,7 @@ static unsigned long get_rate_ssix(struct clk *clk, unsigned long pdf) | |||
244 | 244 | ||
245 | parent_rate = clk_get_rate(clk->parent); | 245 | parent_rate = clk_get_rate(clk->parent); |
246 | 246 | ||
247 | if (mx27_revision() >= CHIP_REV_2_0) | 247 | if (mx27_revision() >= IMX_CHIP_REVISION_2_0) |
248 | pdf += 4; /* MX27 TO2+ */ | 248 | pdf += 4; /* MX27 TO2+ */ |
249 | else | 249 | else |
250 | pdf = (pdf < 2) ? 124UL : pdf; /* MX21 & MX27 TO1 */ | 250 | pdf = (pdf < 2) ? 124UL : pdf; /* MX21 & MX27 TO1 */ |
@@ -269,7 +269,7 @@ static unsigned long get_rate_nfc(struct clk *clk) | |||
269 | 269 | ||
270 | parent_rate = clk_get_rate(clk->parent); | 270 | parent_rate = clk_get_rate(clk->parent); |
271 | 271 | ||
272 | if (mx27_revision() >= CHIP_REV_2_0) | 272 | if (mx27_revision() >= IMX_CHIP_REVISION_2_0) |
273 | nfc_pdf = (__raw_readl(CCM_PCDR0) >> 6) & 0xf; | 273 | nfc_pdf = (__raw_readl(CCM_PCDR0) >> 6) & 0xf; |
274 | else | 274 | else |
275 | nfc_pdf = (__raw_readl(CCM_PCDR0) >> 12) & 0xf; | 275 | nfc_pdf = (__raw_readl(CCM_PCDR0) >> 12) & 0xf; |
@@ -284,7 +284,7 @@ static unsigned long get_rate_vpu(struct clk *clk) | |||
284 | 284 | ||
285 | parent_rate = clk_get_rate(clk->parent); | 285 | parent_rate = clk_get_rate(clk->parent); |
286 | 286 | ||
287 | if (mx27_revision() >= CHIP_REV_2_0) { | 287 | if (mx27_revision() >= IMX_CHIP_REVISION_2_0) { |
288 | vpu_pdf = (__raw_readl(CCM_PCDR0) >> 10) & 0x3f; | 288 | vpu_pdf = (__raw_readl(CCM_PCDR0) >> 10) & 0x3f; |
289 | vpu_pdf += 4; | 289 | vpu_pdf += 4; |
290 | } else { | 290 | } else { |
@@ -347,7 +347,7 @@ static unsigned long get_rate_mpll_main(struct clk *clk) | |||
347 | * clk->id == 0: arm clock source path 1 which is from 2 * MPLL / 2 | 347 | * clk->id == 0: arm clock source path 1 which is from 2 * MPLL / 2 |
348 | * clk->id == 1: arm clock source path 2 which is from 2 * MPLL / 3 | 348 | * clk->id == 1: arm clock source path 2 which is from 2 * MPLL / 3 |
349 | */ | 349 | */ |
350 | if (mx27_revision() >= CHIP_REV_2_0 && clk->id == 1) | 350 | if (mx27_revision() >= IMX_CHIP_REVISION_2_0 && clk->id == 1) |
351 | return 2UL * parent_rate / 3UL; | 351 | return 2UL * parent_rate / 3UL; |
352 | 352 | ||
353 | return parent_rate; | 353 | return parent_rate; |
@@ -365,7 +365,7 @@ static unsigned long get_rate_spll(struct clk *clk) | |||
365 | /* On TO2 we have to write the value back. Otherwise we | 365 | /* On TO2 we have to write the value back. Otherwise we |
366 | * read 0 from this register the next time. | 366 | * read 0 from this register the next time. |
367 | */ | 367 | */ |
368 | if (mx27_revision() >= CHIP_REV_2_0) | 368 | if (mx27_revision() >= IMX_CHIP_REVISION_2_0) |
369 | __raw_writel(reg, CCM_SPCTL0); | 369 | __raw_writel(reg, CCM_SPCTL0); |
370 | 370 | ||
371 | return mxc_decode_pll(reg, rate); | 371 | return mxc_decode_pll(reg, rate); |
@@ -376,7 +376,7 @@ static unsigned long get_rate_cpu(struct clk *clk) | |||
376 | u32 div; | 376 | u32 div; |
377 | unsigned long rate; | 377 | unsigned long rate; |
378 | 378 | ||
379 | if (mx27_revision() >= CHIP_REV_2_0) | 379 | if (mx27_revision() >= IMX_CHIP_REVISION_2_0) |
380 | div = (__raw_readl(CCM_CSCR) >> 12) & 0x3; | 380 | div = (__raw_readl(CCM_CSCR) >> 12) & 0x3; |
381 | else | 381 | else |
382 | div = (__raw_readl(CCM_CSCR) >> 13) & 0x7; | 382 | div = (__raw_readl(CCM_CSCR) >> 13) & 0x7; |
@@ -389,7 +389,7 @@ static unsigned long get_rate_ahb(struct clk *clk) | |||
389 | { | 389 | { |
390 | unsigned long rate, bclk_pdf; | 390 | unsigned long rate, bclk_pdf; |
391 | 391 | ||
392 | if (mx27_revision() >= CHIP_REV_2_0) | 392 | if (mx27_revision() >= IMX_CHIP_REVISION_2_0) |
393 | bclk_pdf = (__raw_readl(CCM_CSCR) >> 8) & 0x3; | 393 | bclk_pdf = (__raw_readl(CCM_CSCR) >> 8) & 0x3; |
394 | else | 394 | else |
395 | bclk_pdf = (__raw_readl(CCM_CSCR) >> 9) & 0xf; | 395 | bclk_pdf = (__raw_readl(CCM_CSCR) >> 9) & 0xf; |
@@ -402,7 +402,7 @@ static unsigned long get_rate_ipg(struct clk *clk) | |||
402 | { | 402 | { |
403 | unsigned long rate, ipg_pdf; | 403 | unsigned long rate, ipg_pdf; |
404 | 404 | ||
405 | if (mx27_revision() >= CHIP_REV_2_0) | 405 | if (mx27_revision() >= IMX_CHIP_REVISION_2_0) |
406 | return clk_get_rate(clk->parent); | 406 | return clk_get_rate(clk->parent); |
407 | else | 407 | else |
408 | ipg_pdf = (__raw_readl(CCM_CSCR) >> 8) & 1; | 408 | ipg_pdf = (__raw_readl(CCM_CSCR) >> 8) & 1; |
@@ -683,7 +683,7 @@ static void __init to2_adjust_clocks(void) | |||
683 | { | 683 | { |
684 | unsigned long cscr = __raw_readl(CCM_CSCR); | 684 | unsigned long cscr = __raw_readl(CCM_CSCR); |
685 | 685 | ||
686 | if (mx27_revision() >= CHIP_REV_2_0) { | 686 | if (mx27_revision() >= IMX_CHIP_REVISION_2_0) { |
687 | if (cscr & CCM_CSCR_ARM_SRC) | 687 | if (cscr & CCM_CSCR_ARM_SRC) |
688 | cpu_clk.parent = &mpll_main1_clk; | 688 | cpu_clk.parent = &mpll_main1_clk; |
689 | 689 | ||
diff --git a/arch/arm/mach-imx/cpu-imx27.c b/arch/arm/mach-imx/cpu-imx27.c index d8d3b2d84dc5..3b117be37bd2 100644 --- a/arch/arm/mach-imx/cpu-imx27.c +++ b/arch/arm/mach-imx/cpu-imx27.c | |||
@@ -42,7 +42,19 @@ static void query_silicon_parameter(void) | |||
42 | val = __raw_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR | 42 | val = __raw_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR |
43 | + SYS_CHIP_ID)); | 43 | + SYS_CHIP_ID)); |
44 | 44 | ||
45 | cpu_silicon_rev = (int)(val >> 28); | 45 | switch (val >> 28) { |
46 | case 0: | ||
47 | cpu_silicon_rev = IMX_CHIP_REVISION_1_0; | ||
48 | break; | ||
49 | case 1: | ||
50 | cpu_silicon_rev = IMX_CHIP_REVISION_2_0; | ||
51 | break; | ||
52 | case 2: | ||
53 | cpu_silicon_rev = IMX_CHIP_REVISION_2_1; | ||
54 | break; | ||
55 | default: | ||
56 | cpu_silicon_rev = IMX_CHIP_REVISION_UNKNOWN; | ||
57 | } | ||
46 | cpu_partnumber = (int)((val >> 12) & 0xFFFF); | 58 | cpu_partnumber = (int)((val >> 12) & 0xFFFF); |
47 | } | 59 | } |
48 | 60 | ||