1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/include/usb_boot_defines.h Fri May 22 18:37:44 2015 +0200
1.3 @@ -0,0 +1,162 @@
1.4 +/*
1.5 + * Copyright(C) 2009 Qi Hardware Inc.,
1.6 + * Authors: Marek Lindner <lindner_marek@yahoo.de>
1.7 + * Xiangfu Liu <xiangfu@sharism.cc>
1.8 + *
1.9 + * This program is free software: you can redistribute it and/or modify
1.10 + * it under the terms of the GNU General Public License as published by
1.11 + * the Free Software Foundation, either version 3 of the License, or
1.12 + * (at your option) any later version.
1.13 + *
1.14 + * This program is distributed in the hope that it will be useful,
1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.17 + * GNU General Public License for more details.
1.18 + *
1.19 + * You should have received a copy of the GNU General Public License
1.20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
1.21 + */
1.22 +
1.23 +#ifndef __USB_BOOT_DEFINES_H__
1.24 +#define __USB_BOOT_DEFINES_H__
1.25 +
1.26 +#define SDRAM_SIZE ( 16 * 1024 * 1024 )
1.27 +#define CODE_SIZE ( 4 * 1024 * 1024 )
1.28 +/* #define START_ADDR ( 0x80000000 + SDRAM_SIZE - CODE_SIZE ) */
1.29 +
1.30 +#define NAND_MAX_BLK_NUM 10000000 /*((Hand.nand_pn / Hand.nand_ppb) + 1)*/
1.31 +#define NAND_MAX_PAGE_NUM 1073740824 /*Hand.nand_pn */
1.32 +#define NAND_SECTION_NUM 23
1.33 +#define MAX_TRANSFER_SIZE 0x100000
1.34 +#define MAX_LOAD_SIZE 0x3000
1.35 +#define NAND_MAX_BYTE_NUM (hand.nand_pn * hand.nand_ps)
1.36 +#define MAX_DEV_NUM 16
1.37 +
1.38 +enum CPUTYPE {
1.39 + JZ4740,
1.40 + JZ4750
1.41 +};
1.42 +
1.43 +enum USB_Boot_State {
1.44 + DISCONNECT,
1.45 + CONNECT,
1.46 + BOOT,
1.47 + UNBOOT
1.48 +};
1.49 +
1.50 +enum OPTION {
1.51 + OOB_ECC,
1.52 + OOB_NO_ECC,
1.53 + NO_OOB
1.54 +};
1.55 +
1.56 +enum NOR_OPS_TYPE {
1.57 + NOR_INIT = 0,
1.58 + NOR_QUERY,
1.59 + NOR_WRITE,
1.60 + NOR_ERASE_CHIP,
1.61 + NOR_ERASE_SECTOR
1.62 +};
1.63 +
1.64 +enum NOR_FLASH_TYPE
1.65 +{
1.66 + NOR_AM29 = 0,
1.67 + NOR_SST28,
1.68 + NOR_SST39x16,
1.69 + NOR_SST39x8
1.70 +};
1.71 +
1.72 +enum NAND_OPS_TYPE {
1.73 + NAND_QUERY = 0,
1.74 + NAND_INIT,
1.75 + NAND_MARK_BAD,
1.76 + NAND_READ_OOB,
1.77 + NAND_READ_RAW,
1.78 + NAND_ERASE,
1.79 + NAND_READ,
1.80 + NAND_PROGRAM,
1.81 + NAND_READ_TO_RAM
1.82 +};
1.83 +
1.84 +enum SDRAM_OPS_TYPE {
1.85 + SDRAM_LOAD
1.86 +};
1.87 +
1.88 +enum DATA_STRUCTURE_OB {
1.89 + DS_flash_info = 0,
1.90 + DS_hand
1.91 +};
1.92 +
1.93 +struct fw_args {
1.94 + /* CPU ID */
1.95 + unsigned int cpu_id;
1.96 +
1.97 + /* PLL args */
1.98 + unsigned char ext_clk;
1.99 + unsigned char cpu_speed;
1.100 + unsigned char phm_div;
1.101 + unsigned char use_uart;
1.102 + unsigned int boudrate;
1.103 +
1.104 + /* SDRAM args */
1.105 + unsigned char bus_width;
1.106 + unsigned char bank_num;
1.107 + unsigned char row_addr;
1.108 + unsigned char col_addr;
1.109 + unsigned char is_mobile;
1.110 + unsigned char is_busshare;
1.111 +
1.112 + /* debug args */
1.113 + char debug_ops;
1.114 + unsigned char pin_num;
1.115 + unsigned int start;
1.116 + unsigned int size;
1.117 +} __attribute__((packed));
1.118 +
1.119 +struct hand {
1.120 + /* nand flash info */
1.121 + int pt; /* cpu type */
1.122 + unsigned int nand_bw; /* bus width */
1.123 + unsigned int nand_rc; /* row cycle */
1.124 + unsigned int nand_ps; /* page size */
1.125 + unsigned int nand_ppb; /* page number per block */
1.126 + unsigned int nand_force_erase;
1.127 + unsigned int nand_pn; /* page number in total */
1.128 + unsigned int nand_os; /* oob size */
1.129 + unsigned int nand_eccpos;
1.130 + unsigned int nand_bbpage;
1.131 + unsigned int nand_bbpos;
1.132 + unsigned int nand_plane;
1.133 + unsigned int nand_bchbit;
1.134 + unsigned int nand_wppin;
1.135 + unsigned int nand_bpc; /* block number per chip */
1.136 +
1.137 + struct fw_args fw_args;
1.138 +} __attribute__((packed));
1.139 +
1.140 +struct nand_in {
1.141 + unsigned char dev;
1.142 + unsigned char max_chip;
1.143 + unsigned char *buf;
1.144 + unsigned char *cs_map;
1.145 + unsigned int start;
1.146 + unsigned int length;
1.147 + unsigned int option;
1.148 +
1.149 + int (* check) (unsigned char *,unsigned char *,unsigned int);
1.150 +};
1.151 +
1.152 +struct nand_out {
1.153 + unsigned char *status;
1.154 +};
1.155 +
1.156 +struct sdram_in {
1.157 + unsigned char dev;
1.158 + unsigned char *buf;
1.159 + unsigned int start;
1.160 + unsigned int length;
1.161 + unsigned int option;
1.162 +};
1.163 +
1.164 +#endif /* __USB_BOOT_DEFINES_H__ */
1.165 +