soc: rockchip: vendor_storage: move some defines to common header file
Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com> Change-Id: Ic11edc5bf111689024dcc45f5d94d0cda231830a
This commit is contained in:
parent
6a274a10f5
commit
356b355cee
4 changed files with 51 additions and 95 deletions
|
|
@ -23,34 +23,13 @@
|
|||
#define DLOG(x...)
|
||||
#endif
|
||||
|
||||
struct vendor_item {
|
||||
u16 id;
|
||||
u16 offset;
|
||||
u16 size;
|
||||
u16 flag;
|
||||
};
|
||||
|
||||
#define FLASH_VENDOR_PART_START 8
|
||||
#define FLASH_VENDOR_PART_SIZE 8
|
||||
#define FLASH_VENDOR_PART_NUM 4
|
||||
#define FLASH_VENDOR_TAG 0x524B5644
|
||||
|
||||
struct tag_vendor_info {
|
||||
u32 tag;
|
||||
u32 version;
|
||||
u16 next_index;
|
||||
u16 item_num;
|
||||
u16 free_offset;
|
||||
u16 free_size;
|
||||
struct vendor_item item[62]; /* 62 * 8 */
|
||||
u8 data[FLASH_VENDOR_PART_SIZE * 512 - 512 - 8];
|
||||
u32 hash;
|
||||
u32 version2;
|
||||
};
|
||||
#define FLASH_VENDOR_TAG VENDOR_HEAD_TAG
|
||||
|
||||
static int (*_flash_read)(u32 sec, u32 n_sec, void *p_data);
|
||||
static int (*_flash_write)(u32 sec, u32 n_sec, void *p_data);
|
||||
static struct tag_vendor_info *g_vendor;
|
||||
static struct flash_vendor_info *g_vendor;
|
||||
|
||||
int flash_vendor_dev_ops_register(int (*read)(u32 sec,
|
||||
u32 n_sec,
|
||||
|
|
|
|||
|
|
@ -16,38 +16,12 @@
|
|||
#include <linux/soc/rockchip/rk_vendor_storage.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <misc/rkflash_vendor_storage.h>
|
||||
|
||||
#define MTD_VENDOR_PART_START 0
|
||||
#define MTD_VENDOR_PART_SIZE 8
|
||||
#define MTD_VENDOR_PART_SIZE FLASH_VENDOR_PART_SIZE
|
||||
#define MTD_VENDOR_PART_NUM 1
|
||||
#define MTD_VENDOR_TAG 0x524B5644
|
||||
|
||||
struct rk_vendor_req {
|
||||
u32 tag;
|
||||
u16 id;
|
||||
u16 len;
|
||||
u8 data[1024];
|
||||
};
|
||||
|
||||
struct vendor_item {
|
||||
u16 id;
|
||||
u16 offset;
|
||||
u16 size;
|
||||
u16 flag;
|
||||
};
|
||||
|
||||
struct vendor_info {
|
||||
u32 tag;
|
||||
u32 version;
|
||||
u16 next_index;
|
||||
u16 item_num;
|
||||
u16 free_offset;
|
||||
u16 free_size;
|
||||
struct vendor_item item[62];
|
||||
u8 data[MTD_VENDOR_PART_SIZE * 512 - 512 - 8];
|
||||
u32 hash;
|
||||
u32 version2;
|
||||
};
|
||||
#define MTD_VENDOR_TAG VENDOR_HEAD_TAG
|
||||
|
||||
struct mtd_nand_info {
|
||||
u32 blk_offset;
|
||||
|
|
@ -65,12 +39,8 @@ struct mtd_nand_info {
|
|||
#define GET_LOCK_FLAG_IO _IOW('r', 0x53, unsigned int)
|
||||
#endif
|
||||
|
||||
#define VENDOR_REQ_TAG 0x56524551
|
||||
#define VENDOR_READ_IO _IOW('v', 0x01, unsigned int)
|
||||
#define VENDOR_WRITE_IO _IOW('v', 0x02, unsigned int)
|
||||
|
||||
static u8 *g_idb_buffer;
|
||||
static struct vendor_info *g_vendor;
|
||||
static struct flash_vendor_info *g_vendor;
|
||||
static DEFINE_MUTEX(vendor_ops_mutex);
|
||||
static struct mtd_info *mtd;
|
||||
static const char *vendor_mtd_name = "vnvm";
|
||||
|
|
@ -306,7 +276,7 @@ static long vendor_storage_ioctl(struct file *file, unsigned int cmd,
|
|||
{
|
||||
long ret = -1;
|
||||
int size;
|
||||
struct rk_vendor_req *v_req;
|
||||
struct RK_VENDOR_REQ *v_req;
|
||||
u32 *page_buf;
|
||||
|
||||
page_buf = kmalloc(4096, GFP_KERNEL);
|
||||
|
|
@ -315,7 +285,7 @@ static long vendor_storage_ioctl(struct file *file, unsigned int cmd,
|
|||
|
||||
mutex_lock(&vendor_ops_mutex);
|
||||
|
||||
v_req = (struct rk_vendor_req *)page_buf;
|
||||
v_req = (struct RK_VENDOR_REQ *)page_buf;
|
||||
|
||||
switch (cmd) {
|
||||
case VENDOR_READ_IO:
|
||||
|
|
|
|||
|
|
@ -23,42 +23,16 @@
|
|||
#include <linux/soc/rockchip/rk_vendor_storage.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/delay.h>
|
||||
#include <misc/rkflash_vendor_storage.h>
|
||||
#include "../../mmc/host/rk_sdmmc_ops.h"
|
||||
|
||||
#define EMMC_IDB_PART_OFFSET 64
|
||||
#define EMMC_SYS_PART_OFFSET 8064
|
||||
#define EMMC_BOOT_PART_SIZE 1024
|
||||
#define EMMC_VENDOR_PART_START (1024 * 7)
|
||||
#define EMMC_VENDOR_PART_SIZE 128
|
||||
#define EMMC_VENDOR_PART_SIZE VENDOR_PART_SIZE
|
||||
#define EMMC_VENDOR_PART_NUM 4
|
||||
#define EMMC_VENDOR_TAG 0x524B5644
|
||||
|
||||
struct rk_vendor_req {
|
||||
u32 tag;
|
||||
u16 id;
|
||||
u16 len;
|
||||
u8 data[1024];
|
||||
};
|
||||
|
||||
struct vendor_item {
|
||||
u16 id;
|
||||
u16 offset;
|
||||
u16 size;
|
||||
u16 flag;
|
||||
};
|
||||
|
||||
struct vendor_info {
|
||||
u32 tag;
|
||||
u32 version;
|
||||
u16 next_index;
|
||||
u16 item_num;
|
||||
u16 free_offset;
|
||||
u16 free_size;
|
||||
struct vendor_item item[126]; /* 126 * 8*/
|
||||
u8 data[EMMC_VENDOR_PART_SIZE * 512 - 1024 - 8];
|
||||
u32 hash;
|
||||
u32 version2;
|
||||
};
|
||||
#define EMMC_VENDOR_TAG VENDOR_HEAD_TAG
|
||||
|
||||
#ifdef CONFIG_ROCKCHIP_VENDOR_STORAGE_UPDATE_LOADER
|
||||
#define READ_SECTOR_IO _IOW('r', 0x04, unsigned int)
|
||||
|
|
@ -69,10 +43,6 @@ struct vendor_info {
|
|||
#define GET_LOCK_FLAG_IO _IOW('r', 0x53, unsigned int)
|
||||
#endif
|
||||
|
||||
#define VENDOR_REQ_TAG 0x56524551
|
||||
#define VENDOR_READ_IO _IOW('v', 0x01, unsigned int)
|
||||
#define VENDOR_WRITE_IO _IOW('v', 0x02, unsigned int)
|
||||
|
||||
static u8 *g_idb_buffer;
|
||||
static struct vendor_info *g_vendor;
|
||||
static DEFINE_MUTEX(vendor_ops_mutex);
|
||||
|
|
@ -405,7 +375,7 @@ static long vendor_storage_ioctl(struct file *file, unsigned int cmd,
|
|||
{
|
||||
long ret = -1;
|
||||
int size;
|
||||
struct rk_vendor_req *v_req;
|
||||
struct RK_VENDOR_REQ *v_req;
|
||||
u32 *page_buf;
|
||||
|
||||
page_buf = kmalloc(4096, GFP_KERNEL);
|
||||
|
|
@ -414,7 +384,7 @@ static long vendor_storage_ioctl(struct file *file, unsigned int cmd,
|
|||
|
||||
mutex_lock(&vendor_ops_mutex);
|
||||
|
||||
v_req = (struct rk_vendor_req *)page_buf;
|
||||
v_req = (struct RK_VENDOR_REQ *)page_buf;
|
||||
|
||||
switch (cmd) {
|
||||
case VENDOR_READ_IO:
|
||||
|
|
@ -573,7 +543,7 @@ exit:
|
|||
return ret;
|
||||
}
|
||||
|
||||
const struct file_operations vendor_storage_fops = {
|
||||
static const struct file_operations vendor_storage_fops = {
|
||||
.open = vendor_storage_open,
|
||||
.compat_ioctl = vendor_storage_ioctl,
|
||||
.unlocked_ioctl = vendor_storage_ioctl,
|
||||
|
|
|
|||
|
|
@ -29,6 +29,43 @@
|
|||
#define LAN_RGMII_DL_ID 16
|
||||
#define EINK_VCOM_ID 17
|
||||
|
||||
#define VENDOR_HEAD_TAG 0x524B5644
|
||||
#define FLASH_VENDOR_PART_SIZE 8
|
||||
#define VENDOR_PART_SIZE 128
|
||||
|
||||
struct vendor_item {
|
||||
u16 id;
|
||||
u16 offset;
|
||||
u16 size;
|
||||
u16 flag;
|
||||
};
|
||||
|
||||
struct vendor_info {
|
||||
u32 tag;
|
||||
u32 version;
|
||||
u16 next_index;
|
||||
u16 item_num;
|
||||
u16 free_offset;
|
||||
u16 free_size;
|
||||
struct vendor_item item[126]; /* 126 * 8 */
|
||||
u8 data[VENDOR_PART_SIZE * 512 - 1024 - 8];
|
||||
u32 hash;
|
||||
u32 version2;
|
||||
};
|
||||
|
||||
struct flash_vendor_info {
|
||||
u32 tag;
|
||||
u32 version;
|
||||
u16 next_index;
|
||||
u16 item_num;
|
||||
u16 free_offset;
|
||||
u16 free_size;
|
||||
struct vendor_item item[62]; /* 62 * 8 */
|
||||
u8 data[FLASH_VENDOR_PART_SIZE * 512 - 512 - 8];
|
||||
u32 hash;
|
||||
u32 version2;
|
||||
};
|
||||
|
||||
#if IS_REACHABLE(CONFIG_ROCKCHIP_VENDOR_STORAGE)
|
||||
int rk_vendor_read(u32 id, void *pbuf, u32 size);
|
||||
int rk_vendor_write(u32 id, void *pbuf, u32 size);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue