1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef _LINUX_UWB_WHCI_H_
28#define _LINUX_UWB_WHCI_H_
29
30#include <linux/pci.h>
31
32
33
34
35
36
37#define UWBCAPINFO 0x00
38# define UWBCAPINFO_TO_N_CAPS(c) (((c) >> 0) & 0xFull)
39#define UWBCAPDATA(n) (8*(n))
40# define UWBCAPDATA_TO_VERSION(c) (((c) >> 32) & 0xFFFFull)
41# define UWBCAPDATA_TO_OFFSET(c) (((c) >> 18) & 0x3FFFull)
42# define UWBCAPDATA_TO_BAR(c) (((c) >> 16) & 0x3ull)
43# define UWBCAPDATA_TO_SIZE(c) ((((c) >> 8) & 0xFFull) * sizeof(u32))
44# define UWBCAPDATA_TO_CAP_ID(c) (((c) >> 0) & 0xFFull)
45
46
47
48#define UWBCAPDATA_SIZE(n) (8 + 8*(n))
49
50
51
52
53
54
55
56#define URCCMD 0x00
57# define URCCMD_RESET (1 << 31)
58# define URCCMD_RS (1 << 30)
59# define URCCMD_EARV (1 << 29)
60# define URCCMD_ACTIVE (1 << 15)
61# define URCCMD_IWR (1 << 14)
62# define URCCMD_SIZE_MASK 0x00000fff
63#define URCSTS 0x04
64# define URCSTS_EPS (1 << 17)
65# define URCSTS_HALTED (1 << 16)
66# define URCSTS_HSE (1 << 10)
67# define URCSTS_ER (1 << 9)
68# define URCSTS_RCI (1 << 8)
69# define URCSTS_INT_MASK 0x00000700
70# define URCSTS_ISI 0x000000ff
71#define URCINTR 0x08
72# define URCINTR_EN_ALL 0x000007ff
73#define URCCMDADDR 0x10
74#define URCEVTADDR 0x18
75# define URCEVTADDR_OFFSET_MASK 0xfff
76
77
78
79static inline
80void le_writel(u32 value, void __iomem *addr)
81{
82 iowrite32(value, addr);
83}
84
85
86
87static inline
88u32 le_readl(void __iomem *addr)
89{
90 return ioread32(addr);
91}
92
93
94
95static inline
96void le_writeq(u64 value, void __iomem *addr)
97{
98 iowrite32(value, addr);
99 iowrite32(value >> 32, addr + 4);
100}
101
102
103
104static inline
105u64 le_readq(void __iomem *addr)
106{
107 u64 value;
108 value = ioread32(addr);
109 value |= (u64)ioread32(addr + 4) << 32;
110 return value;
111}
112
113extern int whci_wait_for(struct device *dev, u32 __iomem *reg,
114 u32 mask, u32 result,
115 unsigned long max_ms, const char *tag);
116
117#endif
118