1
2
3
4
5
6
7
8
9
10
11
12#ifndef _MIC_BUS_H_
13#define _MIC_BUS_H_
14
15
16
17
18#include <linux/interrupt.h>
19#include <linux/dma-mapping.h>
20
21struct mbus_device_id {
22 __u32 device;
23 __u32 vendor;
24};
25
26#define MBUS_DEV_DMA_HOST 2
27#define MBUS_DEV_DMA_MIC 3
28#define MBUS_DEV_ANY_ID 0xffffffff
29
30
31
32
33
34
35
36
37
38
39struct mbus_device {
40 void __iomem *mmio_va;
41 struct mbus_hw_ops *hw_ops;
42 struct mbus_device_id id;
43 struct device dev;
44 int index;
45};
46
47
48
49
50
51
52
53
54struct mbus_driver {
55 struct device_driver driver;
56 const struct mbus_device_id *id_table;
57 int (*probe)(struct mbus_device *dev);
58 void (*scan)(struct mbus_device *dev);
59 void (*remove)(struct mbus_device *dev);
60};
61
62
63
64
65struct mic_irq;
66
67
68
69
70struct mbus_hw_ops {
71 struct mic_irq* (*request_threaded_irq)(struct mbus_device *mbdev,
72 irq_handler_t handler,
73 irq_handler_t thread_fn,
74 const char *name, void *data,
75 int intr_src);
76 void (*free_irq)(struct mbus_device *mbdev,
77 struct mic_irq *cookie, void *data);
78 void (*ack_interrupt)(struct mbus_device *mbdev, int num);
79};
80
81struct mbus_device *
82mbus_register_device(struct device *pdev, int id, const struct dma_map_ops *dma_ops,
83 struct mbus_hw_ops *hw_ops, int index,
84 void __iomem *mmio_va);
85void mbus_unregister_device(struct mbus_device *mbdev);
86
87int mbus_register_driver(struct mbus_driver *drv);
88void mbus_unregister_driver(struct mbus_driver *drv);
89
90static inline struct mbus_device *dev_to_mbus(struct device *_dev)
91{
92 return container_of(_dev, struct mbus_device, dev);
93}
94
95static inline struct mbus_driver *drv_to_mbus(struct device_driver *drv)
96{
97 return container_of(drv, struct mbus_driver, driver);
98}
99
100#endif
101