2009-04-29 10:25:12 +03:00
|
|
|
/*
|
2009-07-09 17:42:29 +03:00
|
|
|
* Copyright(C) 2009 Qi Hardware Inc.,
|
2009-06-25 07:33:46 +03:00
|
|
|
* Authors: Marek Lindner <lindner_marek@yahoo.de>
|
2010-07-21 05:44:34 +03:00
|
|
|
* Xiangfu Liu <xiangfu@sharism.cc>
|
2009-04-29 10:25:12 +03:00
|
|
|
*
|
2009-07-09 17:42:29 +03:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2009-04-29 10:25:12 +03:00
|
|
|
*/
|
|
|
|
|
2009-04-30 20:26:14 +03:00
|
|
|
#ifndef __USB_BOOT_DEFINES_H__
|
|
|
|
#define __USB_BOOT_DEFINES_H__
|
2009-04-27 11:15:27 +03:00
|
|
|
|
|
|
|
#define SDRAM_SIZE ( 16 * 1024 * 1024 )
|
|
|
|
#define CODE_SIZE ( 4 * 1024 * 1024 )
|
|
|
|
/* #define START_ADDR ( 0x80000000 + SDRAM_SIZE - CODE_SIZE ) */
|
|
|
|
|
2009-05-20 11:13:10 +03:00
|
|
|
#define NAND_MAX_BLK_NUM 10000000 /*((Hand.nand_pn / Hand.nand_ppb) + 1)*/
|
|
|
|
#define NAND_MAX_PAGE_NUM 1073740824 /*Hand.nand_pn */
|
|
|
|
#define NAND_SECTION_NUM 23
|
|
|
|
#define MAX_TRANSFER_SIZE 0x100000
|
2009-06-28 10:35:20 +03:00
|
|
|
#define MAX_LOAD_SIZE 0x3000
|
|
|
|
#define NAND_MAX_BYTE_NUM (hand.nand_pn * hand.nand_ps)
|
2009-05-20 11:13:10 +03:00
|
|
|
#define MAX_DEV_NUM 16
|
2009-04-27 11:15:27 +03:00
|
|
|
|
2009-04-29 10:25:12 +03:00
|
|
|
enum CPUTYPE {
|
2009-04-27 11:15:27 +03:00
|
|
|
JZ4740,
|
2010-07-30 15:43:36 +03:00
|
|
|
JZ4750
|
2009-04-27 11:15:27 +03:00
|
|
|
};
|
|
|
|
|
2009-04-29 10:25:12 +03:00
|
|
|
enum USB_Boot_State {
|
2009-04-27 11:15:27 +03:00
|
|
|
DISCONNECT,
|
|
|
|
CONNECT,
|
|
|
|
BOOT,
|
|
|
|
UNBOOT
|
|
|
|
};
|
|
|
|
|
2009-04-29 10:25:12 +03:00
|
|
|
enum OPTION {
|
2009-04-27 11:15:27 +03:00
|
|
|
OOB_ECC,
|
|
|
|
OOB_NO_ECC,
|
2010-07-30 15:43:36 +03:00
|
|
|
NO_OOB
|
2009-04-27 11:15:27 +03:00
|
|
|
};
|
|
|
|
|
2009-04-29 10:25:12 +03:00
|
|
|
enum NOR_OPS_TYPE {
|
2009-04-27 11:15:27 +03:00
|
|
|
NOR_INIT = 0,
|
|
|
|
NOR_QUERY,
|
|
|
|
NOR_WRITE,
|
|
|
|
NOR_ERASE_CHIP,
|
|
|
|
NOR_ERASE_SECTOR
|
|
|
|
};
|
|
|
|
|
|
|
|
enum NOR_FLASH_TYPE
|
|
|
|
{
|
|
|
|
NOR_AM29 = 0,
|
|
|
|
NOR_SST28,
|
|
|
|
NOR_SST39x16,
|
|
|
|
NOR_SST39x8
|
|
|
|
};
|
|
|
|
|
2009-04-29 10:25:12 +03:00
|
|
|
enum NAND_OPS_TYPE {
|
2009-04-27 11:15:27 +03:00
|
|
|
NAND_QUERY = 0,
|
|
|
|
NAND_INIT,
|
|
|
|
NAND_MARK_BAD,
|
|
|
|
NAND_READ_OOB,
|
|
|
|
NAND_READ_RAW,
|
|
|
|
NAND_ERASE,
|
|
|
|
NAND_READ,
|
|
|
|
NAND_PROGRAM,
|
|
|
|
NAND_READ_TO_RAM
|
|
|
|
};
|
|
|
|
|
2009-04-29 10:25:12 +03:00
|
|
|
enum SDRAM_OPS_TYPE {
|
2010-07-30 15:43:36 +03:00
|
|
|
SDRAM_LOAD
|
2009-04-27 11:15:27 +03:00
|
|
|
};
|
|
|
|
|
2009-04-29 10:25:12 +03:00
|
|
|
enum DATA_STRUCTURE_OB {
|
2009-04-27 11:15:27 +03:00
|
|
|
DS_flash_info ,
|
|
|
|
DS_hand
|
|
|
|
};
|
|
|
|
|
2009-05-20 11:13:10 +03:00
|
|
|
struct fw_args {
|
2009-04-27 11:15:27 +03:00
|
|
|
/* CPU ID */
|
|
|
|
unsigned int cpu_id;
|
2009-04-29 10:25:12 +03:00
|
|
|
|
2009-04-27 11:15:27 +03:00
|
|
|
/* PLL args */
|
|
|
|
unsigned char ext_clk;
|
|
|
|
unsigned char cpu_speed;
|
|
|
|
unsigned char phm_div;
|
|
|
|
unsigned char use_uart;
|
|
|
|
unsigned int boudrate;
|
|
|
|
|
|
|
|
/* SDRAM args */
|
|
|
|
unsigned char bus_width;
|
|
|
|
unsigned char bank_num;
|
|
|
|
unsigned char row_addr;
|
|
|
|
unsigned char col_addr;
|
|
|
|
unsigned char is_mobile;
|
|
|
|
unsigned char is_busshare;
|
|
|
|
|
|
|
|
/* debug args */
|
|
|
|
unsigned char debug_ops;
|
|
|
|
unsigned char pin_num;
|
|
|
|
unsigned int start;
|
|
|
|
unsigned int size;
|
2009-04-29 10:25:12 +03:00
|
|
|
} __attribute__((packed));
|
2009-04-27 11:15:27 +03:00
|
|
|
|
2009-05-20 11:13:10 +03:00
|
|
|
struct hand {
|
2009-04-27 11:15:27 +03:00
|
|
|
/* nand flash info */
|
2009-05-26 20:05:54 +03:00
|
|
|
int pt; /* cpu type */
|
2009-04-30 20:26:14 +03:00
|
|
|
unsigned int nand_bw; /* bus width */
|
|
|
|
unsigned int nand_rc; /* row cycle */
|
|
|
|
unsigned int nand_ps; /* page size */
|
|
|
|
unsigned int nand_ppb; /* page number per block */
|
|
|
|
unsigned int nand_force_erase;
|
|
|
|
unsigned int nand_pn; /* page number in total */
|
|
|
|
unsigned int nand_os; /* oob size */
|
|
|
|
unsigned int nand_eccpos;
|
|
|
|
unsigned int nand_bbpage;
|
|
|
|
unsigned int nand_bbpos;
|
|
|
|
unsigned int nand_plane;
|
|
|
|
unsigned int nand_bchbit;
|
|
|
|
unsigned int nand_wppin;
|
|
|
|
unsigned int nand_bpc; /* block number per chip */
|
2009-04-27 11:15:27 +03:00
|
|
|
|
2009-05-20 11:13:10 +03:00
|
|
|
struct fw_args fw_args;
|
2009-04-29 10:25:12 +03:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
2009-05-20 11:13:10 +03:00
|
|
|
struct nand_in {
|
2009-04-29 10:25:12 +03:00
|
|
|
unsigned char dev;
|
|
|
|
unsigned char max_chip;
|
|
|
|
unsigned char *buf;
|
|
|
|
unsigned char *cs_map;
|
|
|
|
unsigned int start;
|
|
|
|
unsigned int length;
|
|
|
|
unsigned int option;
|
|
|
|
|
|
|
|
int (* check) (unsigned char *,unsigned char *,unsigned int);
|
|
|
|
};
|
2009-04-27 11:15:27 +03:00
|
|
|
|
2009-05-20 11:13:10 +03:00
|
|
|
struct nand_out {
|
2009-04-29 10:25:12 +03:00
|
|
|
unsigned char *status;
|
|
|
|
};
|
|
|
|
|
2009-05-20 11:13:10 +03:00
|
|
|
struct sdram_in {
|
2009-04-29 10:25:12 +03:00
|
|
|
unsigned char dev;
|
|
|
|
unsigned char *buf;
|
|
|
|
unsigned int start;
|
|
|
|
unsigned int length;
|
|
|
|
unsigned int option;
|
|
|
|
};
|
2009-04-27 11:15:27 +03:00
|
|
|
|
2009-04-30 20:26:14 +03:00
|
|
|
#endif /* __USB_BOOT_DEFINES_H__ */
|
2009-06-28 10:35:20 +03:00
|
|
|
|