1
2
3
4
5
6
7
8
9 #ifndef DRIVERS_FSI_MASTER_H
10 #define DRIVERS_FSI_MASTER_H
11
12 #include <linux/device.h>
13 #include <linux/mutex.h>
14
15
16 #define FSI_ECHO_DELAY_CLOCKS 16
17 #define FSI_SEND_DELAY_CLOCKS 16
18 #define FSI_PRE_BREAK_CLOCKS 50
19 #define FSI_BREAK_CLOCKS 256
20 #define FSI_POST_BREAK_CLOCKS 16000
21 #define FSI_INIT_CLOCKS 5000
22 #define FSI_MASTER_DPOLL_CLOCKS 50
23 #define FSI_MASTER_EPOLL_CLOCKS 50
24
25
26 #define FSI_CRC_ERR_RETRIES 10
27 #define FSI_MASTER_MAX_BUSY 200
28 #define FSI_MASTER_MTOE_COUNT 1000
29
30
31 #define FSI_CMD_DPOLL 0x2
32 #define FSI_CMD_EPOLL 0x3
33 #define FSI_CMD_TERM 0x3f
34 #define FSI_CMD_ABS_AR 0x4
35 #define FSI_CMD_REL_AR 0x5
36 #define FSI_CMD_SAME_AR 0x3
37
38
39 #define FSI_RESP_ACK 0
40 #define FSI_RESP_BUSY 1
41 #define FSI_RESP_ERRA 2
42 #define FSI_RESP_ERRC 3
43
44
45 #define FSI_CRC_SIZE 4
46
47
48 #define FSI_MASTER_FLAG_SWCLOCK 0x1
49
50 struct fsi_master {
51 struct device dev;
52 int idx;
53 int n_links;
54 int flags;
55 struct mutex scan_lock;
56 int (*read)(struct fsi_master *, int link, uint8_t id,
57 uint32_t addr, void *val, size_t size);
58 int (*write)(struct fsi_master *, int link, uint8_t id,
59 uint32_t addr, const void *val, size_t size);
60 int (*term)(struct fsi_master *, int link, uint8_t id);
61 int (*send_break)(struct fsi_master *, int link);
62 int (*link_enable)(struct fsi_master *, int link);
63 int (*link_config)(struct fsi_master *, int link,
64 u8 t_send_delay, u8 t_echo_delay);
65 };
66
67 #define dev_to_fsi_master(d) container_of(d, struct fsi_master, dev)
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84 extern int fsi_master_register(struct fsi_master *master);
85 extern void fsi_master_unregister(struct fsi_master *master);
86
87 extern int fsi_master_rescan(struct fsi_master *master);
88
89 #endif