OSHW-DEIMOS/SOFTWARE/A64-TERES/linux-a64/modules/nand/sun8iw10p1/nfd/nand_boot.h
Dimitar Gamishev f9b0e7a283 linux
2017-10-13 14:07:04 +03:00

207 lines
9.9 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
************************************************************************************************************************
* eNand
* Nand flash driver module config define
*
* Copyright(C), 2006-2008, SoftWinners Microelectronic Co., Ltd.
* All Rights Reserved
*
* File Name : nand_boot.h
*
* Author : Kevin.z
*
* Version : v0.1
*
* Date : 2008.03.19
*
* Description : This file define the module config for nand flash driver.
* if need support some module /
* if need support some operation type /
* config limit for some parameter. ex.
*
* Others : None at present.
*
*
* History :
*
* <Author> <time> <version> <description>
*
* Kevin.z 2008.03.19 0.1 build the file
*
************************************************************************************************************************
*/
#ifndef __NAND_BOOT_H
#define __NAND_BOOT_H
#define STAMP_VALUE 0x5F0A6C39
typedef struct
{
unsigned int ChannelCnt;
unsigned int ChipCnt; //the count of the total nand flash chips are currently connecting on the CE pin
unsigned int ChipConnectInfo; //chip connect information, bit == 1 means there is a chip connecting on the CE pin
unsigned int RbCnt;
unsigned int RbConnectInfo; //the connect information of the all rb chips are connected
unsigned int RbConnectMode; //the rb connect mode
unsigned int BankCntPerChip; //the count of the banks in one nand chip, multiple banks can support Inter-Leave
unsigned int DieCntPerChip; //the count of the dies in one nand chip, block management is based on Die
unsigned int PlaneCntPerDie; //the count of planes in one die, multiple planes can support multi-plane operation
unsigned int SectorCntPerPage; //the count of sectors in one single physic page, one sector is 0.5k
unsigned int PageCntPerPhyBlk; //the count of physic pages in one physic block
unsigned int BlkCntPerDie; //the count of the physic blocks in one die, include valid block and invalid block
unsigned int OperationOpt; //the mask of the operation types which current nand flash can support support
unsigned int FrequencePar; //the parameter of the hardware access clock, based on 'MHz'
unsigned int EccMode; //the Ecc Mode for the nand flash chip, 0: bch-16, 1:bch-28, 2:bch_32
unsigned char NandChipId[8]; //the nand chip id of current connecting nand chip
unsigned int ValidBlkRatio; //the ratio of the valid physical blocks, based on 1024
unsigned int good_block_ratio; //good block ratio get from hwscan
unsigned int ReadRetryType; //the read retry type
unsigned int DDRType;
unsigned int Reserved[32];
}boot_nand_para_t;
//ͨ<>õģ<C3B5><C4A3><EFBFBD>GPIO<49><4F>ص<EFBFBD><D8B5><EFBFBD><EFBFBD>ݽṹ
typedef struct _normal_gpio_cfg
{
unsigned char port; //<2F>˿ں<CBBF>
unsigned char port_num; //<2F>˿<EFBFBD><CBBF>ڱ<EFBFBD><DAB1>
char mul_sel; //<2F><><EFBFBD>ܱ<EFBFBD><DCB1>
char pull; //<2F><><EFBFBD><EFBFBD>״̬
char drv_level; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
char data; //<2F><><EFBFBD><EFBFBD><EFBFBD>ƽ
unsigned char reserved[2]; //<2F><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>
}normal_gpio_cfg;
/******************************************************************************/
/* head of Boot0 */
/******************************************************************************/
typedef struct _boot0_private_head_t
{
unsigned int prvt_head_size;
char prvt_head_vsn[4]; // the version of boot0_private_head_t
unsigned int dram_para[32]; // DRAM patameters for initialising dram. Original values is arbitrary,
int uart_port; // UART<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
normal_gpio_cfg uart_ctrl[2]; // UART<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD>Դ<EFBFBD>ӡ<EFBFBD><D3A1>)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
int enable_jtag; // 1 : enable, 0 : disable
normal_gpio_cfg jtag_gpio[5]; // <20><><EFBFBD><EFBFBD>JTAG<41><47>ȫ<EFBFBD><C8AB>GPIO<49><4F>Ϣ
normal_gpio_cfg storage_gpio[32]; // <20><EFBFBD>豸 GPIO<49><4F>Ϣ
char storage_data[512 - sizeof(normal_gpio_cfg) * 32]; // <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
//boot_nand_connect_info_t nand_connect_info;
}boot0_private_head_t;
typedef struct standard_Boot_file_head
{
unsigned int jump_instruction; // one intruction jumping to real code
unsigned char magic[8]; // ="eGON.BT0" or "eGON.BT1", not C-style string.
unsigned int check_sum; // generated by PC
unsigned int length; // generated by PC
unsigned int pub_head_size; // the size of boot_file_head_t
unsigned char pub_head_vsn[4]; // the version of boot_file_head_t
unsigned char file_head_vsn[4]; // the version of boot0_file_head_t or boot1_file_head_t
unsigned char Boot_vsn[4]; // Boot version
unsigned char eGON_vsn[4]; // eGON version
unsigned char platform[8]; // platform information
}standard_boot_file_head_t;
typedef struct _boot0_file_head_t
{
standard_boot_file_head_t boot_head;
boot0_private_head_t prvt_head;
}boot0_file_head_t;
typedef struct _boot_core_para_t
{
unsigned int user_set_clock; // <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5> M<><4D>λ
unsigned int user_set_core_vol; // <20><><EFBFBD>ĵ<EFBFBD>ѹ mV<6D><56>λ
unsigned int vol_threshold; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޵<EFBFBD>ѹ
}boot_core_para_t;
/******************************************************************************/
/* head of Boot1 */
/******************************************************************************/
typedef struct _boot1_private_head_t
{
unsigned int dram_para[32];
int run_clock; // Mhz
int run_core_vol; // mV
int uart_port; // UART<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
normal_gpio_cfg uart_gpio[2]; // UART<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD>Դ<EFBFBD>ӡ<EFBFBD><D3A1>)GPIO<49><4F>Ϣ
int twi_port; // TWI<57><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
normal_gpio_cfg twi_gpio[2]; // TWI<57><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GPIO<49><4F>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>TWI
int work_mode; // <20><><EFBFBD><EFBFBD>ģʽ
int storage_type; // <20><EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0<><30>nand 1<><31>sdcard 2: spinor
normal_gpio_cfg nand_gpio[32]; // nand GPIO<49><4F>Ϣ
char nand_spare_data[256]; // nand <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
normal_gpio_cfg sdcard_gpio[32]; // sdcard GPIO<49><4F>Ϣ
char sdcard_spare_data[256]; // sdcard <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
int reserved[6]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ, 256bytes align
}boot1_private_head_t;
typedef struct _Boot_file_head
{
unsigned int jump_instruction; // one intruction jumping to real code
unsigned char magic[8]; // ="u-boot"
unsigned int check_sum; // generated by PC
unsigned int align_size; // align size in byte
unsigned int length; // the size of all file
unsigned int uboot_length; // the size of uboot
unsigned char version[8]; // uboot version
unsigned char platform[8]; // platform information
int reserved[1]; //stamp space, 16bytes align
}boot_file_head_t;
typedef struct _boot1_file_head_t
{
boot_file_head_t boot_head;
boot1_private_head_t prvt_head;
}boot1_file_head_t;
typedef struct sbrom_toc0_config
{
unsigned char config_vsn[4];
unsigned int dram_para[32]; // dram<61><6D><EFBFBD><EFBFBD>
int uart_port; // UART<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
normal_gpio_cfg uart_ctrl[2]; // UART<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GPIO
int enable_jtag; // JTAGʹ<47><CAB9>
normal_gpio_cfg jtag_gpio[5]; // JTAG<41><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GPIO
normal_gpio_cfg storage_gpio[50]; // <20><EFBFBD>豸 GPIO<49><4F>Ϣ
// 0-23<32><33>nand<6E><64>24-31<33><31>ſ<EFBFBD>0<EFBFBD><30>32-39<33>ſ<EFBFBD>2
// 40-49<34><39><EFBFBD>spi
char storage_data[384]; // 0-159,<2C>洢nand<6E><64>Ϣ<EFBFBD><CFA2>160-255,<2C><>ſ<EFBFBD><C5BF><EFBFBD>Ϣ
unsigned int secure_dram_mbytes; //
unsigned int drm_start_mbytes; //
unsigned int drm_size_mbytes; //
unsigned int res[8]; // <20>ܹ<EFBFBD>1024<32>ֽ<EFBFBD>
}sbrom_toc0_config_t;
typedef struct
{
u8 name[8]; //<2F>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ը<EFBFBD><D4B8>ģ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
u32 magic; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x89119800
u32 check_sum; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>У<EFBFBD><D0A3>ͣ<EFBFBD><CDA3>ο<EFBFBD><CEBF><EFBFBD><EFBFBD><EFBFBD>boot0<74><30><EFBFBD><EFBFBD>
u32 serial_num; //<2F><><EFBFBD>кţ<D0BA><C5A3><EFBFBD><EFBFBD>Ը<EFBFBD><D4B8>ģ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
u32 status; //<2F><><EFBFBD>Ը<EFBFBD><D4B8>ģ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
u32 items_nr; //<2F>ܵ<EFBFBD><DCB5><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TOC0<43><30>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2
u32 length; //TOC0<43>ij<EFBFBD><C4B3><EFBFBD>
u8 platform[4]; //toc_platform[0]<5D><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//0<><30>nand<6E><64>1<EFBFBD><31><EFBFBD><EFBFBD>0<EFBFBD><30>2<EFBFBD><32><EFBFBD><EFBFBD>2<EFBFBD><32>3<EFBFBD><33>spinor
u32 reserved[2]; //<2F><><EFBFBD><EFBFBD>λ
u32 end; //<2F><>ʾͷ<CABE><CDB7><EFBFBD><EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x3b45494d
}toc0_private_head_t;
#define SBROM_TOC0_HEAD_SPACE 0x80
#endif //ifndef __NAND_DRV_CFG_H