Lines Matching full:espi

4  * File: espi.c                                                              *
32 #include "espi.h"
79 pr_err("%s: ESPI clock not ready\n", adapter->name); in tricn_init()
108 void t1_espi_intr_enable(struct peespi *espi) in t1_espi_intr_enable() argument
110 u32 enable, pl_intr = readl(espi->adapter->regs + A_PL_ENABLE); in t1_espi_intr_enable()
113 * Cannot enable ESPI interrupts on T1B because HW asserts the in t1_espi_intr_enable()
114 * interrupt incorrectly, namely the driver gets ESPI interrupts in t1_espi_intr_enable()
115 * but no data is actually dropped (can verify this reading the ESPI in t1_espi_intr_enable()
116 * drop registers). Also, once the ESPI interrupt is asserted it in t1_espi_intr_enable()
119 enable = t1_is_T1B(espi->adapter) ? 0 : ESPI_INTR_MASK; in t1_espi_intr_enable()
120 writel(enable, espi->adapter->regs + A_ESPI_INTR_ENABLE); in t1_espi_intr_enable()
121 writel(pl_intr | F_PL_INTR_ESPI, espi->adapter->regs + A_PL_ENABLE); in t1_espi_intr_enable()
124 void t1_espi_intr_clear(struct peespi *espi) in t1_espi_intr_clear() argument
126 readl(espi->adapter->regs + A_ESPI_DIP2_ERR_COUNT); in t1_espi_intr_clear()
127 writel(0xffffffff, espi->adapter->regs + A_ESPI_INTR_STATUS); in t1_espi_intr_clear()
128 writel(F_PL_INTR_ESPI, espi->adapter->regs + A_PL_CAUSE); in t1_espi_intr_clear()
131 void t1_espi_intr_disable(struct peespi *espi) in t1_espi_intr_disable() argument
133 u32 pl_intr = readl(espi->adapter->regs + A_PL_ENABLE); in t1_espi_intr_disable()
135 writel(0, espi->adapter->regs + A_ESPI_INTR_ENABLE); in t1_espi_intr_disable()
136 writel(pl_intr & ~F_PL_INTR_ESPI, espi->adapter->regs + A_PL_ENABLE); in t1_espi_intr_disable()
139 int t1_espi_intr_handler(struct peespi *espi) in t1_espi_intr_handler() argument
141 u32 status = readl(espi->adapter->regs + A_ESPI_INTR_STATUS); in t1_espi_intr_handler()
144 espi->intr_cnt.DIP4_err++; in t1_espi_intr_handler()
146 espi->intr_cnt.rx_drops++; in t1_espi_intr_handler()
148 espi->intr_cnt.tx_drops++; in t1_espi_intr_handler()
150 espi->intr_cnt.rx_ovflw++; in t1_espi_intr_handler()
152 espi->intr_cnt.parity_err++; in t1_espi_intr_handler()
154 espi->intr_cnt.DIP2_parity_err++; in t1_espi_intr_handler()
160 readl(espi->adapter->regs + A_ESPI_DIP2_ERR_COUNT); in t1_espi_intr_handler()
164 * For T1B we need to write 1 to clear ESPI interrupts. For T2+ we in t1_espi_intr_handler()
167 if (status && t1_is_T1B(espi->adapter)) in t1_espi_intr_handler()
169 writel(status, espi->adapter->regs + A_ESPI_INTR_STATUS); in t1_espi_intr_handler()
173 const struct espi_intr_counts *t1_espi_get_intr_counts(struct peespi *espi) in t1_espi_get_intr_counts() argument
175 return &espi->intr_cnt; in t1_espi_get_intr_counts()
228 int t1_espi_init(struct peespi *espi, int mac_type, int nports) in t1_espi_init() argument
231 adapter_t *adapter = espi->adapter; in t1_espi_init()
233 /* Disable ESPI training. MACs that can handle it enable it below. */ in t1_espi_init()
264 espi->misc_ctrl = readl(adapter->regs + A_ESPI_MISC_CONTROL); in t1_espi_init()
265 espi->misc_ctrl &= ~MON_MASK; in t1_espi_init()
266 espi->misc_ctrl |= F_MONITORED_DIRECTION; in t1_espi_init()
268 espi->misc_ctrl |= F_MONITORED_INTERFACE; in t1_espi_init()
269 writel(espi->misc_ctrl, adapter->regs + A_ESPI_MISC_CONTROL); in t1_espi_init()
270 spin_lock_init(&espi->lock); in t1_espi_init()
276 void t1_espi_destroy(struct peespi *espi) in t1_espi_destroy() argument
278 kfree(espi); in t1_espi_destroy()
283 struct peespi *espi = kzalloc(sizeof(*espi), GFP_KERNEL); in t1_espi_create() local
285 if (espi) in t1_espi_create()
286 espi->adapter = adapter; in t1_espi_create()
287 return espi; in t1_espi_create()
293 struct peespi *espi = adapter->espi;
297 spin_lock(&espi->lock);
298 espi->misc_ctrl = (val & ~MON_MASK) |
299 (espi->misc_ctrl & MON_MASK);
300 writel(espi->misc_ctrl, adapter->regs + A_ESPI_MISC_CONTROL);
301 spin_unlock(&espi->lock);
307 struct peespi *espi = adapter->espi; in t1_espi_get_mon() local
315 if (!spin_trylock(&espi->lock)) in t1_espi_get_mon()
318 spin_lock(&espi->lock); in t1_espi_get_mon()
320 if ((sel != (espi->misc_ctrl & MON_MASK))) { in t1_espi_get_mon()
321 writel(((espi->misc_ctrl & ~MON_MASK) | sel), in t1_espi_get_mon()
324 writel(espi->misc_ctrl, adapter->regs + A_ESPI_MISC_CONTROL); in t1_espi_get_mon()
327 spin_unlock(&espi->lock); in t1_espi_get_mon()
338 struct peespi *espi = adapter->espi; in t1_espi_get_mon_t204() local
342 if (!spin_trylock(&espi->lock)) in t1_espi_get_mon_t204()
345 spin_lock(&espi->lock); in t1_espi_get_mon_t204()
347 if ((espi->misc_ctrl & MON_MASK) != F_MONITORED_DIRECTION) { in t1_espi_get_mon_t204()
348 espi->misc_ctrl = (espi->misc_ctrl & ~MON_MASK) | in t1_espi_get_mon_t204()
350 writel(espi->misc_ctrl, adapter->regs + A_ESPI_MISC_CONTROL); in t1_espi_get_mon_t204()
354 writel(espi->misc_ctrl | V_MONITORED_PORT_NUM(i), in t1_espi_get_mon_t204()
360 writel(espi->misc_ctrl, adapter->regs + A_ESPI_MISC_CONTROL); in t1_espi_get_mon_t204()
361 spin_unlock(&espi->lock); in t1_espi_get_mon_t204()