4 * Copyright (c) 2007, 2009, 2010 QLogic Corporation. All rights reserved.
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:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
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.
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
35 /* grab register-defs auto-generated by HW */
36 #include "qib_7220_regs.h"
38 /* The number of eager receive TIDs for context zero. */
39 #define IBA7220_KRCVEGRCNT 2048U
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
46 struct qib_chip_specific {
47 u64 __iomem *cregbase;
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... */
65 u32 serdes_first_init_done;
68 u32 updthresh; /* current AvailUpdThld */
69 u32 updthresh_dflt; /* default AvailUpdThld */
72 u8 relock_timer_active;
76 struct timer_list relock_timer;
77 unsigned int relock_interval; /* in jiffies */
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;
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
98 u64 ibcctrl; /* kr_ibcctrl shadow */
99 u64 ibcddrctrl; /* kr_ibcddrctrl shadow */
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.
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 *);
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
118 #define IB_7220_SERDES 2
120 static inline u32 qib_read_kreg32(const struct qib_devdata *dd,
123 if (!dd->kregbase || !(dd->flags & QIB_PRESENT))
125 return readl((u32 __iomem *)&dd->kregbase[regno]);
128 static inline u64 qib_read_kreg64(const struct qib_devdata *dd,
131 if (!dd->kregbase || !(dd->flags & QIB_PRESENT))
134 return readq(&dd->kregbase[regno]);
137 static inline void qib_write_kreg(const struct qib_devdata *dd,
138 const u16 regno, u64 value)
141 writeq(value, &dd->kregbase[regno]);
144 void set_7220_relock_poll(struct qib_devdata *, int);
145 void shutdown_7220_relock_poll(struct qib_devdata *);
146 void toggle_7220_rclkrls(struct qib_devdata *);
149 #endif /* _QIB_7220_H */