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) #ifndef _ASM_S390_EADM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define _ASM_S390_EADM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <linux/blk_types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) struct arqb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 	u64 data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 	u16 fmt:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 	u16:12;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	u16 cmd_code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	u16:16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	u16 msb_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	u32 reserved[12];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define ARQB_CMD_MOVE	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) struct arsb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	u16 fmt:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	u32:28;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	u8 ef;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	u8:8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	u8 ecbi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	u8:8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	u8 fvf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	u16:16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	u8 eqc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	u32:32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	u64 fail_msb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	u64 fail_aidaw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	u64 fail_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	u64 fail_scm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	u32 reserved[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #define EQC_WR_PROHIBIT 22
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) struct msb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	u8 fmt:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	u8 oc:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	u8 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	u16:12;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	u16 bs:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	u32 blk_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	u64 data_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	u64 scm_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	u64:64;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) struct aidaw {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	u8 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	u32 :24;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	u32 :32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	u64 data_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #define MSB_OC_CLEAR	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define MSB_OC_READ	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #define MSB_OC_WRITE	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #define MSB_OC_RELEASE	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #define MSB_FLAG_BNM	0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) #define MSB_FLAG_IDA	0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #define MSB_BS_4K	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #define MSB_BS_1M	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #define AOB_NR_MSB	124
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) struct aob {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	struct arqb request;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	struct arsb response;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	struct msb msb[AOB_NR_MSB];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) } __packed __aligned(PAGE_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) struct aob_rq_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	struct scm_device *scmdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	char data[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) struct scm_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	u64 address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	u64 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	unsigned int nr_max_block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	struct device dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		unsigned int persistence:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		unsigned int oper_state:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		unsigned int data_state:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		unsigned int rank:4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		unsigned int release:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		unsigned int res_id:8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	} __packed attrs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) #define OP_STATE_GOOD		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define OP_STATE_TEMP_ERR	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define OP_STATE_PERM_ERR	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) enum scm_event {SCM_CHANGE, SCM_AVAIL};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) struct scm_driver {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	struct device_driver drv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	int (*probe) (struct scm_device *scmdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	int (*remove) (struct scm_device *scmdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	void (*notify) (struct scm_device *scmdev, enum scm_event event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	void (*handler) (struct scm_device *scmdev, void *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 			blk_status_t error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) int scm_driver_register(struct scm_driver *scmdrv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) void scm_driver_unregister(struct scm_driver *scmdrv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) int eadm_start_aob(struct aob *aob);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) void scm_irq_handler(struct aob *aob, blk_status_t error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #endif /* _ASM_S390_EADM_H */