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