Daeseok Youn | 1dd3cdc | 2014-05-09 19:10:07 +0900 | [diff] [blame] | 1 | static unsigned int max_intcnt; |
| 2 | static unsigned int max_bh; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 3 | |
| 4 | /*----------------------------------------------------------------------------- |
| 5 | * musycc.c - |
| 6 | * |
| 7 | * Copyright (C) 2007 One Stop Systems, Inc. |
| 8 | * Copyright (C) 2003-2006 SBE, Inc. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * For further information, contact via email: support@onestopsystems.com |
| 21 | * One Stop Systems, Inc. Escondido, California U.S.A. |
| 22 | *----------------------------------------------------------------------------- |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 23 | */ |
| 24 | |
Joe Perches | e6e4d05 | 2010-05-03 11:02:44 -0700 | [diff] [blame] | 25 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 26 | |
| 27 | #include <linux/types.h> |
| 28 | #include "pmcc4_sysdep.h" |
| 29 | #include <linux/kernel.h> |
| 30 | #include <linux/errno.h> |
| 31 | #include <linux/init.h> |
| 32 | #include "sbecom_inline_linux.h" |
| 33 | #include "libsbew.h" |
| 34 | #include "pmcc4_private.h" |
| 35 | #include "pmcc4.h" |
| 36 | #include "musycc.h" |
| 37 | |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 38 | #define sd_find_chan(ci,ch) c4_find_chan(ch) |
| 39 | |
| 40 | |
| 41 | /*******************************************************************/ |
| 42 | /* global driver variables */ |
| 43 | extern ci_t *c4_list; |
| 44 | extern int drvr_state; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 45 | |
Bob Beers | c694ed8 | 2010-10-16 18:06:36 -0400 | [diff] [blame] | 46 | extern int cxt1e1_max_mru; |
| 47 | extern int cxt1e1_max_mtu; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 48 | extern int max_rxdesc_used; |
| 49 | extern int max_txdesc_used; |
| 50 | extern ci_t *CI; /* dummy pointr to board ZEROE's data - DEBUG |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 51 | * USAGE */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 52 | |
| 53 | |
| 54 | /*******************************************************************/ |
| 55 | /* forward references */ |
Johan Meiring | 77c84b2 | 2012-11-20 19:28:48 +0200 | [diff] [blame] | 56 | void c4_fifo_free(mpi_t *, int); |
| 57 | void c4_wk_chan_restart(mch_t *); |
| 58 | void musycc_bh_tx_eom(mpi_t *, int); |
| 59 | int musycc_chan_up(ci_t *, int); |
| 60 | status_t __init musycc_init(ci_t *); |
Johan Meiring | 77c84b2 | 2012-11-20 19:28:48 +0200 | [diff] [blame] | 61 | void musycc_intr_bh_tasklet(ci_t *); |
| 62 | void musycc_serv_req(mpi_t *, u_int32_t); |
| 63 | void musycc_update_timeslots(mpi_t *); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 64 | |
| 65 | /*******************************************************************/ |
| 66 | |
Shaun Laing | 37ca35c | 2013-08-09 07:54:24 -0600 | [diff] [blame] | 67 | static int |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 68 | musycc_dump_rxbuffer_ring(mch_t *ch, int lockit) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 69 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 70 | struct mdesc *m; |
| 71 | unsigned long flags = 0; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 72 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 73 | u_int32_t status; |
| 74 | int n; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 75 | |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 76 | #ifdef RLD_DUMP_BUFDATA |
| 77 | u_int32_t *dp; |
| 78 | int len = 0; |
| 79 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 80 | if (lockit) |
| 81 | spin_lock_irqsave(&ch->ch_rxlock, flags); |
| 82 | if (ch->rxd_num == 0) |
| 83 | pr_info(" ZERO receive buffers allocated for this channel."); |
| 84 | else { |
| 85 | FLUSH_MEM_READ(); |
| 86 | m = &ch->mdr[ch->rxix_irq_srv]; |
| 87 | for (n = ch->rxd_num; n; n--) { |
| 88 | status = le32_to_cpu(m->status); |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 89 | pr_info("%c %08lx[%2d]: sts %08x (%c%c%c%c:%d.) Data [%08x] Next [%08x]\n", |
| 90 | (m == &ch->mdr[ch->rxix_irq_srv]) ? 'F' : ' ', |
| 91 | (unsigned long) m, n, |
| 92 | status, |
| 93 | m->data ? (status & HOST_RX_OWNED ? 'H' : 'M') : '-', |
| 94 | status & POLL_DISABLED ? 'P' : '-', |
| 95 | status & EOBIRQ_ENABLE ? 'b' : '-', |
| 96 | status & EOMIRQ_ENABLE ? 'm' : '-', |
| 97 | status & LENGTH_MASK, |
| 98 | le32_to_cpu(m->data), le32_to_cpu(m->next)); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 99 | #ifdef RLD_DUMP_BUFDATA |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 100 | len = status & LENGTH_MASK; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 101 | |
| 102 | #if 1 |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 103 | if (m->data && (status & HOST_RX_OWNED)) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 104 | #else |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 105 | /* always dump regardless of valid RX data */ |
| 106 | if (m->data) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 107 | #endif |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 108 | { |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 109 | dp = (u_int32_t *)OS_phystov((void *)(le32_to_cpu(m->data))); |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 110 | if (len >= 0x10) |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 111 | pr_info(" %x[%x]: %08X %08X %08X %08x\n", |
| 112 | (u_int32_t)dp, len, |
| 113 | *dp, *(dp + 1), |
| 114 | *(dp + 2), *(dp + 3)); |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 115 | else if (len >= 0x08) |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 116 | pr_info(" %x[%x]: %08X %08X\n", |
| 117 | (u_int32_t)dp, len, |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 118 | *dp, *(dp + 1)); |
| 119 | else |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 120 | pr_info(" %x[%x]: %08X\n", |
| 121 | (u_int32_t)dp, |
| 122 | len, *dp); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 123 | } |
| 124 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 125 | m = m->snext; |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 126 | } |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 127 | } |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 128 | pr_info("\n"); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 129 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 130 | if (lockit) |
| 131 | spin_unlock_irqrestore(&ch->ch_rxlock, flags); |
| 132 | return 0; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 133 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 134 | |
Shaun Laing | 37ca35c | 2013-08-09 07:54:24 -0600 | [diff] [blame] | 135 | static int |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 136 | musycc_dump_txbuffer_ring(mch_t *ch, int lockit) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 137 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 138 | struct mdesc *m; |
| 139 | unsigned long flags = 0; |
| 140 | u_int32_t status; |
| 141 | int n; |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 142 | #ifdef RLD_DUMP_BUFDATA |
| 143 | u_int32_t *dp; |
| 144 | int len = 0; |
| 145 | #endif |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 146 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 147 | if (lockit) |
| 148 | spin_lock_irqsave(&ch->ch_txlock, flags); |
| 149 | if (ch->txd_num == 0) |
| 150 | pr_info(" ZERO transmit buffers allocated for this channel."); |
| 151 | else { |
| 152 | FLUSH_MEM_READ(); |
| 153 | m = ch->txd_irq_srv; |
| 154 | for (n = ch->txd_num; n; n--) { |
| 155 | status = le32_to_cpu(m->status); |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 156 | pr_info("%c%c %08lx[%2d]: sts %08x (%c%c%c%c:%d.) Data [%08x] Next [%08x]\n", |
| 157 | (m == ch->txd_usr_add) ? 'F' : ' ', |
| 158 | (m == ch->txd_irq_srv) ? 'L' : ' ', |
| 159 | (unsigned long) m, n, |
| 160 | status, |
| 161 | m->data ? (status & MUSYCC_TX_OWNED ? 'M' : 'H') : '-', |
| 162 | status & POLL_DISABLED ? 'P' : '-', |
| 163 | status & EOBIRQ_ENABLE ? 'b' : '-', |
| 164 | status & EOMIRQ_ENABLE ? 'm' : '-', |
| 165 | status & LENGTH_MASK, |
| 166 | le32_to_cpu(m->data), le32_to_cpu(m->next)); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 167 | #ifdef RLD_DUMP_BUFDATA |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 168 | len = status & LENGTH_MASK; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 169 | |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 170 | if (m->data) { |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 171 | dp = (u_int32_t *)OS_phystov((void *)(le32_to_cpu(m->data))); |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 172 | if (len >= 0x10) |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 173 | pr_info(" %x[%x]: %08X %08X %08X %08x\n", |
| 174 | (u_int32_t) dp, len, |
| 175 | *dp, *(dp + 1), |
| 176 | *(dp + 2), *(dp + 3)); |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 177 | else if (len >= 0x08) |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 178 | pr_info(" %x[%x]: %08X %08X\n", |
| 179 | (u_int32_t)dp, len, |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 180 | *dp, *(dp + 1)); |
| 181 | else |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 182 | pr_info(" %x[%x]: %08X\n", |
| 183 | (u_int32_t)dp, len, *dp); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 184 | } |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 185 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 186 | m = m->snext; |
| 187 | } |
| 188 | } /* -for- */ |
| 189 | pr_info("\n"); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 190 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 191 | if (lockit) |
| 192 | spin_unlock_irqrestore(&ch->ch_txlock, flags); |
| 193 | return 0; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 194 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 195 | |
| 196 | /* |
| 197 | * The following supports a backdoor debug facility which can be used to |
| 198 | * display the state of a board's channel. |
| 199 | */ |
| 200 | |
| 201 | status_t |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 202 | musycc_dump_ring(ci_t *ci, unsigned int chan) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 203 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 204 | mch_t *ch; |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 205 | int bh; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 206 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 207 | if (chan >= MAX_CHANS_USED) |
| 208 | return SBE_DRVR_FAIL; /* E2BIG */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 209 | |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 210 | bh = atomic_read(&ci->bh_pending); |
| 211 | pr_info(">> bh_pend %d [%d] ihead %d itail %d [%d] th_cnt %d bh_cnt %d wdcnt %d note %d\n", |
| 212 | bh, max_bh, ci->iqp_headx, ci->iqp_tailx, max_intcnt, |
| 213 | ci->intlog.drvr_intr_thcount, |
| 214 | ci->intlog.drvr_intr_bhcount, |
| 215 | ci->wdcount, ci->wd_notify); |
| 216 | max_bh = 0; /* reset counter */ |
| 217 | max_intcnt = 0; /* reset counter */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 218 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 219 | ch = sd_find_chan(dummy, chan); |
| 220 | if (!ch) { |
| 221 | pr_info(">> musycc_dump_ring: channel %d not up.\n", chan); |
| 222 | return ENOENT; |
| 223 | } |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 224 | pr_info(">> CI %p CHANNEL %3d @ %p: state %x status/p %x/%x\n", |
| 225 | ci, chan, ch, ch->state, |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 226 | ch->status, ch->p.status); |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 227 | pr_info("--------------------------------\n"); |
| 228 | pr_info("TX Buffer Ring - Channel %d, txd_num %d. (bd/ch pend %d %d), TXD required %d, txpkt %lu\n", |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 229 | chan, ch->txd_num, |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 230 | (u_int32_t)atomic_read(&ci->tx_pending), |
| 231 | (u_int32_t)atomic_read(&ch->tx_pending), |
| 232 | ch->txd_required, ch->s.tx_packets); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 233 | pr_info("++ User 0x%p IRQ_SRV 0x%p USR_ADD 0x%p QStopped %x, start_tx %x tx_full %d txd_free %d mode %x\n", |
| 234 | ch->user, ch->txd_irq_srv, ch->txd_usr_add, |
| 235 | sd_queue_stopped(ch->user), |
| 236 | ch->ch_start_tx, ch->tx_full, ch->txd_free, ch->p.chan_mode); |
| 237 | musycc_dump_txbuffer_ring(ch, 1); |
| 238 | pr_info("RX Buffer Ring - Channel %d, rxd_num %d. IRQ_SRV[%d] 0x%p, start_rx %x rxpkt %lu\n", |
| 239 | chan, ch->rxd_num, ch->rxix_irq_srv, |
| 240 | &ch->mdr[ch->rxix_irq_srv], ch->ch_start_rx, ch->s.rx_packets); |
| 241 | musycc_dump_rxbuffer_ring(ch, 1); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 242 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 243 | return SBE_DRVR_SUCCESS; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | |
| 247 | status_t |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 248 | musycc_dump_rings(ci_t *ci, unsigned int start_chan) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 249 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 250 | unsigned int chan; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 251 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 252 | for (chan = start_chan; chan < (start_chan + 5); chan++) |
| 253 | musycc_dump_ring(ci, chan); |
| 254 | return SBE_DRVR_SUCCESS; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | |
| 258 | /* |
| 259 | * NOTE on musycc_init_mdt(): These MUSYCC writes are only operational after |
| 260 | * a MUSYCC GROUP_INIT command has been issued. |
| 261 | */ |
| 262 | |
| 263 | void |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 264 | musycc_init_mdt(mpi_t *pi) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 265 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 266 | u_int32_t *addr, cfg; |
| 267 | int i; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 268 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 269 | /* |
| 270 | * This Idle Code insertion takes effect prior to channel's first |
| 271 | * transmitted message. After that, each message contains its own Idle |
| 272 | * Code information which is to be issued after the message is |
| 273 | * transmitted (Ref.MUSYCC 5.2.2.3: MCENBL bit in Group Configuration |
| 274 | * Descriptor). |
| 275 | */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 276 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 277 | addr = (u_int32_t *) ((u_long) pi->reg + MUSYCC_MDT_BASE03_ADDR); |
| 278 | cfg = CFG_CH_FLAG_7E << IDLE_CODE; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 279 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 280 | for (i = 0; i < 32; addr++, i++) |
| 281 | pci_write_32(addr, cfg); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | |
| 285 | /* Set TX thp to the next unprocessed md */ |
| 286 | |
| 287 | void |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 288 | musycc_update_tx_thp(mch_t *ch) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 289 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 290 | struct mdesc *md; |
| 291 | unsigned long flags; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 292 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 293 | spin_lock_irqsave(&ch->ch_txlock, flags); |
| 294 | while (1) { |
| 295 | md = ch->txd_irq_srv; |
| 296 | FLUSH_MEM_READ(); |
| 297 | if (!md->data) { |
| 298 | /* No MDs with buffers to process */ |
| 299 | spin_unlock_irqrestore(&ch->ch_txlock, flags); |
| 300 | return; |
| 301 | } |
| 302 | if ((le32_to_cpu(md->status)) & MUSYCC_TX_OWNED) { |
| 303 | /* this is the MD to restart TX with */ |
| 304 | break; |
| 305 | } |
| 306 | /* |
| 307 | * Otherwise, we have a valid, host-owned message descriptor which |
| 308 | * has been successfully transmitted and whose buffer can be freed, |
| 309 | * so... process this MD, it's owned by the host. (This might give |
| 310 | * as a new, updated txd_irq_srv.) |
| 311 | */ |
| 312 | musycc_bh_tx_eom(ch->up, ch->gchan); |
| 313 | } |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 314 | md = ch->txd_irq_srv; |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 315 | ch->up->regram->thp[ch->gchan] = cpu_to_le32(OS_vtophys(md)); |
| 316 | FLUSH_MEM_WRITE(); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 317 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 318 | if (ch->tx_full) { |
| 319 | ch->tx_full = 0; |
| 320 | ch->txd_required = 0; |
| 321 | sd_enable_xmit(ch->user); /* re-enable to catch flow controlled |
| 322 | * channel */ |
| 323 | } |
| 324 | spin_unlock_irqrestore(&ch->ch_txlock, flags); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 325 | |
| 326 | #ifdef RLD_TRANS_DEBUG |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 327 | pr_info("++ musycc_update_tx_thp[%d]: setting thp = %p, sts %x\n", |
| 328 | ch->channum, md, md->status); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 329 | #endif |
| 330 | } |
| 331 | |
| 332 | |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 333 | /* |
| 334 | * This is the workq task executed by the OS when our queue_work() is |
| 335 | * scheduled and run. It can fire off either RX or TX ACTIVATION depending |
| 336 | * upon the channel's ch_start_tx and ch_start_rx variables. This routine |
| 337 | * is implemented as a work queue so that the call to the service request is |
| 338 | * able to sleep, awaiting an interrupt acknowledgment response (SACK) from |
| 339 | * the hardware. |
| 340 | */ |
| 341 | |
| 342 | void |
Johan Meiring | 77c84b2 | 2012-11-20 19:28:48 +0200 | [diff] [blame] | 343 | musycc_wq_chan_restart(void *arg) /* channel private structure */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 344 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 345 | mch_t *ch; |
| 346 | mpi_t *pi; |
| 347 | struct mdesc *md; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 348 | |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 349 | #if defined(RLD_TRANS_DEBUG) || defined(RLD_RXACT_DEBUG) |
| 350 | static int hereb4 = 7; |
| 351 | #endif |
| 352 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 353 | ch = container_of(arg, struct c4_chan_info, ch_work); |
| 354 | pi = ch->up; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 355 | |
| 356 | #ifdef RLD_TRANS_DEBUG |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 357 | pr_info("wq_chan_restart[%d]: start_RT[%d/%d] status %x\n", |
| 358 | ch->channum, ch->ch_start_rx, ch->ch_start_tx, ch->status); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 359 | |
| 360 | #endif |
| 361 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 362 | /**********************************/ |
| 363 | /** check for RX restart request **/ |
| 364 | /**********************************/ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 365 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 366 | if ((ch->ch_start_rx) && (ch->status & RX_ENABLED)) { |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 367 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 368 | ch->ch_start_rx = 0; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 369 | #if defined(RLD_TRANS_DEBUG) || defined(RLD_RXACT_DEBUG) |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 370 | if (hereb4) { /* RLD DEBUG */ |
| 371 | hereb4--; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 372 | #ifdef RLD_TRANS_DEBUG |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 373 | md = &ch->mdr[ch->rxix_irq_srv]; |
| 374 | pr_info("++ musycc_wq_chan_restart[%d] CHAN RX ACTIVATE: rxix_irq_srv %d, md %p sts %x, rxpkt %lu\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 375 | ch->channum, ch->rxix_irq_srv, md, |
| 376 | le32_to_cpu(md->status), ch->s.rx_packets); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 377 | #elif defined(RLD_RXACT_DEBUG) |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 378 | md = &ch->mdr[ch->rxix_irq_srv]; |
| 379 | pr_info("++ musycc_wq_chan_restart[%d] CHAN RX ACTIVATE: rxix_irq_srv %d, md %p sts %x, rxpkt %lu\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 380 | ch->channum, ch->rxix_irq_srv, |
| 381 | md, le32_to_cpu(md->status), |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 382 | ch->s.rx_packets); |
| 383 | musycc_dump_rxbuffer_ring(ch, 1); /* RLD DEBUG */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 384 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 385 | } |
| 386 | #endif |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 387 | musycc_serv_req(pi, SR_CHANNEL_ACTIVATE | |
| 388 | SR_RX_DIRECTION | ch->gchan); |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 389 | } |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 390 | /**********************************/ |
| 391 | /** check for TX restart request **/ |
| 392 | /**********************************/ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 393 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 394 | if ((ch->ch_start_tx) && (ch->status & TX_ENABLED)) { |
| 395 | /* find next unprocessed message, then set TX thp to it */ |
| 396 | musycc_update_tx_thp(ch); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 397 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 398 | md = ch->txd_irq_srv; |
| 399 | if (!md) { |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 400 | #ifdef RLD_TRANS_DEBUG |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 401 | pr_info("-- musycc_wq_chan_restart[%d]: WARNING, starting NULL md\n", |
| 402 | ch->channum); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 403 | #endif |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 404 | } else if (md->data && ((le32_to_cpu(md->status)) & |
| 405 | MUSYCC_TX_OWNED)) { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 406 | ch->ch_start_tx = 0; |
Daeseok Youn | b7923d2 | 2014-05-09 23:54:08 +0900 | [diff] [blame] | 407 | |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 408 | #ifdef RLD_TRANS_DEBUG |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 409 | pr_info("++ musycc_wq_chan_restart() CHAN TX ACTIVATE: chan %d txd_irq_srv %p = sts %x, txpkt %lu\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 410 | ch->channum, ch->txd_irq_srv, |
| 411 | ch->txd_irq_srv->status, ch->s.tx_packets); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 412 | #endif |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 413 | musycc_serv_req(pi, SR_CHANNEL_ACTIVATE | |
| 414 | SR_TX_DIRECTION | ch->gchan); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 415 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 416 | #ifdef RLD_RESTART_DEBUG |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 417 | else { |
| 418 | /* retain request to start until retried and we have data to xmit */ |
| 419 | pr_info("-- musycc_wq_chan_restart[%d]: DELAYED due to md %p sts %x data %x, start_tx %x\n", |
| 420 | ch->channum, md, |
| 421 | le32_to_cpu(md->status), |
| 422 | le32_to_cpu(md->data), ch->ch_start_tx); |
| 423 | musycc_dump_txbuffer_ring(ch, 0); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 424 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 425 | #endif |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 426 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 427 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 428 | |
| 429 | |
| 430 | /* |
| 431 | * Channel restart either fires of a workqueue request (2.6) or lodges a |
| 432 | * watchdog activation sequence (2.4). |
| 433 | */ |
| 434 | |
| 435 | void |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 436 | musycc_chan_restart(mch_t *ch) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 437 | { |
| 438 | #ifdef RLD_RESTART_DEBUG |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 439 | pr_info("++ musycc_chan_restart[%d]: txd_irq_srv @ %p = sts %x\n", |
| 440 | ch->channum, ch->txd_irq_srv, ch->txd_irq_srv->status); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 441 | #endif |
| 442 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 443 | /* 2.6 - find next unprocessed message, then set TX thp to it */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 444 | #ifdef RLD_RESTART_DEBUG |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 445 | pr_info(">> musycc_chan_restart: scheduling Chan %x workQ @ %p\n", |
| 446 | ch->channum, &ch->ch_work); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 447 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 448 | c4_wk_chan_restart(ch); /* work queue mechanism fires off: Ref: |
| 449 | * musycc_wq_chan_restart () */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 453 | void |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 454 | rld_put_led(mpi_t *pi, u_int32_t ledval) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 455 | { |
Daeseok Youn | 1dd3cdc | 2014-05-09 19:10:07 +0900 | [diff] [blame] | 456 | static u_int32_t led; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 457 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 458 | if (ledval == 0) |
| 459 | led = 0; |
| 460 | else |
| 461 | led |= ledval; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 462 | |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 463 | /* RLD DEBUG TRANHANG */ |
| 464 | pci_write_32((u_int32_t *) &pi->up->cpldbase->leds, led); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 465 | } |
| 466 | |
| 467 | |
| 468 | #define MUSYCC_SR_RETRY_CNT 9 |
| 469 | |
| 470 | void |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 471 | musycc_serv_req(mpi_t *pi, u_int32_t req) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 472 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 473 | volatile u_int32_t r; |
| 474 | int rcnt; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 475 | |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 476 | /* |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 477 | * PORT NOTE: Semaphore protect service loop guarantees only a single |
| 478 | * operation at a time. Per MUSYCC Manual - "Issuing service requests to |
| 479 | * the same channel group without first receiving ACK from each request |
| 480 | * may cause the host to lose track of which service request has been |
| 481 | * acknowledged." |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 482 | */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 483 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 484 | SD_SEM_TAKE(&pi->sr_sem_busy, "serv"); /* only 1 thru here, per |
| 485 | * group */ |
| 486 | |
| 487 | if (pi->sr_last == req) { |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 488 | #ifdef RLD_TRANS_DEBUG |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 489 | pr_info(">> same SR, Port %d Req %x\n", pi->portnum, req); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 490 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 491 | |
| 492 | /* |
| 493 | * The most likely repeated request is the channel activation command |
| 494 | * which follows the occurrence of a Transparent mode TX ONR or a |
| 495 | * BUFF error. If the previous command was a CHANNEL ACTIVATE, |
| 496 | * precede it with a NOOP command in order maintain coherent control |
| 497 | * of this current (re)ACTIVATE. |
| 498 | */ |
| 499 | |
| 500 | r = (pi->sr_last & ~SR_GCHANNEL_MASK); |
| 501 | if ((r == (SR_CHANNEL_ACTIVATE | SR_TX_DIRECTION)) || |
| 502 | (r == (SR_CHANNEL_ACTIVATE | SR_RX_DIRECTION))) { |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 503 | #ifdef RLD_TRANS_DEBUG |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 504 | pr_info(">> same CHAN ACT SR, Port %d Req %x => issue SR_NOOP CMD\n", pi->portnum, req); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 505 | #endif |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 506 | /* allow this next request */ |
| 507 | SD_SEM_GIVE(&pi->sr_sem_busy); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 508 | musycc_serv_req(pi, SR_NOOP); |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 509 | /* relock & continue w/ original req */ |
| 510 | SD_SEM_TAKE(&pi->sr_sem_busy, "serv"); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 511 | } else if (req == SR_NOOP) { |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 512 | /* no need to issue back-to-back |
| 513 | * SR_NOOP commands at this time |
| 514 | */ |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 515 | #ifdef RLD_TRANS_DEBUG |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 516 | pr_info(">> same Port SR_NOOP skipped, Port %d\n", |
| 517 | pi->portnum); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 518 | #endif |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 519 | /* allow this next request */ |
| 520 | SD_SEM_GIVE(&pi->sr_sem_busy); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 521 | return; |
| 522 | } |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 523 | } |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 524 | rcnt = 0; |
| 525 | pi->sr_last = req; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 526 | rewrite: |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 527 | pci_write_32((u_int32_t *) &pi->reg->srd, req); |
| 528 | FLUSH_MEM_WRITE(); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 529 | |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 530 | /* |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 531 | * Per MUSYCC Manual, Section 6.1,2 - "When writing an SCR service |
| 532 | * request, the host must ensure at least one PCI bus clock cycle has |
| 533 | * elapsed before writing another service request. To meet this minimum |
| 534 | * elapsed service request write timing interval, it is recommended that |
| 535 | * the host follow any SCR write with another operation which reads from |
| 536 | * the same address." |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 537 | */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 538 | |
| 539 | /* adhere to write timing imposition */ |
| 540 | r = pci_read_32((u_int32_t *) &pi->reg->srd); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 541 | |
| 542 | |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 543 | if ((r != req) && (req != SR_CHIP_RESET) && |
| 544 | (++rcnt <= MUSYCC_SR_RETRY_CNT)) { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 545 | if (cxt1e1_log_level >= LOG_MONITOR) |
| 546 | pr_info("%s: %d - reissue srv req/last %x/%x (hdw reads %x), Chan %d.\n", |
| 547 | pi->up->devname, rcnt, req, pi->sr_last, r, |
| 548 | (pi->portnum * MUSYCC_NCHANS) + (req & 0x1f)); |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 549 | /* this delay helps reduce reissue counts |
| 550 | * (reason not yet researched) |
| 551 | */ |
| 552 | OS_uwait_dummy(); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 553 | goto rewrite; |
| 554 | } |
| 555 | if (rcnt > MUSYCC_SR_RETRY_CNT) { |
| 556 | pr_warning("%s: failed service request (#%d)= %x, group %d.\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 557 | pi->up->devname, MUSYCC_SR_RETRY_CNT, |
| 558 | req, pi->portnum); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 559 | SD_SEM_GIVE(&pi->sr_sem_busy); /* allow any next request */ |
| 560 | return; |
| 561 | } |
| 562 | if (req == SR_CHIP_RESET) { |
| 563 | /* |
| 564 | * PORT NOTE: the CHIP_RESET command is NOT ack'd by the MUSYCC, thus |
| 565 | * the upcoming delay is used. Though the MUSYCC documentation |
| 566 | * suggests a read-after-write would supply the required delay, it's |
| 567 | * unclear what CPU/BUS clock speeds might have been assumed when |
| 568 | * suggesting this 'lack of ACK' workaround. Thus the use of uwait. |
| 569 | */ |
| 570 | OS_uwait(100000, "icard"); /* 100ms */ |
| 571 | } else { |
| 572 | FLUSH_MEM_READ(); |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 573 | /* sleep until SACK interrupt occurs */ |
| 574 | SD_SEM_TAKE(&pi->sr_sem_wait, "sakack"); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 575 | } |
| 576 | SD_SEM_GIVE(&pi->sr_sem_busy); /* allow any next request */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | |
| 580 | #ifdef SBE_PMCC4_ENABLE |
| 581 | void |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 582 | musycc_update_timeslots(mpi_t *pi) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 583 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 584 | int i, ch; |
| 585 | char e1mode = IS_FRAME_ANY_E1(pi->p.port_mode); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 586 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 587 | for (i = 0; i < 32; i++) { |
| 588 | int usedby = 0, last = 0, ts, j, bits[8]; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 589 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 590 | u_int8_t lastval = 0; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 591 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 592 | if (((i == 0) && e1mode) || /* disable if E1 mode */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 593 | ((i == 16) && ((pi->p.port_mode == CFG_FRAME_E1CRC_CAS) || |
| 594 | (pi->p.port_mode == CFG_FRAME_E1CRC_CAS_AMI))) || |
| 595 | ((i > 23) && (!e1mode))) /* disable if T1 mode */ |
| 596 | /* make tslot unavailable for this mode */ |
| 597 | pi->tsm[i] = 0xff; |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 598 | else |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 599 | /* make tslot available for assignment */ |
| 600 | pi->tsm[i] = 0x00; |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 601 | for (j = 0; j < 8; j++) |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 602 | bits[j] = -1; |
| 603 | for (ch = 0; ch < MUSYCC_NCHANS; ch++) { |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 604 | if ((pi->chan[ch]->state == UP) && |
| 605 | (pi->chan[ch]->p.bitmask[i])) { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 606 | usedby++; |
| 607 | last = ch; |
| 608 | lastval = pi->chan[ch]->p.bitmask[i]; |
| 609 | for (j = 0; j < 8; j++) |
| 610 | if (lastval & (1 << j)) |
| 611 | bits[j] = ch; |
| 612 | pi->tsm[i] |= lastval; |
| 613 | } |
| 614 | } |
| 615 | if (!usedby) |
| 616 | ts = 0; |
| 617 | else if ((usedby == 1) && (lastval == 0xff)) |
| 618 | ts = (4 << 5) | last; |
| 619 | else if ((usedby == 1) && (lastval == 0x7f)) |
| 620 | ts = (5 << 5) | last; |
| 621 | else { |
| 622 | int idx; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 623 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 624 | if (bits[0] < 0) |
| 625 | ts = (6 << 5) | (idx = last); |
| 626 | else |
| 627 | ts = (7 << 5) | (idx = bits[0]); |
| 628 | for (j = 1; j < 8; j++) { |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 629 | pi->regram->rscm[idx * 8 + j] = |
| 630 | (bits[j] < 0) ? 0 : (0x80 | bits[j]); |
| 631 | pi->regram->tscm[idx * 8 + j] = |
| 632 | (bits[j] < 0) ? 0 : (0x80 | bits[j]); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 633 | } |
| 634 | } |
| 635 | pi->regram->rtsm[i] = ts; |
| 636 | pi->regram->ttsm[i] = ts; |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 637 | } |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 638 | FLUSH_MEM_WRITE(); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 639 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 640 | musycc_serv_req(pi, SR_TIMESLOT_MAP | SR_RX_DIRECTION); |
| 641 | musycc_serv_req(pi, SR_TIMESLOT_MAP | SR_TX_DIRECTION); |
| 642 | musycc_serv_req(pi, SR_SUBCHANNEL_MAP | SR_RX_DIRECTION); |
| 643 | musycc_serv_req(pi, SR_SUBCHANNEL_MAP | SR_TX_DIRECTION); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 644 | } |
| 645 | #endif |
| 646 | |
| 647 | |
| 648 | #ifdef SBE_WAN256T3_ENABLE |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 649 | void |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 650 | musycc_update_timeslots(mpi_t *pi) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 651 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 652 | mch_t *ch; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 653 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 654 | u_int8_t ts, hmask, tsen; |
| 655 | int gchan; |
| 656 | int i; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 657 | |
| 658 | #ifdef SBE_PMCC4_ENABLE |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 659 | hmask = (0x1f << pi->up->p.hypersize) & 0x1f; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 660 | #endif |
| 661 | #ifdef SBE_WAN256T3_ENABLE |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 662 | hmask = (0x1f << hyperdummy) & 0x1f; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 663 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 664 | for (i = 0; i < 128; i++) { |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 665 | gchan = ((pi->portnum * MUSYCC_NCHANS) + |
| 666 | (i & hmask)) % MUSYCC_NCHANS; |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 667 | ch = pi->chan[gchan]; |
| 668 | if (ch->p.mode_56k) |
| 669 | tsen = MODE_56KBPS; |
| 670 | else |
| 671 | tsen = MODE_64KBPS; /* also the default */ |
| 672 | ts = ((pi->portnum % 4) == (i / 32)) ? (tsen << 5) | (i & hmask) : 0; |
| 673 | pi->regram->rtsm[i] = ts; |
| 674 | pi->regram->ttsm[i] = ts; |
| 675 | } |
| 676 | FLUSH_MEM_WRITE(); |
| 677 | musycc_serv_req(pi, SR_TIMESLOT_MAP | SR_RX_DIRECTION); |
| 678 | musycc_serv_req(pi, SR_TIMESLOT_MAP | SR_TX_DIRECTION); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 679 | } |
| 680 | #endif |
| 681 | |
| 682 | |
| 683 | /* |
| 684 | * This routine converts a generic library channel configuration parameter |
| 685 | * into a hardware specific register value (IE. MUSYCC CCD Register). |
| 686 | */ |
| 687 | u_int32_t |
Johan Meiring | 77c84b2 | 2012-11-20 19:28:48 +0200 | [diff] [blame] | 688 | musycc_chan_proto(int proto) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 689 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 690 | int reg; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 691 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 692 | switch (proto) { |
| 693 | case CFG_CH_PROTO_TRANS: /* 0 */ |
| 694 | reg = MUSYCC_CCD_TRANS; |
| 695 | break; |
| 696 | case CFG_CH_PROTO_SS7: /* 1 */ |
| 697 | reg = MUSYCC_CCD_SS7; |
| 698 | break; |
| 699 | default: |
| 700 | case CFG_CH_PROTO_ISLP_MODE: /* 4 */ |
| 701 | case CFG_CH_PROTO_HDLC_FCS16: /* 2 */ |
| 702 | reg = MUSYCC_CCD_HDLC_FCS16; |
| 703 | break; |
| 704 | case CFG_CH_PROTO_HDLC_FCS32: /* 3 */ |
| 705 | reg = MUSYCC_CCD_HDLC_FCS32; |
| 706 | break; |
| 707 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 708 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 709 | return reg; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 710 | } |
| 711 | |
| 712 | #ifdef SBE_WAN256T3_ENABLE |
Shaun Laing | 37ca35c | 2013-08-09 07:54:24 -0600 | [diff] [blame] | 713 | static void __init |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 714 | musycc_init_port(mpi_t *pi) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 715 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 716 | pci_write_32((u_int32_t *) &pi->reg->gbp, OS_vtophys(pi->regram)); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 717 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 718 | pi->regram->grcd = |
| 719 | __constant_cpu_to_le32(MUSYCC_GRCD_RX_ENABLE | |
| 720 | MUSYCC_GRCD_TX_ENABLE | |
| 721 | MUSYCC_GRCD_SF_ALIGN | |
| 722 | MUSYCC_GRCD_SUBCHAN_DISABLE | |
| 723 | MUSYCC_GRCD_OOFMP_DISABLE | |
| 724 | MUSYCC_GRCD_COFAIRQ_DISABLE | |
| 725 | MUSYCC_GRCD_MC_ENABLE | |
| 726 | (MUSYCC_GRCD_POLLTH_32 << MUSYCC_GRCD_POLLTH_SHIFT)); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 727 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 728 | pi->regram->pcd = |
| 729 | __constant_cpu_to_le32(MUSYCC_PCD_E1X4_MODE | |
| 730 | MUSYCC_PCD_TXDATA_RISING | |
| 731 | MUSYCC_PCD_TX_DRIVEN); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 732 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 733 | /* Message length descriptor */ |
| 734 | pi->regram->mld = __constant_cpu_to_le32(cxt1e1_max_mru | (cxt1e1_max_mru << 16)); |
| 735 | FLUSH_MEM_WRITE(); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 736 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 737 | musycc_serv_req(pi, SR_GROUP_INIT | SR_RX_DIRECTION); |
| 738 | musycc_serv_req(pi, SR_GROUP_INIT | SR_TX_DIRECTION); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 739 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 740 | musycc_init_mdt(pi); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 741 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 742 | musycc_update_timeslots(pi); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 743 | } |
| 744 | #endif |
| 745 | |
| 746 | |
| 747 | status_t __init |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 748 | musycc_init(ci_t *ci) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 749 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 750 | char *regaddr; /* temp for address boundary calculations */ |
| 751 | int i, gchan; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 752 | |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 753 | OS_sem_init(&ci->sem_wdbusy, SEM_AVAILABLE); /* watchdog exclusion */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 754 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 755 | /* |
| 756 | * Per MUSYCC manual, Section 6.3.4 - "The host must allocate a dword |
| 757 | * aligned memory segment for interrupt queue pointers." |
| 758 | */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 759 | |
| 760 | #define INT_QUEUE_BOUNDARY 4 |
| 761 | |
Daeseok Youn | 693d963 | 2014-04-18 09:31:35 +0900 | [diff] [blame] | 762 | regaddr = kzalloc((INT_QUEUE_SIZE + 1) * sizeof(u_int32_t), |
| 763 | GFP_KERNEL | GFP_DMA); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 764 | if (!regaddr) |
| 765 | return -ENOMEM; |
| 766 | ci->iqd_p_saved = regaddr; /* save orig value for free's usage */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 767 | /* this calculates closest boundary */ |
| 768 | ci->iqd_p = (u_int32_t *) ((unsigned long)(regaddr + INT_QUEUE_BOUNDARY - 1) & |
| 769 | (~(INT_QUEUE_BOUNDARY - 1))); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 770 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 771 | for (i = 0; i < INT_QUEUE_SIZE; i++) |
| 772 | ci->iqd_p[i] = __constant_cpu_to_le32(INT_EMPTY_ENTRY); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 773 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 774 | for (i = 0; i < ci->max_port; i++) { |
| 775 | mpi_t *pi = &ci->port[i]; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 776 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 777 | /* |
| 778 | * Per MUSYCC manual, Section 6.3.2 - "The host must allocate a 2KB |
| 779 | * bound memory segment for Channel Group 0." |
| 780 | */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 781 | |
| 782 | #define GROUP_BOUNDARY 0x800 |
| 783 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 784 | regaddr = kzalloc(sizeof(struct musycc_groupr) + GROUP_BOUNDARY, |
| 785 | GFP_KERNEL | GFP_DMA); |
| 786 | if (!regaddr) { |
| 787 | for (gchan = 0; gchan < i; gchan++) { |
| 788 | pi = &ci->port[gchan]; |
| 789 | kfree(pi->reg); |
| 790 | pi->reg = NULL; |
| 791 | } |
| 792 | return -ENOMEM; |
| 793 | } |
| 794 | pi->regram_saved = regaddr; /* save orig value for free's usage */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 795 | /* this calculates closest boundary */ |
| 796 | pi->regram = (struct musycc_groupr *) ((unsigned long)(regaddr + GROUP_BOUNDARY - 1) & |
| 797 | (~(GROUP_BOUNDARY - 1))); |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 798 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 799 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 800 | /* any board centric MUSYCC commands will use group ZERO as its "home" */ |
| 801 | ci->regram = ci->port[0].regram; |
| 802 | musycc_serv_req(&ci->port[0], SR_CHIP_RESET); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 803 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 804 | pci_write_32((u_int32_t *) &ci->reg->gbp, OS_vtophys(ci->regram)); |
| 805 | pci_flush_write(ci); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 806 | #ifdef CONFIG_SBE_PMCC4_NCOMM |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 807 | ci->regram->__glcd = __constant_cpu_to_le32(GCD_MAGIC); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 808 | #else |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 809 | /* standard driver POLLS for INTB via CPLD register */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 810 | ci->regram->__glcd = __constant_cpu_to_le32(GCD_MAGIC | |
| 811 | MUSYCC_GCD_INTB_DISABLE); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 812 | #endif |
| 813 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 814 | ci->regram->__iqp = cpu_to_le32(OS_vtophys(&ci->iqd_p[0])); |
| 815 | ci->regram->__iql = __constant_cpu_to_le32(INT_QUEUE_SIZE - 1); |
| 816 | pci_write_32((u_int32_t *) &ci->reg->dacbp, 0); |
| 817 | FLUSH_MEM_WRITE(); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 818 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 819 | ci->state = C_RUNNING; /* mark as full interrupt processing |
| 820 | * available */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 821 | |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 822 | musycc_serv_req(&ci->port[0], SR_GLOBAL_INIT); /* FIRST INTERRUPT ! */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 823 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 824 | /* sanity check settable parameters */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 825 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 826 | if (cxt1e1_max_mru > 0xffe) { |
| 827 | pr_warning("Maximum allowed MRU exceeded, resetting %d to %d.\n", |
| 828 | cxt1e1_max_mru, 0xffe); |
| 829 | cxt1e1_max_mru = 0xffe; |
| 830 | } |
| 831 | if (cxt1e1_max_mtu > 0xffe) { |
| 832 | pr_warning("Maximum allowed MTU exceeded, resetting %d to %d.\n", |
| 833 | cxt1e1_max_mtu, 0xffe); |
| 834 | cxt1e1_max_mtu = 0xffe; |
| 835 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 836 | #ifdef SBE_WAN256T3_ENABLE |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 837 | for (i = 0; i < MUSYCC_NPORTS; i++) |
| 838 | musycc_init_port(&ci->port[i]); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 839 | #endif |
| 840 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 841 | return SBE_DRVR_SUCCESS; /* no error */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 842 | } |
| 843 | |
| 844 | |
| 845 | void |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 846 | musycc_bh_tx_eom(mpi_t *pi, int gchan) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 847 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 848 | mch_t *ch; |
| 849 | struct mdesc *md; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 850 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 851 | volatile u_int32_t status; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 852 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 853 | ch = pi->chan[gchan]; |
| 854 | if (!ch || ch->state != UP) { |
| 855 | if (cxt1e1_log_level >= LOG_ERROR) |
| 856 | pr_info("%s: intr: xmit EOM on uninitialized channel %d\n", |
| 857 | pi->up->devname, gchan); |
| 858 | } |
| 859 | if (!ch || !ch->mdt) |
| 860 | return; /* note: mdt==0 implies a malloc() |
| 861 | * failure w/in chan_up() routine */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 862 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 863 | do { |
Johan Meiring | 77c84b2 | 2012-11-20 19:28:48 +0200 | [diff] [blame] | 864 | FLUSH_MEM_READ(); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 865 | md = ch->txd_irq_srv; |
Johan Meiring | 77c84b2 | 2012-11-20 19:28:48 +0200 | [diff] [blame] | 866 | status = le32_to_cpu(md->status); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 867 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 868 | /* |
| 869 | * Note: Per MUSYCC Ref 6.4.9, the host does not poll a host-owned |
| 870 | * Transmit Buffer Descriptor during Transparent Mode. |
| 871 | */ |
| 872 | if (status & MUSYCC_TX_OWNED) { |
| 873 | int readCount, loopCount; |
| 874 | |
| 875 | /***********************************************************/ |
| 876 | /* HW Bug Fix */ |
| 877 | /* ---------- */ |
| 878 | /* Under certain PCI Bus loading conditions, the data */ |
| 879 | /* associated with an update of Shared Memory is delayed */ |
| 880 | /* relative to its PCI Interrupt. This is caught when */ |
| 881 | /* the host determines it does not yet OWN the descriptor. */ |
| 882 | /***********************************************************/ |
| 883 | |
| 884 | readCount = 0; |
| 885 | while (status & MUSYCC_TX_OWNED) { |
| 886 | for (loopCount = 0; loopCount < 0x30; loopCount++) |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 887 | /* use call to avoid optimization |
| 888 | * removal of dummy delay */ |
| 889 | OS_uwait_dummy(); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 890 | FLUSH_MEM_READ(); |
| 891 | status = le32_to_cpu(md->status); |
| 892 | if (readCount++ > 40) |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 893 | break; /* don't wait any longer */ |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 894 | } |
| 895 | if (status & MUSYCC_TX_OWNED) { |
| 896 | if (cxt1e1_log_level >= LOG_MONITOR) { |
| 897 | pr_info("%s: Port %d Chan %2d - unexpected TX msg ownership intr (md %p sts %x)\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 898 | pi->up->devname, pi->portnum, |
| 899 | ch->channum, md, status); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 900 | pr_info("++ User 0x%p IRQ_SRV 0x%p USR_ADD 0x%p QStopped %x, start_tx %x tx_full %d txd_free %d mode %x\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 901 | ch->user, ch->txd_irq_srv, |
| 902 | ch->txd_usr_add, |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 903 | sd_queue_stopped(ch->user), |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 904 | ch->ch_start_tx, ch->tx_full, |
| 905 | ch->txd_free, ch->p.chan_mode); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 906 | musycc_dump_txbuffer_ring(ch, 0); |
| 907 | } |
| 908 | break; /* Not our mdesc, done */ |
| 909 | } else { |
| 910 | if (cxt1e1_log_level >= LOG_MONITOR) |
| 911 | pr_info("%s: Port %d Chan %2d - recovered TX msg ownership [%d] (md %p sts %x)\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 912 | pi->up->devname, pi->portnum, |
| 913 | ch->channum, readCount, |
| 914 | md, status); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 915 | } |
| 916 | } |
| 917 | ch->txd_irq_srv = md->snext; |
| 918 | |
| 919 | md->data = 0; |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 920 | if (md->mem_token) { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 921 | /* upcount channel */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 922 | atomic_sub(OS_mem_token_tlen(md->mem_token), |
| 923 | &ch->tx_pending); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 924 | /* upcount card */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 925 | atomic_sub(OS_mem_token_tlen(md->mem_token), |
| 926 | &pi->up->tx_pending); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 927 | #ifdef SBE_WAN256T3_ENABLE |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 928 | if (!atomic_read(&pi->up->tx_pending)) |
| 929 | wan256t3_led(pi->up, LED_TX, 0); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 930 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 931 | OS_mem_token_free_irq(md->mem_token); |
| 932 | md->mem_token = NULL; |
| 933 | } |
| 934 | md->status = 0; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 935 | #ifdef RLD_TXFULL_DEBUG |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 936 | if (cxt1e1_log_level >= LOG_MONITOR2) |
| 937 | pr_info("~~ tx_eom: tx_full %x txd_free %d -> %d\n", |
| 938 | ch->tx_full, ch->txd_free, ch->txd_free + 1); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 939 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 940 | ++ch->txd_free; |
| 941 | FLUSH_MEM_WRITE(); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 942 | |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 943 | if ((ch->p.chan_mode != CFG_CH_PROTO_TRANS) && |
| 944 | (status & EOBIRQ_ENABLE)) { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 945 | if (cxt1e1_log_level >= LOG_MONITOR) |
| 946 | pr_info("%s: Mode (%x) incorrect EOB status (%x)\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 947 | pi->up->devname, ch->p.chan_mode, |
| 948 | status); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 949 | if ((status & EOMIRQ_ENABLE) == 0) |
| 950 | break; |
| 951 | } |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 952 | } while ((ch->p.chan_mode != CFG_CH_PROTO_TRANS) && |
| 953 | ((status & EOMIRQ_ENABLE) == 0)); |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 954 | /* |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 955 | * NOTE: (The above 'while' is coupled w/ previous 'do', way above.) Each |
| 956 | * Transparent data buffer has the EOB bit, and NOT the EOM bit, set and |
| 957 | * will furthermore have a separate IQD associated with each messages |
| 958 | * buffer. |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 959 | */ |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 960 | |
| 961 | FLUSH_MEM_READ(); |
| 962 | /* |
| 963 | * Smooth flow control hysterisis by maintaining task stoppage until half |
| 964 | * the available write buffers are available. |
| 965 | */ |
| 966 | if (ch->tx_full && (ch->txd_free >= (ch->txd_num / 2))) { |
| 967 | /* |
| 968 | * Then, only releave task stoppage if we actually have enough |
| 969 | * buffers to service the last requested packet. It may require MORE |
| 970 | * than half the available! |
| 971 | */ |
| 972 | if (ch->txd_free >= ch->txd_required) { |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 973 | |
| 974 | #ifdef RLD_TXFULL_DEBUG |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 975 | if (cxt1e1_log_level >= LOG_MONITOR2) |
| 976 | pr_info("tx_eom[%d]: enable xmit tx_full no more, txd_free %d txd_num/2 %d\n", |
| 977 | ch->channum, |
| 978 | ch->txd_free, ch->txd_num / 2); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 979 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 980 | ch->tx_full = 0; |
| 981 | ch->txd_required = 0; |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 982 | /* re-enable to catch flow controlled channel */ |
| 983 | sd_enable_xmit(ch->user); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 984 | } |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 985 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 986 | #ifdef RLD_TXFULL_DEBUG |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 987 | else if (ch->tx_full) { |
| 988 | if (cxt1e1_log_level >= LOG_MONITOR2) |
| 989 | pr_info("tx_eom[%d]: bypass TX enable though room available? (txd_free %d txd_num/2 %d)\n", |
| 990 | ch->channum, |
| 991 | ch->txd_free, ch->txd_num / 2); |
| 992 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 993 | #endif |
| 994 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 995 | FLUSH_MEM_WRITE(); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 996 | } |
| 997 | |
| 998 | |
Shaun Laing | 37ca35c | 2013-08-09 07:54:24 -0600 | [diff] [blame] | 999 | static void |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 1000 | musycc_bh_rx_eom(mpi_t *pi, int gchan) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1001 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1002 | mch_t *ch; |
| 1003 | void *m, *m2; |
| 1004 | struct mdesc *md; |
| 1005 | volatile u_int32_t status; |
| 1006 | u_int32_t error; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1007 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1008 | ch = pi->chan[gchan]; |
| 1009 | if (!ch || ch->state != UP) { |
| 1010 | if (cxt1e1_log_level > LOG_ERROR) |
| 1011 | pr_info("%s: intr: receive EOM on uninitialized channel %d\n", |
| 1012 | pi->up->devname, gchan); |
| 1013 | return; |
| 1014 | } |
| 1015 | if (!ch->mdr) |
| 1016 | return; /* can this happen ? */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1017 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1018 | for (;;) { |
| 1019 | FLUSH_MEM_READ(); |
| 1020 | md = &ch->mdr[ch->rxix_irq_srv]; |
| 1021 | status = le32_to_cpu(md->status); |
| 1022 | if (!(status & HOST_RX_OWNED)) |
| 1023 | break; /* Not our mdesc, done */ |
| 1024 | m = md->mem_token; |
| 1025 | error = (status >> 16) & 0xf; |
| 1026 | if (error == 0) { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1027 | { |
| 1028 | m2 = OS_mem_token_alloc(cxt1e1_max_mru); |
| 1029 | if (m2) { |
| 1030 | /* substitute the mbuf+cluster */ |
| 1031 | md->mem_token = m2; |
| 1032 | md->data = cpu_to_le32(OS_vtophys( |
| 1033 | OS_mem_token_data(m2))); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1034 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1035 | /* pass the received mbuf upward */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1036 | sd_recv_consume(m, status & LENGTH_MASK, |
| 1037 | ch->user); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1038 | ch->s.rx_packets++; |
| 1039 | ch->s.rx_bytes += status & LENGTH_MASK; |
| 1040 | } else |
| 1041 | ch->s.rx_dropped++; |
| 1042 | } |
| 1043 | } else if (error == ERR_FCS) |
| 1044 | ch->s.rx_crc_errors++; |
| 1045 | else if (error == ERR_ALIGN) |
| 1046 | ch->s.rx_missed_errors++; |
| 1047 | else if (error == ERR_ABT) |
| 1048 | ch->s.rx_missed_errors++; |
| 1049 | else if (error == ERR_LNG) |
| 1050 | ch->s.rx_length_errors++; |
| 1051 | else if (error == ERR_SHT) |
| 1052 | ch->s.rx_length_errors++; |
| 1053 | FLUSH_MEM_WRITE(); |
| 1054 | status = cxt1e1_max_mru; |
| 1055 | if (ch->p.chan_mode == CFG_CH_PROTO_TRANS) |
| 1056 | status |= EOBIRQ_ENABLE; |
| 1057 | md->status = cpu_to_le32(status); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1058 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1059 | /* Check next mdesc in the ring */ |
| 1060 | if (++ch->rxix_irq_srv >= ch->rxd_num) |
| 1061 | ch->rxix_irq_srv = 0; |
| 1062 | FLUSH_MEM_WRITE(); |
| 1063 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1064 | } |
| 1065 | |
| 1066 | |
| 1067 | irqreturn_t |
Johan Meiring | 77c84b2 | 2012-11-20 19:28:48 +0200 | [diff] [blame] | 1068 | musycc_intr_th_handler(void *devp) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1069 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1070 | ci_t *ci = (ci_t *) devp; |
| 1071 | volatile u_int32_t status, currInt = 0; |
| 1072 | u_int32_t nextInt, intCnt; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1073 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1074 | /* |
| 1075 | * Hardware not available, potential interrupt hang. But since interrupt |
| 1076 | * might be shared, just return. |
| 1077 | */ |
| 1078 | if (ci->state == C_INIT) |
| 1079 | return IRQ_NONE; |
| 1080 | /* |
| 1081 | * Marked as hardware available. Don't service interrupts, just clear the |
| 1082 | * event. |
| 1083 | */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1084 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1085 | if (ci->state == C_IDLE) { |
| 1086 | status = pci_read_32((u_int32_t *) &ci->reg->isd); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1087 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1088 | /* clear the interrupt but process nothing else */ |
| 1089 | pci_write_32((u_int32_t *) &ci->reg->isd, status); |
| 1090 | return IRQ_HANDLED; |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 1091 | } |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1092 | FLUSH_PCI_READ(); |
| 1093 | FLUSH_MEM_READ(); |
| 1094 | |
| 1095 | status = pci_read_32((u_int32_t *) &ci->reg->isd); |
Johan Meiring | 77c84b2 | 2012-11-20 19:28:48 +0200 | [diff] [blame] | 1096 | nextInt = INTRPTS_NEXTINT(status); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1097 | intCnt = INTRPTS_INTCNT(status); |
| 1098 | ci->intlog.drvr_intr_thcount++; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1099 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1100 | /*********************************************************/ |
| 1101 | /* HW Bug Fix */ |
| 1102 | /* ---------- */ |
| 1103 | /* Under certain PCI Bus loading conditions, the */ |
| 1104 | /* MUSYCC looses the data associated with an update */ |
| 1105 | /* of its ISD and erroneously returns the immediately */ |
| 1106 | /* preceding 'nextInt' value. However, the 'intCnt' */ |
| 1107 | /* value appears to be correct. By not starting service */ |
| 1108 | /* where the 'missing' 'nextInt' SHOULD point causes */ |
| 1109 | /* the IQD not to be serviced - the 'not serviced' */ |
| 1110 | /* entries then remain and continue to increase as more */ |
| 1111 | /* incorrect ISD's are encountered. */ |
| 1112 | /*********************************************************/ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1113 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1114 | if (nextInt != INTRPTS_NEXTINT(ci->intlog.this_status_new)) { |
| 1115 | if (cxt1e1_log_level >= LOG_MONITOR) { |
| 1116 | pr_info("%s: note - updated ISD from %08x to %08x\n", |
| 1117 | ci->devname, status, |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1118 | (status & (~INTRPTS_NEXTINT_M)) | |
| 1119 | ci->intlog.this_status_new); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1120 | } |
| 1121 | /* |
| 1122 | * Replace bogus status with software corrected value. |
| 1123 | * |
| 1124 | * It's not known whether, during this problem occurrence, if the |
| 1125 | * INTFULL bit is correctly reported or not. |
| 1126 | */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1127 | status = (status & (~INTRPTS_NEXTINT_M)) | |
| 1128 | (ci->intlog.this_status_new); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1129 | nextInt = INTRPTS_NEXTINT(status); |
| 1130 | } |
| 1131 | /**********************************************/ |
| 1132 | /* Cn847x Bug Fix */ |
| 1133 | /* -------------- */ |
| 1134 | /* Fix for inability to write back same index */ |
| 1135 | /* as read for a full interrupt queue. */ |
| 1136 | /**********************************************/ |
| 1137 | |
| 1138 | if (intCnt == INT_QUEUE_SIZE) |
| 1139 | currInt = ((intCnt - 1) + nextInt) & (INT_QUEUE_SIZE - 1); |
| 1140 | else |
| 1141 | /************************************************/ |
| 1142 | /* Interrupt Write Location Issues */ |
| 1143 | /* ------------------------------- */ |
| 1144 | /* When the interrupt status descriptor is */ |
| 1145 | /* written, the interrupt line is de-asserted */ |
| 1146 | /* by the Cn847x. In the case of MIPS */ |
| 1147 | /* microprocessors, this must occur at the */ |
| 1148 | /* beginning of the interrupt handler so that */ |
| 1149 | /* the interrupt handle is not re-entered due */ |
| 1150 | /* to interrupt dis-assertion latency. */ |
| 1151 | /* In the case of all other processors, this */ |
| 1152 | /* action should occur at the end of the */ |
| 1153 | /* interrupt handler to avoid overwriting the */ |
| 1154 | /* interrupt queue. */ |
| 1155 | /************************************************/ |
| 1156 | |
| 1157 | if (intCnt) |
| 1158 | currInt = (intCnt + nextInt) & (INT_QUEUE_SIZE - 1); |
| 1159 | else { |
| 1160 | /* |
| 1161 | * NOTE: Servicing an interrupt whose ISD contains a count of ZERO |
| 1162 | * can be indicative of a Shared Interrupt chain. Our driver can be |
| 1163 | * called from the system's interrupt handler as a matter of the OS |
| 1164 | * walking the chain. As the chain is walked, the interrupt will |
| 1165 | * eventually be serviced by the correct driver/handler. |
| 1166 | */ |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1167 | return IRQ_NONE; |
| 1168 | } |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1169 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1170 | ci->iqp_tailx = currInt; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1171 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1172 | currInt <<= INTRPTS_NEXTINT_S; |
| 1173 | ci->intlog.last_status_new = ci->intlog.this_status_new; |
| 1174 | ci->intlog.this_status_new = currInt; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1175 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1176 | if ((cxt1e1_log_level >= LOG_WARN) && (status & INTRPTS_INTFULL_M)) |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1177 | pr_info("%s: Interrupt queue full condition occurred\n", |
| 1178 | ci->devname); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1179 | if (cxt1e1_log_level >= LOG_DEBUG) |
| 1180 | pr_info("%s: interrupts pending, isd @ 0x%p: %x curr %d cnt %d NEXT %d\n", |
| 1181 | ci->devname, &ci->reg->isd, |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1182 | status, nextInt, intCnt, |
| 1183 | (intCnt + nextInt) & (INT_QUEUE_SIZE - 1)); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1184 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1185 | FLUSH_MEM_WRITE(); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1186 | #if defined(SBE_ISR_TASKLET) |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1187 | pci_write_32((u_int32_t *) &ci->reg->isd, currInt); |
| 1188 | atomic_inc(&ci->bh_pending); |
| 1189 | tasklet_schedule(&ci->ci_musycc_isr_tasklet); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1190 | #elif defined(SBE_ISR_IMMEDIATE) |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1191 | pci_write_32((u_int32_t *) &ci->reg->isd, currInt); |
| 1192 | atomic_inc(&ci->bh_pending); |
| 1193 | queue_task(&ci->ci_musycc_isr_tq, &tq_immediate); |
| 1194 | mark_bh(IMMEDIATE_BH); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1195 | #elif defined(SBE_ISR_INLINE) |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1196 | (void) musycc_intr_bh_tasklet(ci); |
| 1197 | pci_write_32((u_int32_t *) &ci->reg->isd, currInt); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1198 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1199 | return IRQ_HANDLED; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1200 | } |
| 1201 | |
| 1202 | |
| 1203 | #if defined(SBE_ISR_IMMEDIATE) |
| 1204 | unsigned long |
| 1205 | #else |
| 1206 | void |
| 1207 | #endif |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 1208 | musycc_intr_bh_tasklet(ci_t *ci) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1209 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1210 | mpi_t *pi; |
| 1211 | mch_t *ch; |
| 1212 | unsigned int intCnt; |
| 1213 | volatile u_int32_t currInt = 0; |
| 1214 | volatile unsigned int headx, tailx; |
| 1215 | int readCount, loopCount; |
| 1216 | int group, gchan, event, err, tx; |
| 1217 | u_int32_t badInt = INT_EMPTY_ENTRY; |
| 1218 | u_int32_t badInt2 = INT_EMPTY_ENTRY2; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1219 | |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 1220 | /* |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1221 | * Hardware not available, potential interrupt hang. But since interrupt |
| 1222 | * might be shared, just return. |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 1223 | */ |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1224 | if ((drvr_state != SBE_DRVR_AVAILABLE) || (ci->state == C_INIT)) { |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1225 | #if defined(SBE_ISR_IMMEDIATE) |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1226 | return 0L; |
| 1227 | #else |
| 1228 | return; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1229 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1230 | } |
| 1231 | #if defined(SBE_ISR_TASKLET) || defined(SBE_ISR_IMMEDIATE) |
| 1232 | if (drvr_state != SBE_DRVR_AVAILABLE) { |
| 1233 | #if defined(SBE_ISR_TASKLET) |
| 1234 | return; |
| 1235 | #elif defined(SBE_ISR_IMMEDIATE) |
| 1236 | return 0L; |
| 1237 | #endif |
| 1238 | } |
| 1239 | #elif defined(SBE_ISR_INLINE) |
| 1240 | /* no semaphore taken, no double checks */ |
| 1241 | #endif |
| 1242 | |
| 1243 | ci->intlog.drvr_intr_bhcount++; |
| 1244 | FLUSH_MEM_READ(); |
| 1245 | { |
| 1246 | unsigned int bh = atomic_read(&ci->bh_pending); |
| 1247 | |
| 1248 | max_bh = max(bh, max_bh); |
| 1249 | } |
| 1250 | atomic_set(&ci->bh_pending, 0);/* if here, no longer pending */ |
| 1251 | while ((headx = ci->iqp_headx) != (tailx = ci->iqp_tailx)) { |
| 1252 | intCnt = (tailx >= headx) ? (tailx - headx) : (tailx - headx + INT_QUEUE_SIZE); |
| 1253 | currInt = le32_to_cpu(ci->iqd_p[headx]); |
| 1254 | |
| 1255 | max_intcnt = max(intCnt, max_intcnt); /* RLD DEBUG */ |
| 1256 | |
| 1257 | /**************************************************/ |
| 1258 | /* HW Bug Fix */ |
| 1259 | /* ---------- */ |
| 1260 | /* The following code checks for the condition */ |
| 1261 | /* of interrupt assertion before interrupt */ |
| 1262 | /* queue update. This is a problem on several */ |
| 1263 | /* PCI-Local bridge chips found on some products. */ |
| 1264 | /**************************************************/ |
| 1265 | |
| 1266 | readCount = 0; |
| 1267 | if ((currInt == badInt) || (currInt == badInt2)) |
| 1268 | ci->intlog.drvr_int_failure++; |
| 1269 | |
| 1270 | while ((currInt == badInt) || (currInt == badInt2)) { |
| 1271 | for (loopCount = 0; loopCount < 0x30; loopCount++) |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1272 | /* use call to avoid optimization |
| 1273 | * removal of dummy delay |
| 1274 | */ |
| 1275 | OS_uwait_dummy(); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1276 | FLUSH_MEM_READ(); |
| 1277 | currInt = le32_to_cpu(ci->iqd_p[headx]); |
| 1278 | if (readCount++ > 20) |
| 1279 | break; |
| 1280 | } |
| 1281 | |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1282 | /* catch failure of Bug Fix checking */ |
| 1283 | if ((currInt == badInt) || (currInt == badInt2)) { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1284 | if (cxt1e1_log_level >= LOG_WARN) |
| 1285 | pr_info("%s: Illegal Interrupt Detected @ 0x%p, mod %d.)\n", |
| 1286 | ci->devname, &ci->iqd_p[headx], headx); |
| 1287 | |
| 1288 | /* |
| 1289 | * If the descriptor has not recovered, then leaving the EMPTY |
| 1290 | * entry set will not signal to the MUSYCC that this descriptor |
| 1291 | * has been serviced. The Interrupt Queue can then start losing |
| 1292 | * available descriptors and MUSYCC eventually encounters and |
| 1293 | * reports the INTFULL condition. Per manual, changing any bit |
| 1294 | * marks descriptor as available, thus the use of different |
| 1295 | * EMPTY_ENTRY values. |
| 1296 | */ |
| 1297 | |
| 1298 | if (currInt == badInt) |
| 1299 | ci->iqd_p[headx] = __constant_cpu_to_le32(INT_EMPTY_ENTRY2); |
| 1300 | else |
| 1301 | ci->iqd_p[headx] = __constant_cpu_to_le32(INT_EMPTY_ENTRY); |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1302 | /* insure wrapness */ |
| 1303 | ci->iqp_headx = (headx + 1) & (INT_QUEUE_SIZE - 1); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1304 | FLUSH_MEM_WRITE(); |
| 1305 | FLUSH_MEM_READ(); |
| 1306 | continue; |
| 1307 | } |
| 1308 | group = INTRPT_GRP(currInt); |
| 1309 | gchan = INTRPT_CH(currInt); |
| 1310 | event = INTRPT_EVENT(currInt); |
| 1311 | err = INTRPT_ERROR(currInt); |
| 1312 | tx = currInt & INTRPT_DIR_M; |
| 1313 | |
| 1314 | ci->iqd_p[headx] = __constant_cpu_to_le32(INT_EMPTY_ENTRY); |
| 1315 | FLUSH_MEM_WRITE(); |
| 1316 | |
| 1317 | if (cxt1e1_log_level >= LOG_DEBUG) { |
| 1318 | if (err != 0) |
| 1319 | pr_info(" %08x -> err: %2d,", currInt, err); |
| 1320 | |
| 1321 | pr_info("+ interrupt event: %d, grp: %d, chan: %2d, side: %cX\n", |
| 1322 | event, group, gchan, tx ? 'T' : 'R'); |
| 1323 | } |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1324 | /* notice that here we assume 1-1 group - port mapping */ |
| 1325 | pi = &ci->port[group]; |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1326 | ch = pi->chan[gchan]; |
| 1327 | switch (event) { |
| 1328 | case EVE_SACK: /* Service Request Acknowledge */ |
| 1329 | if (cxt1e1_log_level >= LOG_DEBUG) { |
| 1330 | volatile u_int32_t r; |
| 1331 | |
| 1332 | r = pci_read_32((u_int32_t *) &pi->reg->srd); |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1333 | pr_info("- SACK cmd: %08x (hdw= %08x)\n", |
| 1334 | pi->sr_last, r); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1335 | } |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1336 | /* wake up waiting process */ |
| 1337 | SD_SEM_GIVE(&pi->sr_sem_wait); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1338 | break; |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1339 | case EVE_CHABT: /* Change To Abort Code (0x7e -> 0xff) */ |
| 1340 | case EVE_CHIC: /* Change To Idle Code (0xff -> 0x7e) */ |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1341 | break; |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1342 | case EVE_EOM: /* End Of Message */ |
| 1343 | case EVE_EOB: /* End Of Buffer (Transparent mode) */ |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1344 | if (tx) |
| 1345 | musycc_bh_tx_eom(pi, gchan); |
| 1346 | else |
| 1347 | musycc_bh_rx_eom(pi, gchan); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1348 | /* |
| 1349 | * MUSYCC Interrupt Descriptor section states that EOB and EOM |
| 1350 | * can be combined with the NONE error (as well as others). So |
| 1351 | * drop thru to catch this... |
| 1352 | */ |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1353 | case EVE_NONE: |
| 1354 | if (err == ERR_SHT) |
| 1355 | ch->s.rx_length_errors++; |
| 1356 | break; |
| 1357 | default: |
| 1358 | if (cxt1e1_log_level >= LOG_WARN) |
| 1359 | pr_info("%s: unexpected interrupt event: %d, iqd[%d]: %08x, port: %d\n", ci->devname, |
| 1360 | event, headx, currInt, group); |
| 1361 | break; |
| 1362 | } /* switch on event */ |
| 1363 | |
| 1364 | |
| 1365 | /* |
| 1366 | * Per MUSYCC Manual, Section 6.4.8.3 [Transmit Errors], TX errors |
| 1367 | * are service-affecting and require action to resume normal |
| 1368 | * bit-level processing. |
| 1369 | */ |
| 1370 | |
| 1371 | switch (err) { |
| 1372 | case ERR_ONR: |
| 1373 | /* |
| 1374 | * Per MUSYCC manual, Section 6.4.8.3 [Transmit Errors], this |
| 1375 | * error requires Transmit channel reactivation. |
| 1376 | * |
| 1377 | * Per MUSYCC manual, Section 6.4.8.4 [Receive Errors], this error |
| 1378 | * requires Receive channel reactivation. |
| 1379 | */ |
| 1380 | if (tx) { |
| 1381 | |
| 1382 | /* |
| 1383 | * TX ONR Error only occurs when channel is configured for |
| 1384 | * Transparent Mode. However, this code will catch and |
| 1385 | * re-activate on ANY TX ONR error. |
| 1386 | */ |
| 1387 | |
| 1388 | /* |
| 1389 | * Set flag to re-enable on any next transmit attempt. |
| 1390 | */ |
| 1391 | ch->ch_start_tx = CH_START_TX_ONR; |
| 1392 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1393 | #ifdef RLD_TRANS_DEBUG |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 1394 | if (1 || cxt1e1_log_level >= LOG_MONITOR) |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1395 | #else |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 1396 | if (cxt1e1_log_level >= LOG_MONITOR) |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1397 | #endif |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 1398 | { |
| 1399 | pr_info("%s: TX buffer underflow [ONR] on channel %d, mode %x QStopped %x free %d\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1400 | ci->devname, ch->channum, |
| 1401 | ch->p.chan_mode, |
| 1402 | sd_queue_stopped(ch->user), |
| 1403 | ch->txd_free); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1404 | #ifdef RLD_DEBUG |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1405 | /* problem = ONR on HDLC mode */ |
| 1406 | if (ch->p.chan_mode == 2) { |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 1407 | pr_info("++ Failed Last %x Next %x QStopped %x, start_tx %x tx_full %d txd_free %d mode %x\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1408 | (u_int32_t)ch->txd_irq_srv, |
| 1409 | (u_int32_t)ch->txd_usr_add, |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 1410 | sd_queue_stopped(ch->user), |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1411 | ch->ch_start_tx, |
| 1412 | ch->tx_full, |
| 1413 | ch->txd_free, |
| 1414 | ch->p.chan_mode); |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 1415 | musycc_dump_txbuffer_ring(ch, 0); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1416 | } |
Daeseok Youn | 79cefa5 | 2014-05-09 19:08:59 +0900 | [diff] [blame] | 1417 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1418 | } |
| 1419 | } else { /* RX buffer overrun */ |
| 1420 | /* |
| 1421 | * Per MUSYCC manual, Section 6.4.8.4 [Receive Errors], |
| 1422 | * channel recovery for this RX ONR error IS required. It is |
| 1423 | * also suggested to increase the number of receive buffers |
| 1424 | * for this channel. Receive channel reactivation IS |
| 1425 | * required, and data has been lost. |
| 1426 | */ |
| 1427 | ch->s.rx_over_errors++; |
| 1428 | ch->ch_start_rx = CH_START_RX_ONR; |
| 1429 | |
| 1430 | if (cxt1e1_log_level >= LOG_WARN) { |
| 1431 | pr_info("%s: RX buffer overflow [ONR] on channel %d, mode %x\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1432 | ci->devname, ch->channum, |
| 1433 | ch->p.chan_mode); |
Daeseok Youn | b7923d2 | 2014-05-09 23:54:08 +0900 | [diff] [blame] | 1434 | #ifdef RLD_DEBUG |
| 1435 | musycc_dump_rxbuffer_ring(ch, 0); |
| 1436 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1437 | } |
| 1438 | } |
| 1439 | musycc_chan_restart(ch); |
| 1440 | break; |
| 1441 | case ERR_BUF: |
| 1442 | if (tx) { |
| 1443 | ch->s.tx_fifo_errors++; |
| 1444 | ch->ch_start_tx = CH_START_TX_BUF; |
| 1445 | /* |
| 1446 | * Per MUSYCC manual, Section 6.4.8.3 [Transmit Errors], |
| 1447 | * this BUFF error requires Transmit channel reactivation. |
| 1448 | */ |
| 1449 | if (cxt1e1_log_level >= LOG_MONITOR) |
| 1450 | pr_info("%s: TX buffer underrun [BUFF] on channel %d, mode %x\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1451 | ci->devname, ch->channum, |
| 1452 | ch->p.chan_mode); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1453 | } else { /* RX buffer overrun */ |
| 1454 | ch->s.rx_over_errors++; |
| 1455 | /* |
| 1456 | * Per MUSYCC manual, Section 6.4.8.4 [Receive Errors], HDLC |
| 1457 | * mode requires NO recovery for this RX BUFF error is |
| 1458 | * required. It is suggested to increase the FIFO buffer |
| 1459 | * space for this channel. Receive channel reactivation is |
| 1460 | * not required, but data has been lost. |
| 1461 | */ |
| 1462 | if (cxt1e1_log_level >= LOG_WARN) |
| 1463 | pr_info("%s: RX buffer overrun [BUFF] on channel %d, mode %x\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1464 | ci->devname, ch->channum, |
| 1465 | ch->p.chan_mode); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1466 | /* |
| 1467 | * Per MUSYCC manual, Section 6.4.9.4 [Receive Errors], |
| 1468 | * Transparent mode DOES require recovery for the RX BUFF |
| 1469 | * error. It is suggested to increase the FIFO buffer space |
| 1470 | * for this channel. Receive channel reactivation IS |
| 1471 | * required and data has been lost. |
| 1472 | */ |
| 1473 | if (ch->p.chan_mode == CFG_CH_PROTO_TRANS) |
| 1474 | ch->ch_start_rx = CH_START_RX_BUF; |
| 1475 | } |
| 1476 | |
| 1477 | if (tx || (ch->p.chan_mode == CFG_CH_PROTO_TRANS)) |
| 1478 | musycc_chan_restart(ch); |
| 1479 | break; |
| 1480 | default: |
| 1481 | break; |
| 1482 | } /* switch on err */ |
| 1483 | |
| 1484 | /* Check for interrupt lost condition */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1485 | if ((currInt & INTRPT_ILOST_M) && |
| 1486 | (cxt1e1_log_level >= LOG_ERROR)) |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1487 | pr_info("%s: Interrupt queue overflow - ILOST asserted\n", |
| 1488 | ci->devname); |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1489 | /* insure wrapness */ |
| 1490 | ci->iqp_headx = (headx + 1) & (INT_QUEUE_SIZE - 1); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1491 | FLUSH_MEM_WRITE(); |
| 1492 | FLUSH_MEM_READ(); |
| 1493 | } /* while */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1494 | if ((cxt1e1_log_level >= LOG_MONITOR2) && |
| 1495 | (ci->iqp_headx != ci->iqp_tailx)) { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1496 | int bh; |
| 1497 | |
| 1498 | bh = atomic_read(&CI->bh_pending); |
| 1499 | pr_info("_bh_: late arrivals, head %d != tail %d, pending %d\n", |
| 1500 | ci->iqp_headx, ci->iqp_tailx, bh); |
| 1501 | } |
| 1502 | #if defined(SBE_ISR_IMMEDIATE) |
| 1503 | return 0L; |
| 1504 | #endif |
| 1505 | /* else, nothing returned */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1506 | } |
| 1507 | |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1508 | #ifdef SBE_PMCC4_ENABLE |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1509 | status_t |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 1510 | musycc_chan_down(ci_t *dummy, int channum) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1511 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1512 | mpi_t *pi; |
| 1513 | mch_t *ch; |
| 1514 | int i, gchan; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1515 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1516 | ch = sd_find_chan(dummy, channum); |
| 1517 | if (!ch) |
| 1518 | return -EINVAL; |
| 1519 | pi = ch->up; |
| 1520 | gchan = ch->gchan; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1521 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1522 | /* Deactivate the channel */ |
| 1523 | musycc_serv_req(pi, SR_CHANNEL_DEACTIVATE | SR_RX_DIRECTION | gchan); |
| 1524 | ch->ch_start_rx = 0; |
| 1525 | musycc_serv_req(pi, SR_CHANNEL_DEACTIVATE | SR_TX_DIRECTION | gchan); |
| 1526 | ch->ch_start_tx = 0; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1527 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1528 | if (ch->state == DOWN) |
| 1529 | return 0; |
| 1530 | ch->state = DOWN; |
| 1531 | |
| 1532 | pi->regram->thp[gchan] = 0; |
| 1533 | pi->regram->tmp[gchan] = 0; |
| 1534 | pi->regram->rhp[gchan] = 0; |
| 1535 | pi->regram->rmp[gchan] = 0; |
| 1536 | FLUSH_MEM_WRITE(); |
| 1537 | for (i = 0; i < ch->txd_num; i++) |
| 1538 | if (ch->mdt[i].mem_token) |
| 1539 | OS_mem_token_free(ch->mdt[i].mem_token); |
| 1540 | |
| 1541 | for (i = 0; i < ch->rxd_num; i++) |
| 1542 | if (ch->mdr[i].mem_token) |
| 1543 | OS_mem_token_free(ch->mdr[i].mem_token); |
| 1544 | |
| 1545 | kfree(ch->mdr); |
| 1546 | ch->mdr = NULL; |
| 1547 | ch->rxd_num = 0; |
| 1548 | kfree(ch->mdt); |
| 1549 | ch->mdt = NULL; |
| 1550 | ch->txd_num = 0; |
| 1551 | |
| 1552 | musycc_update_timeslots(pi); |
| 1553 | c4_fifo_free(pi, ch->gchan); |
| 1554 | |
| 1555 | pi->openchans--; |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 1556 | return 0; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1557 | } |
| 1558 | #endif |
| 1559 | |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1560 | int |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 1561 | musycc_start_xmit(ci_t *ci, int channum, void *mem_token) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1562 | { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1563 | mch_t *ch; |
| 1564 | struct mdesc *md; |
| 1565 | void *m2; |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1566 | int txd_need_cnt; |
| 1567 | u_int32_t len; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1568 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1569 | ch = sd_find_chan(ci, channum); |
| 1570 | if (!ch) |
| 1571 | return -ENOENT; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1572 | |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1573 | /* full interrupt processing available */ |
| 1574 | if (ci->state != C_RUNNING) |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1575 | return -EINVAL; |
| 1576 | if (ch->state != UP) |
| 1577 | return -EINVAL; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1578 | |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1579 | /* how else to flag unwritable state ? */ |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1580 | if (!(ch->status & TX_ENABLED)) |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1581 | return -EROFS; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1582 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1583 | #ifdef RLD_TRANS_DEBUG |
| 1584 | if (1 || cxt1e1_log_level >= LOG_MONITOR2) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1585 | #else |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 1586 | if (cxt1e1_log_level >= LOG_MONITOR2) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1587 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1588 | { |
| 1589 | pr_info("++ start_xmt[%d]: state %x start %x full %d free %d required %d stopped %x\n", |
| 1590 | channum, ch->state, ch->ch_start_tx, ch->tx_full, |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1591 | ch->txd_free, ch->txd_required, |
| 1592 | sd_queue_stopped(ch->user)); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1593 | } |
| 1594 | /***********************************************/ |
| 1595 | /** Determine total amount of data to be sent **/ |
| 1596 | /***********************************************/ |
| 1597 | m2 = mem_token; |
| 1598 | txd_need_cnt = 0; |
| 1599 | for (len = OS_mem_token_tlen(m2); len > 0; |
| 1600 | m2 = (void *) OS_mem_token_next(m2)) { |
| 1601 | if (!OS_mem_token_len(m2)) |
| 1602 | continue; |
| 1603 | txd_need_cnt++; |
| 1604 | len -= OS_mem_token_len(m2); |
| 1605 | } |
| 1606 | |
| 1607 | if (txd_need_cnt == 0) { |
| 1608 | if (cxt1e1_log_level >= LOG_MONITOR2) |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1609 | pr_info("%s channel %d: no TX data in User buffer\n", |
| 1610 | ci->devname, channum); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1611 | OS_mem_token_free(mem_token); |
| 1612 | return 0; /* no data to send */ |
| 1613 | } |
| 1614 | /*************************************************/ |
| 1615 | /** Are there sufficient descriptors available? **/ |
| 1616 | /*************************************************/ |
| 1617 | if (txd_need_cnt > ch->txd_num) { /* never enough descriptors for this |
| 1618 | * large a buffer */ |
| 1619 | if (cxt1e1_log_level >= LOG_DEBUG) |
| 1620 | pr_info("start_xmit: discarding buffer, insufficient descriptor cnt %d, need %d.\n", |
| 1621 | ch->txd_num, txd_need_cnt + 1); |
| 1622 | ch->s.tx_dropped++; |
| 1623 | OS_mem_token_free(mem_token); |
| 1624 | return 0; |
| 1625 | } |
Daeseok Youn | b7923d2 | 2014-05-09 23:54:08 +0900 | [diff] [blame] | 1626 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1627 | /************************************************************/ |
| 1628 | /** flow control the line if not enough descriptors remain **/ |
| 1629 | /************************************************************/ |
| 1630 | if (txd_need_cnt > ch->txd_free) { |
| 1631 | if (cxt1e1_log_level >= LOG_MONITOR2) |
| 1632 | pr_info("start_xmit[%d]: EBUSY - need more descriptors, have %d of %d need %d\n", |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1633 | channum, ch->txd_free, |
| 1634 | ch->txd_num, txd_need_cnt); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1635 | ch->tx_full = 1; |
| 1636 | ch->txd_required = txd_need_cnt; |
| 1637 | sd_disable_xmit(ch->user); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1638 | return -EBUSY; /* tell user to try again later */ |
| 1639 | } |
| 1640 | /**************************************************/ |
| 1641 | /** Put the user data into MUSYCC data buffer(s) **/ |
| 1642 | /**************************************************/ |
| 1643 | m2 = mem_token; |
| 1644 | md = ch->txd_usr_add; /* get current available descriptor */ |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1645 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1646 | for (len = OS_mem_token_tlen(m2); len > 0; m2 = OS_mem_token_next(m2)) { |
| 1647 | int u = OS_mem_token_len(m2); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1648 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1649 | if (!u) |
| 1650 | continue; |
| 1651 | len -= u; |
| 1652 | |
| 1653 | /* |
| 1654 | * Enable following chunks, yet wait to enable the FIRST chunk until |
| 1655 | * after ALL subsequent chunks are setup. |
| 1656 | */ |
| 1657 | if (md != ch->txd_usr_add) /* not first chunk */ |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1658 | /* transfer ownership from HOST to MUSYCC */ |
| 1659 | u |= MUSYCC_TX_OWNED; |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1660 | |
| 1661 | if (len) /* not last chunk */ |
| 1662 | u |= EOBIRQ_ENABLE; |
| 1663 | else if (ch->p.chan_mode == CFG_CH_PROTO_TRANS) { |
| 1664 | /* |
| 1665 | * Per MUSYCC Ref 6.4.9 for Transparent Mode, the host must |
| 1666 | * always clear EOMIRQ_ENABLE in every Transmit Buffer Descriptor |
| 1667 | * (IE. don't set herein). |
| 1668 | */ |
| 1669 | u |= EOBIRQ_ENABLE; |
| 1670 | } else |
| 1671 | u |= EOMIRQ_ENABLE; /* EOM, last HDLC chunk */ |
| 1672 | |
| 1673 | |
| 1674 | /* last chunk in hdlc mode */ |
| 1675 | u |= (ch->p.idlecode << IDLE_CODE); |
| 1676 | if (ch->p.pad_fill_count) { |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1677 | u |= (PADFILL_ENABLE | (ch->p.pad_fill_count << EXTRA_FLAGS)); |
| 1678 | } |
Daeseok Youn | a38223f | 2014-05-09 19:09:35 +0900 | [diff] [blame] | 1679 | /* Fill in mds on last segment, others set ZERO |
| 1680 | * so that entire token is removed ONLY when ALL |
| 1681 | * segments have been transmitted. |
| 1682 | */ |
| 1683 | md->mem_token = len ? NULL : mem_token; |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1684 | |
| 1685 | md->data = cpu_to_le32(OS_vtophys(OS_mem_token_data(m2))); |
| 1686 | FLUSH_MEM_WRITE(); |
| 1687 | md->status = cpu_to_le32(u); |
| 1688 | --ch->txd_free; |
| 1689 | md = md->snext; |
| 1690 | } |
| 1691 | FLUSH_MEM_WRITE(); |
| 1692 | |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1693 | |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 1694 | /* |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1695 | * Now transfer ownership of first chunk from HOST to MUSYCC in order to |
| 1696 | * fire-off this XMIT. |
Johan Meiring | ea9d1e9 | 2012-11-20 19:28:46 +0200 | [diff] [blame] | 1697 | */ |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1698 | ch->txd_usr_add->status |= __constant_cpu_to_le32(MUSYCC_TX_OWNED); |
Johan Meiring | 77c84b2 | 2012-11-20 19:28:48 +0200 | [diff] [blame] | 1699 | FLUSH_MEM_WRITE(); |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1700 | ch->txd_usr_add = md; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1701 | |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1702 | len = OS_mem_token_tlen(mem_token); |
| 1703 | atomic_add(len, &ch->tx_pending); |
| 1704 | atomic_add(len, &ci->tx_pending); |
| 1705 | ch->s.tx_packets++; |
| 1706 | ch->s.tx_bytes += len; |
| 1707 | /* |
| 1708 | * If an ONR was seen, then channel requires poking to restart |
| 1709 | * transmission. |
| 1710 | */ |
| 1711 | if (ch->ch_start_tx) |
| 1712 | musycc_chan_restart(ch); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1713 | #ifdef SBE_WAN256T3_ENABLE |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1714 | wan256t3_led(ci, LED_TX, LEDV_G); |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1715 | #endif |
Daeseok Youn | 2ab4b6e | 2014-05-09 19:02:20 +0900 | [diff] [blame] | 1716 | return 0; |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1717 | } |
| 1718 | |
| 1719 | |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1720 | /*** End-of-File ***/ |