This source file includes following definitions.
- dev_to_scif
- drv_to_scif
1
2
3
4
5
6
7
8
9 #ifndef _SCIF_BUS_H_
10 #define _SCIF_BUS_H_
11
12
13
14
15 #include <linux/dma-mapping.h>
16
17 #include <linux/mic_common.h>
18 #include "../common/mic_dev.h"
19
20 struct scif_hw_dev_id {
21 u32 device;
22 u32 vendor;
23 };
24
25 #define MIC_SCIF_DEV 1
26 #define SCIF_DEV_ANY_ID 0xffffffff
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 struct scif_hw_dev {
45 struct scif_hw_ops *hw_ops;
46 struct scif_hw_dev_id id;
47 struct mic_mw *mmio;
48 struct mic_mw *aper;
49 struct device dev;
50 u8 dnode;
51 u8 snode;
52 void *dp;
53 void __iomem *rdp;
54 struct dma_chan **dma_ch;
55 int num_dma_ch;
56 bool card_rel_da;
57 };
58
59
60
61
62
63
64
65
66 struct scif_driver {
67 struct device_driver driver;
68 const struct scif_hw_dev_id *id_table;
69 int (*probe)(struct scif_hw_dev *dev);
70 void (*remove)(struct scif_hw_dev *dev);
71 };
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86 struct scif_hw_ops {
87 int (*next_db)(struct scif_hw_dev *sdev);
88 struct mic_irq * (*request_irq)(struct scif_hw_dev *sdev,
89 irqreturn_t (*func)(int irq,
90 void *data),
91 const char *name, void *data,
92 int db);
93 void (*free_irq)(struct scif_hw_dev *sdev,
94 struct mic_irq *cookie, void *data);
95 void (*ack_interrupt)(struct scif_hw_dev *sdev, int num);
96 void (*send_intr)(struct scif_hw_dev *sdev, int db);
97 void (*send_p2p_intr)(struct scif_hw_dev *sdev, int db,
98 struct mic_mw *mw);
99 void __iomem * (*remap)(struct scif_hw_dev *sdev,
100 phys_addr_t pa, size_t len);
101 void (*unmap)(struct scif_hw_dev *sdev, void __iomem *va);
102 };
103
104 int scif_register_driver(struct scif_driver *driver);
105 void scif_unregister_driver(struct scif_driver *driver);
106 struct scif_hw_dev *
107 scif_register_device(struct device *pdev, int id,
108 const struct dma_map_ops *dma_ops,
109 struct scif_hw_ops *hw_ops, u8 dnode, u8 snode,
110 struct mic_mw *mmio, struct mic_mw *aper,
111 void *dp, void __iomem *rdp,
112 struct dma_chan **chan, int num_chan,
113 bool card_rel_da);
114 void scif_unregister_device(struct scif_hw_dev *sdev);
115
116 static inline struct scif_hw_dev *dev_to_scif(struct device *dev)
117 {
118 return container_of(dev, struct scif_hw_dev, dev);
119 }
120
121 static inline struct scif_driver *drv_to_scif(struct device_driver *drv)
122 {
123 return container_of(drv, struct scif_driver, driver);
124 }
125 #endif