70 lines
2.5 KiB
C
70 lines
2.5 KiB
C
#ifndef _NORFLASH_H
|
|
#define _NORFLASH_H
|
|
|
|
#include "device/device.h"
|
|
#include "ioctl_cmds.h"
|
|
#include "spi.h"
|
|
#include "printf.h"
|
|
#include "gpio.h"
|
|
#include "device_drive.h"
|
|
#include "malloc.h"
|
|
#include "asm/sfc_spi.h"
|
|
|
|
/*************************************************/
|
|
/*
|
|
COMMAND LIST - WinBond FLASH WX25X
|
|
*/
|
|
/***************************************************************/
|
|
#define WINBOND_WRITE_ENABLE 0x06
|
|
#define WINBOND_WRITE_SR_ENABLE 0x50
|
|
#define WINBOND_READ_SR1 0x05
|
|
#define WINBOND_READ_SR2 0x35
|
|
#define WINBOND_WRITE_SR1 0x01
|
|
#define WINBOND_WRITE_SR2 0x31
|
|
#define WINBOND_READ_DATA 0x03
|
|
#define WINBOND_FAST_READ_DATA 0x0b
|
|
#define WINBOND_FAST_READ_DUAL_OUTPUT 0x3b
|
|
#define WINBOND_FAST_READ_DUAL_IO 0xBB
|
|
#define WINBOND_FAST_READ_QUAD_IO 0xEB
|
|
// #define WINBOND_PAGE_PROGRAM 0x02
|
|
#define WINBOND_PAGE_PROGRAM_X1 0x02
|
|
#define WINBOND_PAGE_PROGRAM_X4 0x32
|
|
#define WINBOND_PAGE_ERASE 0x81
|
|
#define WINBOND_SECTOR_ERASE 0x20
|
|
#define WINBOND_BLOCK_ERASE 0xD8
|
|
#define WINBOND_CHIP_ERASE 0xC7
|
|
#define WINBOND_JEDEC_ID 0x9F
|
|
#define WINBOND_UUID 0x4B
|
|
#define WINBOND_POWER_DOWN 0xB9
|
|
#define WINBOND_RELEASE 0xAB
|
|
|
|
|
|
enum {
|
|
FLASH_PAGE_ERASER,
|
|
FLASH_SECTOR_ERASER,
|
|
FLASH_BLOCK_ERASER,
|
|
FLASH_CHIP_ERASER,
|
|
};
|
|
|
|
struct norflash_sfc_dev_platform_data {
|
|
const struct sfc_spi_platform_data *sfc_spi_pdata;
|
|
const u8 *path; //分区路径,内置flash 需要在ini分配好空间
|
|
u32 start_addr; //分区起始地址
|
|
u32 size; //分区大小,若只有1个分区,则这个参数可以忽略
|
|
u8 igore_overlaps; //忽略分区检查,匹配检查分区
|
|
};
|
|
|
|
#define NORFLASH_SFC_DEV_PLATFORM_DATA_BEGIN(data) \
|
|
const struct norflash_sfc_dev_platform_data data = {
|
|
|
|
#define NORFLASH_SFC_DEV_PLATFORM_DATA_END() \
|
|
};
|
|
|
|
extern const struct device_operations norflash_sfc_dev_ops;
|
|
extern const struct device_operations norflash_sfc_fs_dev_ops;
|
|
extern const struct device_operations inside_norflash_fs_dev_ops;
|
|
|
|
|
|
#endif
|
|
|