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