MT6573 YuSu NVRAM Customer Document [2.0 ed.]

  • Commentary
  • https://github.com/luckasfb/Development_Documents
  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N

LY

MediaTek Confidential B

Rev 2.0

January 17, 2011

YuSu NvRam Customer Document The Improvement in Android 2.2 or later

© 2010 - 2011 MediaTek Inc. This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.

FO

Specifications are subject to change without notice.

Revision 2.0

Page 1

4/20/2011

LY

MediaTek Confidential B

M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N

Table of Contents Rev 1.0

January 17, 2011....................................................................................................... 1

Table of Contents................................................................................................................................... 2 1.

Introduction................................................................................................................................... 4

1.1 Software/Hardware Environment................................................................................................. 4 1.1.1 Software Environment ................................................................................................. 4 1.1.2 Hardware Environment................................................................................................ 4 1.2 Improvement in Android 2.2 ........................................................................................................ 4 1.3 Related Patch .............................................................................................................................. 4

2. Improvement in Android 2.2 ........................................................................................................... 5 2.1 NvRam Backup to Bin Region .................................................................................................... 5 2.1.1 The customization of Bin Region................................................................................. 5 2.1.2 The customization of tool for Bin Region..................................................................... 6 2.2 NvRam Data Table ...................................................................................................................... 7 2.3 NvRam Data Compatibility .......................................................................................................... 7

FO

3 Update to W1048mpV2 or later ........................................................................................................ 10

Revision 2.0

Page 2

4/20/2011

Revision History Revision

Author

Date

Description

Jason Zhang

2011 / 01 / 17

Initial draft

2.0

Jason Zhang

2011 / 03 / 31

Add the content of bin region

FO

M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N

1.0

LY

MediaTek Confidential B

Revision 2.0

Page 3

4/20/2011

LY

MediaTek Confidential B

M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N

1. Introduction 1.1 Software/Hardware Environment 1.1.1 Software Environment

NvRam Driver discussed in this document is designed based on Android 2.2 or later ,which is improved on the nvram driver of Android 2.1. The NvRam driver is based on the NAND flash driver, and Linux YAFFS2 file system. With these two functionalities supports, NvRAM mechanism can provide Linux device driver or user space services to access the data in NvRam storage. If you want to get the detailed info about nvram module, please refer to the YuSu NvRam Driver Document.

1.1.2 Hardware Environment

Driver discussed in this document can be run on the device with MT6516 and MT6573 chip only.

1.2 Improvement in Android 2.2

In order to meet the need of protecting nvram data and enhancing the compatibility of nvram data between loads with different version, the improvement has been provided based on Android 2.2 (MT6516: W1048mpV2). (1) NvRam backup to bin region NvRam has added a bin region to backup and restore nvram data. (2) NvRam data table In order to support some new feature, nvram has changed the data structure. (3) NvRam data compatibility It will help customer to update load from old version to new version , and the old nvram data can be used in the new load after converting if need.

1.3 Related Patch

MT6516:ALPS00138674, ALPS00029539 (48MP V2 or earlier)

FO

MT6573: The feature has been supported.

Revision 2.0

Page 4

4/20/2011

M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N

2. Improvement in Android 2.2

LY

MediaTek Confidential B

2.1 NvRam Backup to Bin Region

Since W1048mpV2(MT6516), NvRam has added a bin region to backup and restore nvram data, in order to re-construct nvram when clean boot. So there are two spaces for nvram to store date: NvRam region (with YAFFS), and Bin region(without YAFFS). NvRam region is placed in Data partition ,and the bin region is NvRam partition of 48MPV2 or earlier.

NvRam Partition

Read/Write in this region

When module reads or writes data, the data is stored in nvram region. However, this region will be cleared when clean boot, or will be broken because of some File System error. So some important data, such as IMEI, WIFI Mac address and so on, should be backed up to bin region after calibration in product line, or when system updates from one version to another version. There are two occasions to restore data from bin region: factory reset, or the clean boot flag has been checked to be true when system boots. This clean boot flag is used to notify target that this is the first time for system to boot. And the user data partition will be cleared during the procedure of factor reset ,so the content of nvram will be lost. The nvram module is able to check this situation happened or not . and then restore data from bin region to nvram. If you find the RF calibration data is lost after factory reset even the procedure of restoring has been finished , please contact with MTK to get the Modem patch of MAUI_02866518.

2.1.1 The customization of Bin Region

FO

In order to support the customization of backup to bin region, a kind of data structure has been defined in /mtk/src/custom/common/cgen/CFG_file_info.c: FileName aBackupToBinRegion[]= { {“FILE_VER”,}, {“BT_Addr”,}, {“WIFI”,}, {“AUXADC”,}, {“FACTORY”,}, {“BWCS”,}, {“HWMON_ACC”,}, {“WIFI_CUSTOM”,}, {“GPS”,}, }

Revision 2.0

Page 5

