Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
qib_7220.h
Go to the documentation of this file.
1 #ifndef _QIB_7220_H
2 #define _QIB_7220_H
3 /*
4  * Copyright (c) 2007, 2009, 2010 QLogic Corporation. All rights reserved.
5  *
6  * This software is available to you under a choice of one of two
7  * licenses. You may choose to be licensed under the terms of the GNU
8  * General Public License (GPL) Version 2, available from the file
9  * COPYING in the main directory of this source tree, or the
10  * OpenIB.org BSD license below:
11  *
12  * Redistribution and use in source and binary forms, with or
13  * without modification, are permitted provided that the following
14  * conditions are met:
15  *
16  * - Redistributions of source code must retain the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer.
19  *
20  * - Redistributions in binary form must reproduce the above
21  * copyright notice, this list of conditions and the following
22  * disclaimer in the documentation and/or other materials
23  * provided with the distribution.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32  * SOFTWARE.
33  */
34 
35 /* grab register-defs auto-generated by HW */
36 #include "qib_7220_regs.h"
37 
38 /* The number of eager receive TIDs for context zero. */
39 #define IBA7220_KRCVEGRCNT 2048U
40 
41 #define IB_7220_LT_STATE_CFGRCVFCFG 0x09
42 #define IB_7220_LT_STATE_CFGWAITRMT 0x0a
43 #define IB_7220_LT_STATE_TXREVLANES 0x0d
44 #define IB_7220_LT_STATE_CFGENH 0x10
45 
50  spinlock_t sdepb_lock; /* serdes EPB bus */
51  spinlock_t rcvmod_lock; /* protect rcvctrl shadow changes */
52  spinlock_t gpio_lock; /* RMW of shadows/regs for ExtCtrl and GPIO */
55  u64 gpio_out; /* shadow of kr_gpio_out, for rmw ops */
56  u64 gpio_mask; /* shadow the gpio mask register */
57  u64 extctrl; /* shadow the gpio output enable, etc... */
68  u32 updthresh; /* current AvailUpdThld */
69  u32 updthresh_dflt; /* default AvailUpdThld */
70  int irq;
73  char emsgbuf[128];
74  char sdmamsgbuf[192];
75  char bitsmsgbuf[64];
77  unsigned int relock_interval; /* in jiffies */
78 };
79 
85  /*
86  * these 5 fields are used to establish deltas for IB symbol
87  * errors and linkrecovery errors. They can be reported on
88  * some chips during link negotiation prior to INIT, and with
89  * DDR when faking DDR negotiations with non-IBTA switches.
90  * The chip counters are adjusted at driver unload if there is
91  * a non-zero delta.
92  */
98  u64 ibcctrl; /* kr_ibcctrl shadow */
99  u64 ibcddrctrl; /* kr_ibcddrctrl shadow */
100  unsigned long chase_end;
102 };
103 
104 /*
105  * This header file provides the declarations and common definitions
106  * for (mostly) manipulation of the SerDes blocks within the IBA7220.
107  * the functions declared should only be called from within other
108  * 7220-related files such as qib_iba7220.c or qib_sd7220.c.
109  */
110 int qib_sd7220_presets(struct qib_devdata *dd);
111 int qib_sd7220_init(struct qib_devdata *dd);
112 void qib_sd7220_clr_ibpar(struct qib_devdata *);
113 /*
114  * Below used for sdnum parameter, selecting one of the two sections
115  * used for PCIe, or the single SerDes used for IB, which is the
116  * only one currently used
117  */
118 #define IB_7220_SERDES 2
119 
120 static inline u32 qib_read_kreg32(const struct qib_devdata *dd,
121  const u16 regno)
122 {
123  if (!dd->kregbase || !(dd->flags & QIB_PRESENT))
124  return -1;
125  return readl((u32 __iomem *)&dd->kregbase[regno]);
126 }
127 
128 static inline u64 qib_read_kreg64(const struct qib_devdata *dd,
129  const u16 regno)
130 {
131  if (!dd->kregbase || !(dd->flags & QIB_PRESENT))
132  return -1;
133 
134  return readq(&dd->kregbase[regno]);
135 }
136 
137 static inline void qib_write_kreg(const struct qib_devdata *dd,
138  const u16 regno, u64 value)
139 {
140  if (dd->kregbase)
141  writeq(value, &dd->kregbase[regno]);
142 }
143 
144 void set_7220_relock_poll(struct qib_devdata *, int);
146 void toggle_7220_rclkrls(struct qib_devdata *);
147 
148 
149 #endif /* _QIB_7220_H */