19 #define KERNEL_LOAD_ADR 0x40004000
21 #include <linux/types.h>
23 #ifdef CONFIG_ETRAX_ARCH_V32
25 #include <hwregs/reg_map.h>
27 #include <hwregs/pinmux_defs.h>
28 #ifdef CONFIG_CRIS_MACH_ARTPEC3
43 void *
memcpy(
void *__dest, __const
void *__src,
size_t __n);
45 #define memzero(s, n) memset((s), 0, (n))
47 typedef unsigned char uch;
48 typedef unsigned short ush;
49 typedef unsigned long ulg;
62 static unsigned outcnt = 0;
65 #define ASCII_FLAG 0x01
66 #define CONTINUATION 0x02
67 #define EXTRA_FIELD 0x04
68 #define ORIG_NAME 0x08
70 #define ENCRYPTED 0x20
73 #define get_byte() (inbuf[inptr++])
77 # define Assert(cond, msg) do { \
81 # define Trace(x) fprintf x
82 # define Tracev(x) do { \
86 # define Tracevv(x) do { \
90 # define Tracec(c, x) do { \
94 # define Tracecv(c, x) do { \
95 if (verbose > 1 && (c)) \
99 # define Assert(cond, msg)
103 # define Tracec(c, x)
104 # define Tracecv(c, x)
108 static void error(
char *
m);
109 static void aputs(
const char *
s);
113 static long bytes_out;
123 #include "../../../../../lib/inflate.c"
127 #ifdef CONFIG_ETRAX_ARCH_V32
140 #define SEROUT(S, N) \
142 serout(S, regi_ser ## N); \
146 #define SEROUT(S, N) do { \
147 while (!(*R_SERIAL ## N ## _STATUS & (1 << 5))) \
149 *R_SERIAL ## N ## _TR_DATA = *s++; \
153 static void aputs(
const char *s)
155 #ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
157 #ifdef CONFIG_ETRAX_DEBUG_PORT0
160 #ifdef CONFIG_ETRAX_DEBUG_PORT1
163 #ifdef CONFIG_ETRAX_DEBUG_PORT2
166 #ifdef CONFIG_ETRAX_DEBUG_PORT3
173 void *
memset(
void *s,
int c,
size_t n)
178 for (i=0;i<
n;i++) ss[i] = c;
183 void *
memcpy(
void *__dest, __const
void *__src,
size_t __n)
186 char *
d = (
char *)__dest, *s = (
char *)__src;
188 for (i = 0; i < __n; i++)
207 for (n = 0; n < outcnt; n++) {
211 c = crc_32_tab[((
int)c ^ ch) & 0xff] ^ (c >> 8);
214 bytes_out += (
ulg)outcnt;
219 static void error(
char *
x)
223 aputs(
"\n\n -- System halted\n");
233 #ifdef CONFIG_ETRAX_ARCH_V32
251 tr_ctrl =
REG_RD(
ser, regi_ser, rw_tr_ctrl);
252 rec_ctrl =
REG_RD(
ser, regi_ser, rw_rec_ctrl);
253 tr_baud =
REG_RD(
ser, regi_ser, rw_tr_baud_div);
254 rec_baud =
REG_RD(
ser, regi_ser, rw_rec_baud_div);
267 tr_baud.
div = (29493000 / 8) / 115200;
268 rec_baud.
div = (29493000 / 8) / 115200;
270 REG_WR(
ser, regi_ser, rw_tr_ctrl, tr_ctrl);
271 REG_WR(
ser, regi_ser, rw_tr_baud_div, tr_baud);
272 REG_WR(
ser, regi_ser, rw_rec_ctrl, rec_ctrl);
273 REG_WR(
ser, regi_ser, rw_rec_baud_div, rec_baud);
282 #ifdef CONFIG_ETRAX_ARCH_V32
285 #if defined(CONFIG_ETRAX_DEBUG_PORT1) || \
286 defined(CONFIG_ETRAX_DEBUG_PORT2) || \
287 defined(CONFIG_ETRAX_DEBUG_PORT3)
290 #ifdef CONFIG_CRIS_MACH_ARTPEC3
305 #ifdef CONFIG_ETRAX_DEBUG_PORT0
308 #ifdef CONFIG_ETRAX_DEBUG_PORT1
312 #ifdef CONFIG_ETRAX_DEBUG_PORT2
316 #ifdef CONFIG_ETRAX_DEBUG_PORT3
320 #if defined(CONFIG_ETRAX_DEBUG_PORT1) || \
321 defined(CONFIG_ETRAX_DEBUG_PORT2) || \
322 defined(CONFIG_ETRAX_DEBUG_PORT3)
335 #ifdef CONFIG_ETRAX_DEBUG_PORT0
337 *R_SERIAL0_BAUD = 0x99;
338 *R_SERIAL0_TR_CTRL = 0x40;
340 #ifdef CONFIG_ETRAX_DEBUG_PORT1
342 *R_SERIAL1_BAUD = 0x99;
343 *R_SERIAL1_TR_CTRL = 0x40;
345 #ifdef CONFIG_ETRAX_DEBUG_PORT2
346 *R_GEN_CONFIG = 0x08;
348 *R_SERIAL2_BAUD = 0x99;
349 *R_SERIAL2_TR_CTRL = 0x40;
351 #ifdef CONFIG_ETRAX_DEBUG_PORT3
352 *R_GEN_CONFIG = 0x100;
354 *R_SERIAL3_BAUD = 0x99;
355 *R_SERIAL3_TR_CTRL = 0x40;
364 if (revision < compile_rev) {
365 #ifdef CONFIG_ETRAX_ARCH_V32
366 aputs(
"You need at least ETRAX FS to run Linux 2.6/crisv32\n");
368 aputs(
"You need an ETRAX 100LX to run linux 2.6/crisv10\n");
373 aputs(
"Uncompressing Linux...\n");
375 aputs(
"Done. Now booting the kernel\n");