Lines Matching refs:mlc
65 hil_mlc *mlc = &hp_sdc_mlc; in hp_sdc_mlc_isr() local
67 write_lock(&mlc->lock); in hp_sdc_mlc_isr()
68 if (mlc->icount < 0) { in hp_sdc_mlc_isr()
70 up(&mlc->isem); in hp_sdc_mlc_isr()
73 idx = 15 - mlc->icount; in hp_sdc_mlc_isr()
75 mlc->ipacket[idx] |= data | HIL_ERR_INT; in hp_sdc_mlc_isr()
76 mlc->icount--; in hp_sdc_mlc_isr()
79 if ((mlc->ipacket[idx - 1] & HIL_PKT_ADDR_MASK) != in hp_sdc_mlc_isr()
80 (mlc->ipacket[idx] & HIL_PKT_ADDR_MASK)) { in hp_sdc_mlc_isr()
81 mlc->ipacket[idx] &= ~HIL_PKT_ADDR_MASK; in hp_sdc_mlc_isr()
82 mlc->ipacket[idx] |= (mlc->ipacket[idx - 1] in hp_sdc_mlc_isr()
90 mlc->ipacket[idx] = in hp_sdc_mlc_isr()
97 if (mlc->imatch == 0) in hp_sdc_mlc_isr()
99 if ((mlc->imatch == (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL)) in hp_sdc_mlc_isr()
100 && (mlc->ipacket[idx] == (mlc->imatch | idx))) in hp_sdc_mlc_isr()
102 if (mlc->ipacket[idx] == mlc->imatch) in hp_sdc_mlc_isr()
115 mlc->ipacket[idx] |= HIL_ERR_INT | HIL_ERR_PERR | in hp_sdc_mlc_isr()
120 mlc->ipacket[idx] |= HIL_ERR_INT | HIL_ERR_LERR; in hp_sdc_mlc_isr()
134 tasklet_schedule(mlc->tasklet); in hp_sdc_mlc_isr()
135 up(&mlc->isem); in hp_sdc_mlc_isr()
137 write_unlock(&mlc->lock); in hp_sdc_mlc_isr()
143 static int hp_sdc_mlc_in(hil_mlc *mlc, suseconds_t timeout) in hp_sdc_mlc_in() argument
148 priv = mlc->priv; in hp_sdc_mlc_in()
151 if (down_trylock(&mlc->isem)) { in hp_sdc_mlc_in()
153 mlc->ipacket[0] = in hp_sdc_mlc_in()
154 HIL_ERR_INT | (mlc->opacket & in hp_sdc_mlc_in()
158 mlc->icount = 14; in hp_sdc_mlc_in()
162 if (time_after(jiffies, mlc->instart + mlc->intimeout)) { in hp_sdc_mlc_in()
168 up(&mlc->isem); in hp_sdc_mlc_in()
173 up(&mlc->isem); in hp_sdc_mlc_in()
179 static int hp_sdc_mlc_cts(hil_mlc *mlc) in hp_sdc_mlc_cts() argument
183 priv = mlc->priv; in hp_sdc_mlc_cts()
186 BUG_ON(down_trylock(&mlc->isem)); in hp_sdc_mlc_cts()
187 BUG_ON(down_trylock(&mlc->osem)); in hp_sdc_mlc_cts()
189 up(&mlc->isem); in hp_sdc_mlc_cts()
190 up(&mlc->osem); in hp_sdc_mlc_cts()
192 if (down_trylock(&mlc->csem)) { in hp_sdc_mlc_cts()
193 if (priv->trans.act.semaphore != &mlc->csem) in hp_sdc_mlc_cts()
203 priv->trans.act.semaphore = &mlc->csem; in hp_sdc_mlc_cts()
217 priv->trans.act.semaphore = &mlc->osem; in hp_sdc_mlc_cts()
218 up(&mlc->csem); in hp_sdc_mlc_cts()
222 static int hp_sdc_mlc_out(hil_mlc *mlc) in hp_sdc_mlc_out() argument
226 priv = mlc->priv; in hp_sdc_mlc_out()
229 BUG_ON(down_trylock(&mlc->osem)); in hp_sdc_mlc_out()
231 if (mlc->opacket & HIL_DO_ALTER_CTRL) in hp_sdc_mlc_out()
236 up(&mlc->osem); in hp_sdc_mlc_out()
240 BUG_ON(down_trylock(&mlc->csem)); in hp_sdc_mlc_out()
241 up(&mlc->csem); in hp_sdc_mlc_out()
245 priv->trans.act.semaphore = &mlc->osem; in hp_sdc_mlc_out()
251 (mlc->opacket & in hp_sdc_mlc_out()
255 (mlc->opacket & HIL_PKT_DATA_MASK) in hp_sdc_mlc_out()
264 priv->emtestmode = mlc->opacket & HIL_CTRL_TEST; in hp_sdc_mlc_out()
267 BUG_ON((mlc->opacket & (HIL_CTRL_APE | HIL_CTRL_IPF)) == HIL_CTRL_APE); in hp_sdc_mlc_out()
269 if ((mlc->opacket & HIL_CTRL_ONLY) == HIL_CTRL_ONLY) in hp_sdc_mlc_out()
273 BUG_ON(mlc->opacket & HIL_CTRL_APE); in hp_sdc_mlc_out()
286 priv->trans.act.semaphore = &mlc->osem; in hp_sdc_mlc_out()
294 if (mlc->opacket & HIL_CTRL_APE) { in hp_sdc_mlc_out()
296 BUG_ON(down_trylock(&mlc->csem)); in hp_sdc_mlc_out()
304 hil_mlc *mlc = &hp_sdc_mlc; in hp_sdc_mlc_init() local
316 hp_sdc_mlc_priv.trans.act.semaphore = &mlc->osem; in hp_sdc_mlc_init()
319 mlc->cts = &hp_sdc_mlc_cts; in hp_sdc_mlc_init()
320 mlc->in = &hp_sdc_mlc_in; in hp_sdc_mlc_init()
321 mlc->out = &hp_sdc_mlc_out; in hp_sdc_mlc_init()
322 mlc->priv = &hp_sdc_mlc_priv; in hp_sdc_mlc_init()
324 err = hil_mlc_register(mlc); in hp_sdc_mlc_init()
332 if (hil_mlc_unregister(mlc)) in hp_sdc_mlc_init()
343 hil_mlc *mlc = &hp_sdc_mlc; in hp_sdc_mlc_exit() local
349 if (hil_mlc_unregister(mlc)) in hp_sdc_mlc_exit()