paul@0 | 1 | /* |
paul@63 | 2 | * USB boot definitions. |
paul@63 | 3 | * |
paul@63 | 4 | * Copyright (C) 2009 Qi Hardware Inc. |
paul@0 | 5 | * Authors: Marek Lindner <lindner_marek@yahoo.de> |
paul@0 | 6 | * Xiangfu Liu <xiangfu@sharism.cc> |
paul@0 | 7 | * |
paul@0 | 8 | * This program is free software: you can redistribute it and/or modify |
paul@0 | 9 | * it under the terms of the GNU General Public License as published by |
paul@0 | 10 | * the Free Software Foundation, either version 3 of the License, or |
paul@0 | 11 | * (at your option) any later version. |
paul@0 | 12 | * |
paul@0 | 13 | * This program is distributed in the hope that it will be useful, |
paul@0 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@0 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@0 | 16 | * GNU General Public License for more details. |
paul@0 | 17 | * |
paul@0 | 18 | * You should have received a copy of the GNU General Public License |
paul@0 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
paul@0 | 20 | */ |
paul@0 | 21 | |
paul@0 | 22 | #ifndef __USB_BOOT_DEFINES_H__ |
paul@0 | 23 | #define __USB_BOOT_DEFINES_H__ |
paul@0 | 24 | |
paul@0 | 25 | #define SDRAM_SIZE ( 16 * 1024 * 1024 ) |
paul@0 | 26 | #define CODE_SIZE ( 4 * 1024 * 1024 ) |
paul@0 | 27 | /* #define START_ADDR ( 0x80000000 + SDRAM_SIZE - CODE_SIZE ) */ |
paul@0 | 28 | |
paul@0 | 29 | #define NAND_MAX_BLK_NUM 10000000 /*((Hand.nand_pn / Hand.nand_ppb) + 1)*/ |
paul@0 | 30 | #define NAND_MAX_PAGE_NUM 1073740824 /*Hand.nand_pn */ |
paul@0 | 31 | #define NAND_SECTION_NUM 23 |
paul@0 | 32 | #define MAX_TRANSFER_SIZE 0x100000 |
paul@0 | 33 | #define MAX_LOAD_SIZE 0x3000 |
paul@0 | 34 | #define NAND_MAX_BYTE_NUM (hand.nand_pn * hand.nand_ps) |
paul@0 | 35 | #define MAX_DEV_NUM 16 |
paul@0 | 36 | |
paul@0 | 37 | enum CPUTYPE { |
paul@0 | 38 | JZ4740, |
paul@0 | 39 | JZ4750 |
paul@0 | 40 | }; |
paul@0 | 41 | |
paul@0 | 42 | enum USB_Boot_State { |
paul@0 | 43 | DISCONNECT, |
paul@0 | 44 | CONNECT, |
paul@0 | 45 | BOOT, |
paul@0 | 46 | UNBOOT |
paul@0 | 47 | }; |
paul@0 | 48 | |
paul@0 | 49 | enum OPTION { |
paul@0 | 50 | OOB_ECC, |
paul@0 | 51 | OOB_NO_ECC, |
paul@0 | 52 | NO_OOB |
paul@0 | 53 | }; |
paul@0 | 54 | |
paul@0 | 55 | enum NOR_OPS_TYPE { |
paul@0 | 56 | NOR_INIT = 0, |
paul@0 | 57 | NOR_QUERY, |
paul@0 | 58 | NOR_WRITE, |
paul@0 | 59 | NOR_ERASE_CHIP, |
paul@0 | 60 | NOR_ERASE_SECTOR |
paul@0 | 61 | }; |
paul@0 | 62 | |
paul@0 | 63 | enum NOR_FLASH_TYPE |
paul@0 | 64 | { |
paul@0 | 65 | NOR_AM29 = 0, |
paul@0 | 66 | NOR_SST28, |
paul@0 | 67 | NOR_SST39x16, |
paul@0 | 68 | NOR_SST39x8 |
paul@0 | 69 | }; |
paul@0 | 70 | |
paul@0 | 71 | enum NAND_OPS_TYPE { |
paul@0 | 72 | NAND_QUERY = 0, |
paul@0 | 73 | NAND_INIT, |
paul@0 | 74 | NAND_MARK_BAD, |
paul@0 | 75 | NAND_READ_OOB, |
paul@0 | 76 | NAND_READ_RAW, |
paul@0 | 77 | NAND_ERASE, |
paul@0 | 78 | NAND_READ, |
paul@0 | 79 | NAND_PROGRAM, |
paul@0 | 80 | NAND_READ_TO_RAM |
paul@0 | 81 | }; |
paul@0 | 82 | |
paul@0 | 83 | enum SDRAM_OPS_TYPE { |
paul@0 | 84 | SDRAM_LOAD |
paul@0 | 85 | }; |
paul@0 | 86 | |
paul@0 | 87 | enum DATA_STRUCTURE_OB { |
paul@0 | 88 | DS_flash_info = 0, |
paul@0 | 89 | DS_hand |
paul@0 | 90 | }; |
paul@0 | 91 | |
paul@0 | 92 | struct fw_args { |
paul@0 | 93 | /* CPU ID */ |
paul@0 | 94 | unsigned int cpu_id; |
paul@0 | 95 | |
paul@0 | 96 | /* PLL args */ |
paul@0 | 97 | unsigned char ext_clk; |
paul@0 | 98 | unsigned char cpu_speed; |
paul@0 | 99 | unsigned char phm_div; |
paul@0 | 100 | unsigned char use_uart; |
paul@0 | 101 | unsigned int boudrate; |
paul@0 | 102 | |
paul@0 | 103 | /* SDRAM args */ |
paul@0 | 104 | unsigned char bus_width; |
paul@0 | 105 | unsigned char bank_num; |
paul@0 | 106 | unsigned char row_addr; |
paul@0 | 107 | unsigned char col_addr; |
paul@0 | 108 | unsigned char is_mobile; |
paul@0 | 109 | unsigned char is_busshare; |
paul@0 | 110 | |
paul@0 | 111 | /* debug args */ |
paul@0 | 112 | char debug_ops; |
paul@0 | 113 | unsigned char pin_num; |
paul@0 | 114 | unsigned int start; |
paul@0 | 115 | unsigned int size; |
paul@0 | 116 | } __attribute__((packed)); |
paul@0 | 117 | |
paul@0 | 118 | struct hand { |
paul@0 | 119 | /* nand flash info */ |
paul@0 | 120 | int pt; /* cpu type */ |
paul@0 | 121 | unsigned int nand_bw; /* bus width */ |
paul@0 | 122 | unsigned int nand_rc; /* row cycle */ |
paul@0 | 123 | unsigned int nand_ps; /* page size */ |
paul@0 | 124 | unsigned int nand_ppb; /* page number per block */ |
paul@0 | 125 | unsigned int nand_force_erase; |
paul@0 | 126 | unsigned int nand_pn; /* page number in total */ |
paul@0 | 127 | unsigned int nand_os; /* oob size */ |
paul@0 | 128 | unsigned int nand_eccpos; |
paul@0 | 129 | unsigned int nand_bbpage; |
paul@0 | 130 | unsigned int nand_bbpos; |
paul@0 | 131 | unsigned int nand_plane; |
paul@0 | 132 | unsigned int nand_bchbit; |
paul@0 | 133 | unsigned int nand_wppin; |
paul@0 | 134 | unsigned int nand_bpc; /* block number per chip */ |
paul@0 | 135 | |
paul@0 | 136 | struct fw_args fw_args; |
paul@0 | 137 | } __attribute__((packed)); |
paul@0 | 138 | |
paul@0 | 139 | struct nand_in { |
paul@0 | 140 | unsigned char dev; |
paul@0 | 141 | unsigned char max_chip; |
paul@0 | 142 | unsigned char *buf; |
paul@0 | 143 | unsigned char *cs_map; |
paul@0 | 144 | unsigned int start; |
paul@0 | 145 | unsigned int length; |
paul@0 | 146 | unsigned int option; |
paul@0 | 147 | |
paul@0 | 148 | int (* check) (unsigned char *,unsigned char *,unsigned int); |
paul@0 | 149 | }; |
paul@0 | 150 | |
paul@0 | 151 | struct nand_out { |
paul@0 | 152 | unsigned char *status; |
paul@0 | 153 | }; |
paul@0 | 154 | |
paul@0 | 155 | struct sdram_in { |
paul@0 | 156 | unsigned char dev; |
paul@0 | 157 | unsigned char *buf; |
paul@0 | 158 | unsigned int start; |
paul@0 | 159 | unsigned int length; |
paul@0 | 160 | unsigned int option; |
paul@0 | 161 | }; |
paul@0 | 162 | |
paul@0 | 163 | #endif /* __USB_BOOT_DEFINES_H__ */ |
paul@0 | 164 | |