power: supply: sbs-battery: simplify DT parsing
[deliverable/linux.git] / drivers / mmc / card / queue.h
1 #ifndef MMC_QUEUE_H
2 #define MMC_QUEUE_H
3
4 static inline bool mmc_req_is_special(struct request *req)
5 {
6 return req &&
7 (req_op(req) == REQ_OP_FLUSH || req_op(req) == REQ_OP_DISCARD);
8 }
9
10 struct request;
11 struct task_struct;
12
13 struct mmc_blk_request {
14 struct mmc_request mrq;
15 struct mmc_command sbc;
16 struct mmc_command cmd;
17 struct mmc_command stop;
18 struct mmc_data data;
19 int retune_retry_done;
20 };
21
22 enum mmc_packed_type {
23 MMC_PACKED_NONE = 0,
24 MMC_PACKED_WRITE,
25 };
26
27 #define mmc_packed_cmd(type) ((type) != MMC_PACKED_NONE)
28 #define mmc_packed_wr(type) ((type) == MMC_PACKED_WRITE)
29
30 struct mmc_packed {
31 struct list_head list;
32 u32 cmd_hdr[1024];
33 unsigned int blocks;
34 u8 nr_entries;
35 u8 retries;
36 s16 idx_failure;
37 };
38
39 struct mmc_queue_req {
40 struct request *req;
41 struct mmc_blk_request brq;
42 struct scatterlist *sg;
43 char *bounce_buf;
44 struct scatterlist *bounce_sg;
45 unsigned int bounce_sg_len;
46 struct mmc_async_req mmc_active;
47 enum mmc_packed_type cmd_type;
48 struct mmc_packed *packed;
49 };
50
51 struct mmc_queue {
52 struct mmc_card *card;
53 struct task_struct *thread;
54 struct semaphore thread_sem;
55 unsigned int flags;
56 #define MMC_QUEUE_SUSPENDED (1 << 0)
57 #define MMC_QUEUE_NEW_REQUEST (1 << 1)
58
59 int (*issue_fn)(struct mmc_queue *, struct request *);
60 void *data;
61 struct request_queue *queue;
62 struct mmc_queue_req mqrq[2];
63 struct mmc_queue_req *mqrq_cur;
64 struct mmc_queue_req *mqrq_prev;
65 };
66
67 extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
68 const char *);
69 extern void mmc_cleanup_queue(struct mmc_queue *);
70 extern void mmc_queue_suspend(struct mmc_queue *);
71 extern void mmc_queue_resume(struct mmc_queue *);
72
73 extern unsigned int mmc_queue_map_sg(struct mmc_queue *,
74 struct mmc_queue_req *);
75 extern void mmc_queue_bounce_pre(struct mmc_queue_req *);
76 extern void mmc_queue_bounce_post(struct mmc_queue_req *);
77
78 extern int mmc_packed_init(struct mmc_queue *, struct mmc_card *);
79 extern void mmc_packed_clean(struct mmc_queue *);
80
81 extern int mmc_access_rpmb(struct mmc_queue *);
82
83 #endif
This page took 0.032094 seconds and 5 git commands to generate.