diff options
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_7220.h')
-rw-r--r-- | drivers/infiniband/hw/qib/qib_7220.h | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/qib/qib_7220.h b/drivers/infiniband/hw/qib/qib_7220.h new file mode 100644 index 000000000000..ea0bfd896f92 --- /dev/null +++ b/drivers/infiniband/hw/qib/qib_7220.h | |||
@@ -0,0 +1,156 @@ | |||
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 | |||
46 | struct qib_chip_specific { | ||
47 | u64 __iomem *cregbase; | ||
48 | u64 *cntrs; | ||
49 | u64 *portcntrs; | ||
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 */ | ||
53 | u64 hwerrmask; | ||
54 | u64 errormask; | ||
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... */ | ||
58 | u32 ncntrs; | ||
59 | u32 nportcntrs; | ||
60 | u32 cntrnamelen; | ||
61 | u32 portcntrnamelen; | ||
62 | u32 numctxts; | ||
63 | u32 rcvegrcnt; | ||
64 | u32 autoneg_tries; | ||
65 | u32 serdes_first_init_done; | ||
66 | u32 sdmabufcnt; | ||
67 | u32 lastbuf_for_pio; | ||
68 | u32 updthresh; /* current AvailUpdThld */ | ||
69 | u32 updthresh_dflt; /* default AvailUpdThld */ | ||
70 | int irq; | ||
71 | u8 presets_needed; | ||
72 | u8 relock_timer_active; | ||
73 | char emsgbuf[128]; | ||
74 | char sdmamsgbuf[192]; | ||
75 | char bitsmsgbuf[64]; | ||
76 | struct timer_list relock_timer; | ||
77 | unsigned int relock_interval; /* in jiffies */ | ||
78 | }; | ||
79 | |||
80 | struct qib_chippport_specific { | ||
81 | struct qib_pportdata pportdata; | ||
82 | wait_queue_head_t autoneg_wait; | ||
83 | struct delayed_work autoneg_work; | ||
84 | struct timer_list chase_timer; | ||
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 | */ | ||
93 | u64 ibdeltainprog; | ||
94 | u64 ibsymdelta; | ||
95 | u64 ibsymsnap; | ||
96 | u64 iblnkerrdelta; | ||
97 | u64 iblnkerrsnap; | ||
98 | u64 ibcctrl; /* kr_ibcctrl shadow */ | ||
99 | u64 ibcddrctrl; /* kr_ibcddrctrl shadow */ | ||
100 | u64 chase_end; | ||
101 | u32 last_delay_mult; | ||
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 | int qib_sd7220_prog_ld(struct qib_devdata *dd, int sdnum, u8 *img, | ||
113 | int len, int offset); | ||
114 | int qib_sd7220_prog_vfy(struct qib_devdata *dd, int sdnum, const u8 *img, | ||
115 | int len, int offset); | ||
116 | void qib_sd7220_clr_ibpar(struct qib_devdata *); | ||
117 | /* | ||
118 | * Below used for sdnum parameter, selecting one of the two sections | ||
119 | * used for PCIe, or the single SerDes used for IB, which is the | ||
120 | * only one currently used | ||
121 | */ | ||
122 | #define IB_7220_SERDES 2 | ||
123 | |||
124 | int qib_sd7220_ib_load(struct qib_devdata *dd); | ||
125 | int qib_sd7220_ib_vfy(struct qib_devdata *dd); | ||
126 | |||
127 | static inline u32 qib_read_kreg32(const struct qib_devdata *dd, | ||
128 | const u16 regno) | ||
129 | { | ||
130 | if (!dd->kregbase || !(dd->flags & QIB_PRESENT)) | ||
131 | return -1; | ||
132 | return readl((u32 __iomem *)&dd->kregbase[regno]); | ||
133 | } | ||
134 | |||
135 | static inline u64 qib_read_kreg64(const struct qib_devdata *dd, | ||
136 | const u16 regno) | ||
137 | { | ||
138 | if (!dd->kregbase || !(dd->flags & QIB_PRESENT)) | ||
139 | return -1; | ||
140 | |||
141 | return readq(&dd->kregbase[regno]); | ||
142 | } | ||
143 | |||
144 | static inline void qib_write_kreg(const struct qib_devdata *dd, | ||
145 | const u16 regno, u64 value) | ||
146 | { | ||
147 | if (dd->kregbase) | ||
148 | writeq(value, &dd->kregbase[regno]); | ||
149 | } | ||
150 | |||
151 | void set_7220_relock_poll(struct qib_devdata *, int); | ||
152 | void shutdown_7220_relock_poll(struct qib_devdata *); | ||
153 | void toggle_7220_rclkrls(struct qib_devdata *); | ||
154 | |||
155 | |||
156 | #endif /* _QIB_7220_H */ | ||