Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) /* Copyright (c) 2018 Rockchip Electronics Co. Ltd. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #ifndef __RKFLASH_BLK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #define __RKFLASH_BLK_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/semaphore.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "rkflash_api.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) /* RKFLASH Dev Patition Max Count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #define MAX_PART_COUNT 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define RK_PARTITION_TAG	0x50464B52
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) struct flash_part {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	unsigned char name[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	unsigned int offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	unsigned int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	unsigned char type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) struct flash_blk_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	int major;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	int minorbits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	int last_dev_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	struct request_queue *rq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	spinlock_t queue_lock; /* queue lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	/* block-mq */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	struct list_head rq_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	struct blk_mq_tag_set *tag_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	struct list_head devs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	struct module *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) struct flash_blk_dev {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	struct flash_blk_ops *blk_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	int devnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	unsigned int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	unsigned int off_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	int readonly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	int writeonly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	int disable_access;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	void *blkcore_priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) enum ENUM_PARTITION_TYPE {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	PART_VENDOR = 1 << 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	PART_IDBLOCK = 1 << 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	PART_KERNEL = 1 << 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	PART_BOOT = 1 << 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	PART_USER = 1 << 31
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) struct STRUCT_DATETIME {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	unsigned short	year;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	unsigned char	month;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	unsigned char	day;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	unsigned char	hour;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	unsigned char	min;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	unsigned char	sec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	unsigned char	reserve;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) struct STRUCT_FW_HEADER {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	unsigned int	ui_fw_tag;	/* "RKFP" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	struct STRUCT_DATETIME	dt_release_data_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	unsigned int	ui_fw_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	unsigned int	ui_size;	/* size of sturct,unit of u8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	unsigned int	ui_part_entry_offset;	/* unit of sector */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	unsigned int	ui_backup_part_entry_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	unsigned int	ui_part_entry_size;	/* unit of u8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	unsigned int	ui_part_entry_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	unsigned int	ui_fw_size;	/* unit of u8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	unsigned char	reserved[464];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	unsigned int	ui_part_entry_crc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	unsigned int	ui_header_crc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) struct STRUCT_PART_ENTRY {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	unsigned char	sz_name[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	enum ENUM_PARTITION_TYPE em_part_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	unsigned int	ui_pt_off;	/* unit of sector */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	unsigned int	ui_pt_sz;	/* unit of sector */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	unsigned int	ui_data_length;	/* unit of u8 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	unsigned int	ui_part_property;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	unsigned char	reserved[76];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) struct STRUCT_PART_INFO {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	struct STRUCT_FW_HEADER hdr;	/* 0.5KB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	struct STRUCT_PART_ENTRY part[12];	/* 1.5KB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) /* Including Dev APIs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) #ifdef CONFIG_RK_SFC_NAND_MTD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) int sfc_nand_mtd_init(struct SFNAND_DEV *p_dev, struct mutex *lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #ifdef CONFIG_RK_SFC_NOR_MTD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) int sfc_nor_mtd_init(struct SFNOR_DEV *p_dev, struct mutex *lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) int rkflash_dev_suspend(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) int rkflash_dev_resume(void __iomem *reg_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) void rkflash_dev_shutdown(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) void rkflash_dev_flush(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) int rkflash_dev_init(void __iomem *reg_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		     enum flash_type type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		     const struct flash_boot_ops *ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) int rkflash_dev_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) int rkflash_vendor_read(u32 sec, u32 n_sec, void *p_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) int rkflash_vendor_write(u32 sec, u32 n_sec, void *p_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #endif