Lines Matching refs:mep
20 static int ep_fifo_alloc(struct mtu3_ep *mep, u32 seg_size) in ep_fifo_alloc() argument
22 struct mtu3_fifo_info *fifo = mep->fifo; in ep_fifo_alloc()
31 mep->fifo_seg_size = num_bits * MTU3_EP_FIFO_UNIT; in ep_fifo_alloc()
32 num_bits = num_bits * (mep->slot + 1); in ep_fifo_alloc()
39 mep->fifo_size = num_bits * MTU3_EP_FIFO_UNIT; in ep_fifo_alloc()
40 mep->fifo_addr = fifo->base + MTU3_EP_FIFO_UNIT * start_bit; in ep_fifo_alloc()
42 dev_dbg(mep->mtu->dev, "%s fifo:%#x/%#x, start_bit: %d\n", in ep_fifo_alloc()
43 __func__, mep->fifo_seg_size, mep->fifo_size, start_bit); in ep_fifo_alloc()
45 return mep->fifo_addr; in ep_fifo_alloc()
48 static void ep_fifo_free(struct mtu3_ep *mep) in ep_fifo_free() argument
50 struct mtu3_fifo_info *fifo = mep->fifo; in ep_fifo_free()
51 u32 addr = mep->fifo_addr; in ep_fifo_free()
52 u32 bits = mep->fifo_size / MTU3_EP_FIFO_UNIT; in ep_fifo_free()
60 mep->fifo_size = 0; in ep_fifo_free()
61 mep->fifo_seg_size = 0; in ep_fifo_free()
63 dev_dbg(mep->mtu->dev, "%s size:%#x/%#x, start_bit: %d\n", in ep_fifo_free()
64 __func__, mep->fifo_seg_size, mep->fifo_size, start_bit); in ep_fifo_free()
203 static void mtu3_ep_reset(struct mtu3_ep *mep) in mtu3_ep_reset() argument
205 struct mtu3 *mtu = mep->mtu; in mtu3_ep_reset()
206 u32 rst_bit = EP_RST(mep->is_in, mep->epnum); in mtu3_ep_reset()
213 void mtu3_ep_stall_set(struct mtu3_ep *mep, bool set) in mtu3_ep_stall_set() argument
215 struct mtu3 *mtu = mep->mtu; in mtu3_ep_stall_set()
217 u8 epnum = mep->epnum; in mtu3_ep_stall_set()
220 if (mep->is_in) { /* TX */ in mtu3_ep_stall_set()
237 mtu3_ep_reset(mep); in mtu3_ep_stall_set()
238 mep->flags &= ~MTU3_EP_STALL; in mtu3_ep_stall_set()
240 mep->flags |= MTU3_EP_STALL; in mtu3_ep_stall_set()
243 dev_dbg(mtu->dev, "%s: %s\n", mep->name, in mtu3_ep_stall_set()
298 int mtu3_config_ep(struct mtu3 *mtu, struct mtu3_ep *mep, in mtu3_config_ep() argument
302 int epnum = mep->epnum; in mtu3_config_ep()
307 fifo_addr = ep_fifo_alloc(mep, mep->maxp); in mtu3_config_ep()
309 dev_err(mtu->dev, "alloc ep fifo failed(%d)\n", mep->maxp); in mtu3_config_ep()
312 fifo_sgsz = ilog2(mep->fifo_seg_size); in mtu3_config_ep()
314 mep->fifo_seg_size, mep->fifo_size); in mtu3_config_ep()
316 if (mep->is_in) { in mtu3_config_ep()
317 csr0 = TX_TXMAXPKTSZ(mep->maxp); in mtu3_config_ep()
321 csr1 = TX_SS_BURST(burst) | TX_SLOT(mep->slot); in mtu3_config_ep()
327 switch (mep->type) { in mtu3_config_ep()
353 csr0 = RX_RXMAXPKTSZ(mep->maxp); in mtu3_config_ep()
357 csr1 = RX_SS_BURST(burst) | RX_SLOT(mep->slot); in mtu3_config_ep()
363 switch (mep->type) { in mtu3_config_ep()
392 __func__, mep->name, mep->fifo_addr, mep->fifo_size, in mtu3_config_ep()
393 fifo_sgsz, mep->fifo_seg_size); in mtu3_config_ep()
399 void mtu3_deconfig_ep(struct mtu3 *mtu, struct mtu3_ep *mep) in mtu3_deconfig_ep() argument
402 int epnum = mep->epnum; in mtu3_deconfig_ep()
404 if (mep->is_in) { in mtu3_deconfig_ep()
416 mtu3_ep_reset(mep); in mtu3_deconfig_ep()
417 ep_fifo_free(mep); in mtu3_deconfig_ep()
419 dev_dbg(mtu->dev, "%s: %s\n", __func__, mep->name); in mtu3_deconfig_ep()
522 struct mtu3_ep *mep = mtu->in_eps + i; in mtu3_mem_alloc() local
524 mep->fifo = &mtu->tx_fifo; in mtu3_mem_alloc()
525 mep = mtu->out_eps + i; in mtu3_mem_alloc()
526 mep->fifo = &mtu->rx_fifo; in mtu3_mem_alloc()