1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef __DDBRIDGE_IO_H__
20#define __DDBRIDGE_IO_H__
21
22#include <linux/io.h>
23
24#include "ddbridge.h"
25
26
27
28static inline u32 ddblreadl(struct ddb_link *link, u32 adr)
29{
30 return readl(link->dev->regs + adr);
31}
32
33static inline void ddblwritel(struct ddb_link *link, u32 val, u32 adr)
34{
35 writel(val, link->dev->regs + adr);
36}
37
38static inline u32 ddbreadl(struct ddb *dev, u32 adr)
39{
40 return readl(dev->regs + adr);
41}
42
43static inline void ddbwritel(struct ddb *dev, u32 val, u32 adr)
44{
45 writel(val, dev->regs + adr);
46}
47
48static inline void ddbcpyto(struct ddb *dev, u32 adr, void *src, long count)
49{
50 return memcpy_toio(dev->regs + adr, src, count);
51}
52
53static inline void ddbcpyfrom(struct ddb *dev, void *dst, u32 adr, long count)
54{
55 return memcpy_fromio(dst, dev->regs + adr, count);
56}
57
58static inline u32 safe_ddbreadl(struct ddb *dev, u32 adr)
59{
60 u32 val = ddbreadl(dev, adr);
61
62
63 if (val == ~0) {
64 dev_err(&dev->pdev->dev, "ddbreadl failure, adr=%08x\n", adr);
65 return 0;
66 }
67
68 return val;
69}
70
71#endif
72