4/20/2011

LY

MediaTek Confidential B

If a kind of new data needs to be backed up to bin region, the file name should be added in this table.

M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N

2.1.2 The customization of tool for Bin Region

The procedure of backing up to bin region should be called by tool with meta.dll of mediatek. In this DLL, the interface function of backing up to bin region has been provided for customization of tool , and then custom can back up data to bin region. The interface function provided by meta.dll is as below: Definition: META_RESULT __stdcall SP_META_Clean_Boot(unsigned int ms_timeout); META_RESULT __stdcall SP_META_Clean_Boot_r(int meta_handle,unsigned int ms_timeout); Description: This function will backup Nvram data to Bin region, and then set clean boot flag as true. Return Value: Return Value

Description

META_SUCCESS

Success

Other error code

Other error messages please use META_GetErrorString to translate the meaning.

Parameter: Parameter

Description

meta_handle

IN

Handle of META_DLL that return from META_GetAvailableHandle().

ms_timeout

IN

Timeout value, unit = minisecond

SN writer of mediatek ,which is used to write IMEI into phone ,has been added the function of

FO

backing up data.

Revision 2.0

Page 6

4/20/2011

LY

MediaTek Confidential B

2.2 NvRam Data Table

M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N

In Android 2.1,a kind of data table, which is of the type TCFG_FILE, is used to manage the files in the NvRam storage. It provides the file path name, file version number, record size, record numbers, and it’s default values. typedef struct { char cFileName[FILENAMELENGTH]; //file name char cFileVer[FILEVERLENGTH]; //nvram file version information int i4RecSize; //record size int i4RecNum; //record total FILE_DEFAULT_TYPE stDefualType; //the type of default value char *pDefualtVaule; //the defualt value. } TCFG_FILE;

Since W1048mpV2, the data table has been changed in order to support the new feature: compatibility between loads of different version . Two Items have been added in the definition of TCFG_FILE: bDataProcessingType and NVM_DataConvertFunc. And the new definition is as below: typedef struct { char cFileName[FILENAMELENGTH]; //file name char cFileVer[FILEVERLENGTH]; //nvram file version information int i4RecSize; //record size int i4RecNum; //record total FILE_DEFAULT_TYPE stDefualType; //the type of default value char *pDefualtVaule; //the defualt value. Int bDataProcessingType; //type of processing when version not match pfConvertFunc; //Data-convert function } TCFG_FILE; The value of bDataProcessingType is DataReset/DataConvert. The meaning of “DataReset” is to reset data using default value when version info of the data doesn’t match, and “DataConvert” is to convert nvram old data based on the data-convert function provided by module when version not match. The data-convert function is described in the next section.

2.3 NvRam Data Compatibility

When update load from one version to another , the feature of nvram data compatibility can keep nvram compatible with different load. The most important part of data compatibility is the data-convert function. Data-convert function is of the format as below: Int XXXX_ConverFunction(int CurrentVerID,int NewVerID,char*pSrcMem,char*pDstMem)

FO

If the data-convert function works successfully (data has been converted based on the old and new nvram data structure), this function returns “1”, else returns “0”. The parameter of CurrentVerID is the data version info of current load, and the parameter of NewVerID is the data version of target load,

Revision 2.0

Page 7

4/20/2011

LY

MediaTek Confidential B

M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N

which is the load updated to. The parameters of pSrcMem and pDstMem are the memory buffer which nvram module allocates for data-convertion. The size of the buffer is enough for data-convert function to use. pSrcMem is used to store the data need to be processed, and the pDstMem is the buffer where the data that has been processed is stored. We take a data for example: This data is of the original data structure and original default value as below:

typedef struct{ Unsigned int added; } ap_nvram_added_config_struct; ap_nvram_added_config_struct { 0x1111, };

stAddedDefault=

And then we modify the data value in order to simulate the calibration procedure.

The data version is assumed to be updated. the data structure and the default value are as the below:

FO

typedef struct{ unsigned int added; unsigned int added1; } ap_nvram_added_config_struct; ap_nvram_added_config_struct stAddedDefault= { 0x1111, 0x3333, };

Revision 2.0

Page 8

4/20/2011

LY

MediaTek Confidential B

FO

M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N

Of course, the modified data should be saved when data converts, and the new item should use the default value. So the result of data-convert is as below:

Revision 2.0

Page 9

4/20/2011

M R ED yu IA .li@ T E tin K C no O mo NF bil ID e.c EN om T I US AL EO N

3 Update to W1048mpV2 or later

LY

MediaTek Confidential B

FO

Because bin region has been added, nvram data should be backup when update. In order to keep the procedure of updating easy ,there are two ways for custom to update system: Flash Tool Update and SD Update. The detailed information about these update tools can be gotten from Flash Tool Update SOP and SD update SOP documents. Note: This part is used on MT6516 platform, and may be changed on MT6573.

Revision 2.0

Page 10

4/20/2011