Path: blob/master/drivers/infiniband/hw/qib/qib_7220.h
15112 views
#ifndef _QIB_7220_H1#define _QIB_7220_H2/*3* Copyright (c) 2007, 2009, 2010 QLogic Corporation. All rights reserved.4*5* This software is available to you under a choice of one of two6* licenses. You may choose to be licensed under the terms of the GNU7* General Public License (GPL) Version 2, available from the file8* COPYING in the main directory of this source tree, or the9* OpenIB.org BSD license below:10*11* Redistribution and use in source and binary forms, with or12* without modification, are permitted provided that the following13* conditions are met:14*15* - Redistributions of source code must retain the above16* copyright notice, this list of conditions and the following17* disclaimer.18*19* - Redistributions in binary form must reproduce the above20* copyright notice, this list of conditions and the following21* disclaimer in the documentation and/or other materials22* provided with the distribution.23*24* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,25* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF26* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND27* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS28* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN29* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN30* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE31* SOFTWARE.32*/3334/* grab register-defs auto-generated by HW */35#include "qib_7220_regs.h"3637/* The number of eager receive TIDs for context zero. */38#define IBA7220_KRCVEGRCNT 2048U3940#define IB_7220_LT_STATE_CFGRCVFCFG 0x0941#define IB_7220_LT_STATE_CFGWAITRMT 0x0a42#define IB_7220_LT_STATE_TXREVLANES 0x0d43#define IB_7220_LT_STATE_CFGENH 0x104445struct qib_chip_specific {46u64 __iomem *cregbase;47u64 *cntrs;48u64 *portcntrs;49spinlock_t sdepb_lock; /* serdes EPB bus */50spinlock_t rcvmod_lock; /* protect rcvctrl shadow changes */51spinlock_t gpio_lock; /* RMW of shadows/regs for ExtCtrl and GPIO */52u64 hwerrmask;53u64 errormask;54u64 gpio_out; /* shadow of kr_gpio_out, for rmw ops */55u64 gpio_mask; /* shadow the gpio mask register */56u64 extctrl; /* shadow the gpio output enable, etc... */57u32 ncntrs;58u32 nportcntrs;59u32 cntrnamelen;60u32 portcntrnamelen;61u32 numctxts;62u32 rcvegrcnt;63u32 autoneg_tries;64u32 serdes_first_init_done;65u32 sdmabufcnt;66u32 lastbuf_for_pio;67u32 updthresh; /* current AvailUpdThld */68u32 updthresh_dflt; /* default AvailUpdThld */69int irq;70u8 presets_needed;71u8 relock_timer_active;72char emsgbuf[128];73char sdmamsgbuf[192];74char bitsmsgbuf[64];75struct timer_list relock_timer;76unsigned int relock_interval; /* in jiffies */77};7879struct qib_chippport_specific {80struct qib_pportdata pportdata;81wait_queue_head_t autoneg_wait;82struct delayed_work autoneg_work;83struct timer_list chase_timer;84/*85* these 5 fields are used to establish deltas for IB symbol86* errors and linkrecovery errors. They can be reported on87* some chips during link negotiation prior to INIT, and with88* DDR when faking DDR negotiations with non-IBTA switches.89* The chip counters are adjusted at driver unload if there is90* a non-zero delta.91*/92u64 ibdeltainprog;93u64 ibsymdelta;94u64 ibsymsnap;95u64 iblnkerrdelta;96u64 iblnkerrsnap;97u64 ibcctrl; /* kr_ibcctrl shadow */98u64 ibcddrctrl; /* kr_ibcddrctrl shadow */99u64 chase_end;100u32 last_delay_mult;101};102103/*104* This header file provides the declarations and common definitions105* for (mostly) manipulation of the SerDes blocks within the IBA7220.106* the functions declared should only be called from within other107* 7220-related files such as qib_iba7220.c or qib_sd7220.c.108*/109int qib_sd7220_presets(struct qib_devdata *dd);110int qib_sd7220_init(struct qib_devdata *dd);111void qib_sd7220_clr_ibpar(struct qib_devdata *);112/*113* Below used for sdnum parameter, selecting one of the two sections114* used for PCIe, or the single SerDes used for IB, which is the115* only one currently used116*/117#define IB_7220_SERDES 2118119static inline u32 qib_read_kreg32(const struct qib_devdata *dd,120const u16 regno)121{122if (!dd->kregbase || !(dd->flags & QIB_PRESENT))123return -1;124return readl((u32 __iomem *)&dd->kregbase[regno]);125}126127static inline u64 qib_read_kreg64(const struct qib_devdata *dd,128const u16 regno)129{130if (!dd->kregbase || !(dd->flags & QIB_PRESENT))131return -1;132133return readq(&dd->kregbase[regno]);134}135136static inline void qib_write_kreg(const struct qib_devdata *dd,137const u16 regno, u64 value)138{139if (dd->kregbase)140writeq(value, &dd->kregbase[regno]);141}142143void set_7220_relock_poll(struct qib_devdata *, int);144void shutdown_7220_relock_poll(struct qib_devdata *);145void toggle_7220_rclkrls(struct qib_devdata *);146147148#endif /* _QIB_7220_H */149150151