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
28
29
30
31
32
33
34
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/* EP80579 LEB: configuration and access to an XHFC-4SU via CS0.
*
* Copyright (C) 2010,2012 Avencall
* Authors:
* Noe Rubinstein <nrubinstein@proformatique.com>
* Guillaume Knispel <gknispel@proformatique.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
#ifndef _XHFC_LEB_H_
#define _XHFC_LEB_H_
#include <linux/kernel.h>
#include <linux/pci.h>
#include "xhfc.h"
#define LEB_CSRBAR 0
#define LEB_MMBAR 1
void leb_init(struct xhfc_pi *leb);
static inline u8 read_xhfc(struct xhfc *xhfc, u8 reg_addr)
{
u8 __iomem *cs_n0 = xhfc->pi->cs_n0;
return readb(&cs_n0[reg_addr]);
}
static inline void write_xhfc(struct xhfc *xhfc, u8 reg_addr, u8 value)
{
u8 __iomem *cs_n0 = xhfc->pi->cs_n0;
writeb(value, &cs_n0[reg_addr]);
}
static inline void write_xhfc_soft_conf(struct xhfc *xhfc, u8 soft_conf)
{
u8 __iomem *cs_n1 = xhfc->pi->cs_n1;
writeb(soft_conf, &cs_n1[0]);
/* ensure the write has been completed: */
(void)readb(&cs_n1[0]);
}
#if 0
#ifdef DEBUG
#define read_xhfc(x, reg) ({ \
u8 _res = read_xhfc(x, reg); \
if (DBG_REGS) printk(KERN_INFO #reg " -> %02x\n", _res);\
_res; \
})
#define write_xhfc(x, reg, val) ({ \
if (DBG_REGS) printk(KERN_INFO #reg " <- %02x\n", val); \
write_xhfc(x, reg, val); \
})
#endif
#endif
struct tlp_leb_regs {
u32 timing_cs[8];
u32 cnfg0;
u32 _rsvd1[63];
u32 parity_status;
};
#endif /* _XHFC_LEB_H_ */
|