more verbose logging
[pandora-x-loader.git] / include / common.h
1 /*
2  * (C) Copyright 2004
3  * Texas Instruments
4  *
5  * (C) Copyright 2000-2004
6  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7  *
8  * See file CREDITS for list of people who contributed to this
9  * project.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License as
13  * published by the Free Software Foundation; either version 2 of
14  * the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24  * MA 02111-1307 USA
25  */
26
27 #ifndef __COMMON_H_
28 #define __COMMON_H_     1
29
30 #undef  _LINUX_CONFIG_H
31 #define _LINUX_CONFIG_H 1       /* avoid reading Linux autoconf.h file  */
32
33 typedef unsigned char           uchar;
34 typedef volatile unsigned long  vu_long;
35 typedef volatile unsigned short vu_short;
36 typedef volatile unsigned char  vu_char;
37
38 #include <config.h>
39 #include <linux/types.h>
40 #include <stdarg.h>
41
42 #ifdef CONFIG_ARM
43 #define asmlinkage      /* nothing */
44 #endif
45
46
47 #ifdef CONFIG_ARM
48 # include <asm/setup.h>
49 # include <asm/x-load-arm.h>    /* ARM version to be fixed! */
50 #endif /* CONFIG_ARM */
51
52 #ifdef  CFG_PRINTF
53 #define printf(fmt,args...)     serial_printf (fmt ,##args)
54 #define getc() serial_getc()
55 #else
56 #define printf(fmt,args...)
57 #define getc() ' '
58 #endif  /* CFG_PRINTF */
59
60 /* board/$(BOARD)/$(BOARD).c */
61 int     board_init (void);
62 int     nand_init (void);
63 int     mmc_boot (unsigned char *buf);
64 void    board_hang (void);
65
66 /* cpu/$(CPU)/cpu.c */
67 int     cpu_init (void);
68 #ifdef  CFG_UDELAY
69 void    udelay (unsigned long usec);
70 #endif
71
72 /* nand driver */
73 #define NAND_CMD_READ0          0
74 #define NAND_CMD_READ1          1
75 #define NAND_CMD_READOOB        0x50
76 #define NAND_CMD_STATUS         0x70
77 #define NAND_CMD_READID         0x90
78 #define NAND_CMD_READPARAM      0xec
79 #define NAND_CMD_RESET          0xff
80
81 /* Extended Commands for Large page devices */
82 #define NAND_CMD_READSTART      0x30
83
84 int     nand_chip(void);
85 int     nand_read_block(uchar *buf, ulong block_addr);
86 int     nand_readid(int *mfr, int *id);
87 int     nand_read_param_page(unsigned char *data, unsigned int size);
88
89 int     onenand_chip(void);
90 int     onenand_read_block(unsigned char *buf, ulong block);
91
92
93 #ifdef CFG_PRINTF
94
95 /* serial driver */
96 int     serial_init   (void);
97 void    serial_setbrg (void);
98 void    serial_putc   (const char);
99 void    serial_puts   (const char *);
100 int     serial_getc   (void);
101 int     serial_tstc   (void);
102
103 /* lib/printf.c */
104 int     serial_printf (const char *fmt, ...);
105 #endif
106
107 /* lib/crc.c */
108 void    nand_calculate_ecc (const u_char *dat, u_char *ecc_code);
109 int     nand_correct_data (u_char *dat, u_char *read_ecc, u_char *calc_ecc);
110
111 /* lib/board.c */
112 void    hang            (void) __attribute__ ((noreturn));
113
114 extern int do_load_serial_bin (ulong offset, int baudrate);
115 extern u32 get_mem_type(void);
116 extern int mmc_init(int verbose);
117 extern int misc_init_r(void);
118
119 extern int sprintf (char *__s, const char *__format, ...);
120
121 #endif  /* __COMMON_H_ */