1
2
3
4
5
6
7
8
9#ifndef _MIC_DEVICE_H_
10#define _MIC_DEVICE_H_
11
12#include <linux/cdev.h>
13#include <linux/idr.h>
14#include <linux/notifier.h>
15#include <linux/irqreturn.h>
16#include <linux/dmaengine.h>
17#include <linux/miscdevice.h>
18#include <linux/mic_bus.h>
19#include "../bus/scif_bus.h"
20#include "../bus/vop_bus.h"
21#include "../bus/cosm_bus.h"
22#include "mic_intr.h"
23
24
25
26
27enum mic_stepping {
28 MIC_A0_STEP = 0x0,
29 MIC_B0_STEP = 0x10,
30 MIC_B1_STEP = 0x11,
31 MIC_C0_STEP = 0x20,
32};
33
34extern struct cosm_hw_ops cosm_hw_ops;
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63struct mic_device {
64 struct mic_mw mmio;
65 struct mic_mw aper;
66 enum mic_hw_family family;
67 struct mic_hw_ops *ops;
68 int id;
69 enum mic_stepping stepping;
70 struct pci_dev *pdev;
71 struct mutex mic_mutex;
72 struct mic_hw_intr_ops *intr_ops;
73 struct mic_smpt_ops *smpt_ops;
74 struct mic_smpt_info *smpt;
75 struct mic_intr_info *intr_info;
76 struct mic_irq_info irq_info;
77 struct dentry *dbg_dir;
78 u32 bootaddr;
79 void *dp;
80 dma_addr_t dp_dma_addr;
81 struct mbus_device *dma_mbdev;
82 struct dma_chan *dma_ch[MIC_MAX_DMA_CHAN];
83 int num_dma_ch;
84 struct scif_hw_dev *scdev;
85 struct vop_device *vpdev;
86 struct cosm_device *cosm_dev;
87};
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109struct mic_hw_ops {
110 u8 aper_bar;
111 u8 mmio_bar;
112 u32 (*read_spad)(struct mic_device *mdev, unsigned int idx);
113 void (*write_spad)(struct mic_device *mdev, unsigned int idx, u32 val);
114 void (*send_intr)(struct mic_device *mdev, int doorbell);
115 u32 (*ack_interrupt)(struct mic_device *mdev);
116 void (*intr_workarounds)(struct mic_device *mdev);
117 void (*reset)(struct mic_device *mdev);
118 void (*reset_fw_ready)(struct mic_device *mdev);
119 bool (*is_fw_ready)(struct mic_device *mdev);
120 void (*send_firmware_intr)(struct mic_device *mdev);
121 int (*load_mic_fw)(struct mic_device *mdev, const char *buf);
122 u32 (*get_postcode)(struct mic_device *mdev);
123 bool (*dma_filter)(struct dma_chan *chan, void *param);
124};
125
126
127
128
129
130
131
132
133static inline u32 mic_mmio_read(struct mic_mw *mw, u32 offset)
134{
135 return ioread32(mw->va + offset);
136}
137
138
139
140
141
142
143
144
145
146static inline void
147mic_mmio_write(struct mic_mw *mw, u32 val, u32 offset)
148{
149 iowrite32(val, mw->va + offset);
150}
151
152void mic_bootparam_init(struct mic_device *mdev);
153void mic_create_debug_dir(struct mic_device *dev);
154void mic_delete_debug_dir(struct mic_device *dev);
155void __init mic_init_debugfs(void);
156void mic_exit_debugfs(void);
157#endif
158