~ubuntu-branches/ubuntu/trusty/apex/trusty

« back to all changes in this revision

Viewing changes to src/mach-orion5x/cpu.c

  • Committer: Bazaar Package Importer
  • Author(s): Oliver Grawert
  • Date: 2009-11-10 11:55:15 UTC
  • mfrom: (2.2.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091110115515-6jjsf6rc8py35awe
Tags: 1.6.10ubuntu1
* Merge from debian testing, remaining changes:
  - Move apex VMA address to 4MiB to leave enough space for the ubuntu
  kernel and not overwrite apex in ram when loading.
  - nslu2 configuration: set CONFIG_RAMDISK_SIZE=0x0055FFF0 instead of
  0x005FFFF0 to make enough room for ubuntu initramfs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* cpu.c
 
2
 
 
3
   written by Marc Singer
 
4
   15 Sep 2008
 
5
 
 
6
   Copyright (C) 2008 Marc Singer
 
7
 
 
8
   -----------
 
9
   DESCRIPTION
 
10
   -----------
 
11
 
 
12
   CPU specific routines, local to this port.
 
13
 
 
14
   It is noteworthy that the documentation for the Sample at Reset
 
15
   Register is confusing in how it specifies bits.  The SampleAtReset[0] is
 
16
   really the MSB at [25].
 
17
 
 
18
   TCLK[1:0] = DEV_D[7:6]
 
19
   Mode[3:0] = DEV_D[12], DEV_D[15], DEV_D[4], DEV_D[2]
 
20
 
 
21
*/
 
22
 
 
23
#include <config.h>
 
24
#include <apex.h>
 
25
#include <linux/types.h>
 
26
#include "hardware.h"
 
27
 
 
28
#define MPP_SAMPLE_TCLK(v) (((v)>>8)&0x3)       // 88F5182
 
29
#define MPP_SAMPLE_MODE(v) (((v)>>4)&0xf)       // 88F5182
 
30
 
 
31
#define MPP_SAMPLE_TCLK_133     (0)
 
32
#define MPP_SAMPLE_TCLK_150     (1)
 
33
#define MPP_SAMPLE_TCLK_166     (2)
 
34
 
 
35
#define MPP_SAMPLE_MODE_333_167 (0)
 
36
#define MPP_SAMPLE_MODE_400_200 (1)
 
37
#define MPP_SAMPLE_MODE_400_133 (2)
 
38
#define MPP_SAMPLE_MODE_500_167 (3)
 
39
 
 
40
uint32_t get_tclk (void)
 
41
{
 
42
  switch (MPP_SAMPLE_TCLK (MPP_SAMPLE)) {
 
43
  case MPP_SAMPLE_TCLK_133:             return TCLK_133;
 
44
  case MPP_SAMPLE_TCLK_150:             return TCLK_150;
 
45
  default:
 
46
  case MPP_SAMPLE_TCLK_166:             return TCLK_166;
 
47
  }
 
48
}
 
49
 
 
50
uint32_t get_cpu_clk (void)
 
51
{
 
52
  switch (MPP_SAMPLE_MODE (MPP_SAMPLE)) {
 
53
  case MPP_SAMPLE_MODE_333_167:         return CPUCLK_333;
 
54
  case MPP_SAMPLE_MODE_400_200:         return CPUCLK_400;
 
55
  case MPP_SAMPLE_MODE_400_133:         return CPUCLK_400;
 
56
  default:
 
57
  case MPP_SAMPLE_MODE_500_167:         return CPUCLK_500;
 
58
  }
 
59
}