~ubuntu-branches/ubuntu/maverick/uboot-imx/maverick

« back to all changes in this revision

Viewing changes to cpu/pxa/cpu.c

  • Committer: Bazaar Package Importer
  • Author(s): Oliver Grawert
  • Date: 2010-01-06 09:28:25 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100106092825-q8o7x811035syh8k
Tags: 2009.08-0ubuntu1
* move to new upstream (2009.08)
* move to new freescale patchset for the 2009.08 release
* remove README.nios_CONFIG_SYS_NIOS_CPU from debian/docs, 
  this is not shipped upstream anymore
* update 1000_fix_gcc_4.4_compability.patch to apply to the new code
* Makefile target is now mx51_bbg_config, update rules accordingly
* switch everything to to3 (including the binary package)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include <common.h>
34
34
#include <command.h>
35
35
#include <asm/arch/pxa-regs.h>
36
 
 
37
 
#ifdef CONFIG_USE_IRQ
38
 
DECLARE_GLOBAL_DATA_PTR;
39
 
#endif
40
 
 
41
 
int cpu_init (void)
42
 
{
43
 
        /*
44
 
         * setup up stacks if necessary
45
 
         */
46
 
#ifdef CONFIG_USE_IRQ
47
 
        IRQ_STACK_START = _armboot_start - CONFIG_SYS_MALLOC_LEN - CONFIG_SYS_GBL_DATA_SIZE - 4;
48
 
        FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
49
 
#endif
50
 
        return 0;
51
 
}
 
36
#include <asm/system.h>
 
37
 
 
38
static void cache_flush(void);
52
39
 
53
40
int cleanup_before_linux (void)
54
41
{
59
46
         * just disable everything that can disturb booting linux
60
47
         */
61
48
 
62
 
        unsigned long i;
63
 
 
64
49
        disable_interrupts ();
65
50
 
66
51
        /* turn off I-cache */
67
 
        asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
68
 
        i &= ~0x1000;
69
 
        asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
 
52
        icache_disable();
 
53
        dcache_disable();
70
54
 
71
55
        /* flush I-cache */
72
 
        asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
73
 
 
74
 
        return (0);
75
 
}
76
 
 
77
 
int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
78
 
{
79
 
        printf ("resetting ...\n");
80
 
 
81
 
        udelay (50000);                         /* wait 50 ms */
82
 
        disable_interrupts ();
83
 
        reset_cpu (0);
84
 
 
85
 
        /*NOTREACHED*/
86
 
        return (0);
87
 
}
88
 
 
89
 
/* taken from blob */
90
 
void icache_enable (void)
91
 
{
92
 
        register u32 i;
93
 
 
94
 
        /* read control register */
95
 
        asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
96
 
 
97
 
        /* set i-cache */
98
 
        i |= 0x1000;
99
 
 
100
 
        /* write back to control register */
101
 
        asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
102
 
}
103
 
 
104
 
void icache_disable (void)
105
 
{
106
 
        register u32 i;
107
 
 
108
 
        /* read control register */
109
 
        asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
110
 
 
111
 
        /* clear i-cache */
112
 
        i &= ~0x1000;
113
 
 
114
 
        /* write back to control register */
115
 
        asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
116
 
 
117
 
        /* flush i-cache */
118
 
        asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
119
 
}
120
 
 
121
 
int icache_status (void)
122
 
{
123
 
        register u32 i;
124
 
 
125
 
        /* read control register */
126
 
        asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
127
 
 
128
 
        /* return bit */
129
 
        return (i & 0x1000);
130
 
}
131
 
 
132
 
/* we will never enable dcache, because we have to setup MMU first */
133
 
void dcache_enable (void)
134
 
{
135
 
        return;
136
 
}
137
 
 
138
 
void dcache_disable (void)
139
 
{
140
 
        return;
141
 
}
142
 
 
143
 
int dcache_status (void)
144
 
{
145
 
        return 0;                                       /* always off */
 
56
        cache_flush();
 
57
 
 
58
        return (0);
 
59
}
 
60
 
 
61
/* flush I/D-cache */
 
62
static void cache_flush (void)
 
63
{
 
64
        unsigned long i = 0;
 
65
 
 
66
        asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
146
67
}
147
68
 
148
69
#ifndef CONFIG_CPU_MONAHANS