dwc 51 drivers/dma/dw/core.c static struct dw_desc *dwc_first_active(struct dw_dma_chan *dwc) dwc 53 drivers/dma/dw/core.c return to_dw_desc(dwc->active_list.next); dwc 59 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(tx->chan); dwc 63 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 72 drivers/dma/dw/core.c list_add_tail(&desc->desc_node, &dwc->queue); dwc 73 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 80 drivers/dma/dw/core.c static struct dw_desc *dwc_desc_get(struct dw_dma_chan *dwc) dwc 82 drivers/dma/dw/core.c struct dw_dma *dw = to_dw_dma(dwc->chan.device); dwc 90 drivers/dma/dw/core.c dwc->descs_allocated++; dwc 92 drivers/dma/dw/core.c dma_async_tx_descriptor_init(&desc->txd, &dwc->chan); dwc 99 drivers/dma/dw/core.c static void dwc_desc_put(struct dw_dma_chan *dwc, struct dw_desc *desc) dwc 101 drivers/dma/dw/core.c struct dw_dma *dw = to_dw_dma(dwc->chan.device); dwc 110 drivers/dma/dw/core.c dwc->descs_allocated--; dwc 114 drivers/dma/dw/core.c dwc->descs_allocated--; dwc 117 drivers/dma/dw/core.c static void dwc_initialize(struct dw_dma_chan *dwc) dwc 119 drivers/dma/dw/core.c struct dw_dma *dw = to_dw_dma(dwc->chan.device); dwc 121 drivers/dma/dw/core.c if (test_bit(DW_DMA_IS_INITIALIZED, &dwc->flags)) dwc 124 drivers/dma/dw/core.c dw->initialize_chan(dwc); dwc 127 drivers/dma/dw/core.c channel_set_bit(dw, MASK.XFER, dwc->mask); dwc 128 drivers/dma/dw/core.c channel_set_bit(dw, MASK.ERROR, dwc->mask); dwc 130 drivers/dma/dw/core.c set_bit(DW_DMA_IS_INITIALIZED, &dwc->flags); dwc 135 drivers/dma/dw/core.c static inline void dwc_dump_chan_regs(struct dw_dma_chan *dwc) dwc 137 drivers/dma/dw/core.c dev_err(chan2dev(&dwc->chan), dwc 139 drivers/dma/dw/core.c channel_readl(dwc, SAR), dwc 140 drivers/dma/dw/core.c channel_readl(dwc, DAR), dwc 141 drivers/dma/dw/core.c channel_readl(dwc, LLP), dwc 142 drivers/dma/dw/core.c channel_readl(dwc, CTL_HI), dwc 143 drivers/dma/dw/core.c channel_readl(dwc, CTL_LO)); dwc 146 drivers/dma/dw/core.c static inline void dwc_chan_disable(struct dw_dma *dw, struct dw_dma_chan *dwc) dwc 148 drivers/dma/dw/core.c channel_clear_bit(dw, CH_EN, dwc->mask); dwc 149 drivers/dma/dw/core.c while (dma_readl(dw, CH_EN) & dwc->mask) dwc 156 drivers/dma/dw/core.c static inline void dwc_do_single_block(struct dw_dma_chan *dwc, dwc 159 drivers/dma/dw/core.c struct dw_dma *dw = to_dw_dma(dwc->chan.device); dwc 168 drivers/dma/dw/core.c channel_writel(dwc, SAR, lli_read(desc, sar)); dwc 169 drivers/dma/dw/core.c channel_writel(dwc, DAR, lli_read(desc, dar)); dwc 170 drivers/dma/dw/core.c channel_writel(dwc, CTL_LO, ctllo); dwc 171 drivers/dma/dw/core.c channel_writel(dwc, CTL_HI, lli_read(desc, ctlhi)); dwc 172 drivers/dma/dw/core.c channel_set_bit(dw, CH_EN, dwc->mask); dwc 175 drivers/dma/dw/core.c dwc->tx_node_active = dwc->tx_node_active->next; dwc 179 drivers/dma/dw/core.c static void dwc_dostart(struct dw_dma_chan *dwc, struct dw_desc *first) dwc 181 drivers/dma/dw/core.c struct dw_dma *dw = to_dw_dma(dwc->chan.device); dwc 182 drivers/dma/dw/core.c u8 lms = DWC_LLP_LMS(dwc->dws.m_master); dwc 186 drivers/dma/dw/core.c if (dma_readl(dw, CH_EN) & dwc->mask) { dwc 187 drivers/dma/dw/core.c dev_err(chan2dev(&dwc->chan), dwc 190 drivers/dma/dw/core.c dwc_dump_chan_regs(dwc); dwc 196 drivers/dma/dw/core.c if (dwc->nollp) { dwc 198 drivers/dma/dw/core.c &dwc->flags); dwc 200 drivers/dma/dw/core.c dev_err(chan2dev(&dwc->chan), dwc 205 drivers/dma/dw/core.c dwc_initialize(dwc); dwc 208 drivers/dma/dw/core.c dwc->tx_node_active = &first->tx_list; dwc 211 drivers/dma/dw/core.c dwc_do_single_block(dwc, first); dwc 216 drivers/dma/dw/core.c dwc_initialize(dwc); dwc 218 drivers/dma/dw/core.c channel_writel(dwc, LLP, first->txd.phys | lms); dwc 219 drivers/dma/dw/core.c channel_writel(dwc, CTL_LO, DWC_CTLL_LLP_D_EN | DWC_CTLL_LLP_S_EN); dwc 220 drivers/dma/dw/core.c channel_writel(dwc, CTL_HI, 0); dwc 221 drivers/dma/dw/core.c channel_set_bit(dw, CH_EN, dwc->mask); dwc 224 drivers/dma/dw/core.c static void dwc_dostart_first_queued(struct dw_dma_chan *dwc) dwc 228 drivers/dma/dw/core.c if (list_empty(&dwc->queue)) dwc 231 drivers/dma/dw/core.c list_move(dwc->queue.next, &dwc->active_list); dwc 232 drivers/dma/dw/core.c desc = dwc_first_active(dwc); dwc 233 drivers/dma/dw/core.c dev_vdbg(chan2dev(&dwc->chan), "%s: started %u\n", __func__, desc->txd.cookie); dwc 234 drivers/dma/dw/core.c dwc_dostart(dwc, desc); dwc 240 drivers/dma/dw/core.c dwc_descriptor_complete(struct dw_dma_chan *dwc, struct dw_desc *desc, dwc 248 drivers/dma/dw/core.c dev_vdbg(chan2dev(&dwc->chan), "descriptor %u complete\n", txd->cookie); dwc 250 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 261 drivers/dma/dw/core.c dwc_desc_put(dwc, desc); dwc 262 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 267 drivers/dma/dw/core.c static void dwc_complete_all(struct dw_dma *dw, struct dw_dma_chan *dwc) dwc 273 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 274 drivers/dma/dw/core.c if (dma_readl(dw, CH_EN) & dwc->mask) { dwc 275 drivers/dma/dw/core.c dev_err(chan2dev(&dwc->chan), dwc 279 drivers/dma/dw/core.c dwc_chan_disable(dw, dwc); dwc 286 drivers/dma/dw/core.c list_splice_init(&dwc->active_list, &list); dwc 287 drivers/dma/dw/core.c dwc_dostart_first_queued(dwc); dwc 289 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 292 drivers/dma/dw/core.c dwc_descriptor_complete(dwc, desc, true); dwc 296 drivers/dma/dw/core.c static inline u32 dwc_get_sent(struct dw_dma_chan *dwc) dwc 298 drivers/dma/dw/core.c struct dw_dma *dw = to_dw_dma(dwc->chan.device); dwc 299 drivers/dma/dw/core.c u32 ctlhi = channel_readl(dwc, CTL_HI); dwc 300 drivers/dma/dw/core.c u32 ctllo = channel_readl(dwc, CTL_LO); dwc 302 drivers/dma/dw/core.c return dw->block2bytes(dwc, ctlhi, ctllo >> 4 & 7); dwc 305 drivers/dma/dw/core.c static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc) dwc 313 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 314 drivers/dma/dw/core.c llp = channel_readl(dwc, LLP); dwc 317 drivers/dma/dw/core.c if (status_xfer & dwc->mask) { dwc 319 drivers/dma/dw/core.c dma_writel(dw, CLEAR.XFER, dwc->mask); dwc 321 drivers/dma/dw/core.c if (test_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags)) { dwc 322 drivers/dma/dw/core.c struct list_head *head, *active = dwc->tx_node_active; dwc 328 drivers/dma/dw/core.c desc = dwc_first_active(dwc); dwc 341 drivers/dma/dw/core.c dwc_do_single_block(dwc, child); dwc 343 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 348 drivers/dma/dw/core.c clear_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags); dwc 351 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 353 drivers/dma/dw/core.c dwc_complete_all(dw, dwc); dwc 357 drivers/dma/dw/core.c if (list_empty(&dwc->active_list)) { dwc 358 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 362 drivers/dma/dw/core.c if (test_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags)) { dwc 363 drivers/dma/dw/core.c dev_vdbg(chan2dev(&dwc->chan), "%s: soft LLP mode\n", __func__); dwc 364 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 368 drivers/dma/dw/core.c dev_vdbg(chan2dev(&dwc->chan), "%s: llp=%pad\n", __func__, &llp); dwc 370 drivers/dma/dw/core.c list_for_each_entry_safe(desc, _desc, &dwc->active_list, desc_node) { dwc 376 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 383 drivers/dma/dw/core.c desc->residue -= dwc_get_sent(dwc); dwc 384 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 392 drivers/dma/dw/core.c desc->residue -= dwc_get_sent(dwc); dwc 393 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 403 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 404 drivers/dma/dw/core.c dwc_descriptor_complete(dwc, desc, true); dwc 405 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 408 drivers/dma/dw/core.c dev_err(chan2dev(&dwc->chan), dwc 412 drivers/dma/dw/core.c dwc_chan_disable(dw, dwc); dwc 414 drivers/dma/dw/core.c dwc_dostart_first_queued(dwc); dwc 415 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 418 drivers/dma/dw/core.c static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_desc *desc) dwc 420 drivers/dma/dw/core.c dev_crit(chan2dev(&dwc->chan), " desc: s0x%x d0x%x l0x%x c0x%x:%x\n", dwc 428 drivers/dma/dw/core.c static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc) dwc 434 drivers/dma/dw/core.c dwc_scan_descriptors(dw, dwc); dwc 436 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 443 drivers/dma/dw/core.c bad_desc = dwc_first_active(dwc); dwc 445 drivers/dma/dw/core.c list_move(dwc->queue.next, dwc->active_list.prev); dwc 448 drivers/dma/dw/core.c dma_writel(dw, CLEAR.ERROR, dwc->mask); dwc 449 drivers/dma/dw/core.c if (!list_empty(&dwc->active_list)) dwc 450 drivers/dma/dw/core.c dwc_dostart(dwc, dwc_first_active(dwc)); dwc 459 drivers/dma/dw/core.c dev_WARN(chan2dev(&dwc->chan), "Bad descriptor submitted for DMA!\n" dwc 461 drivers/dma/dw/core.c dwc_dump_lli(dwc, bad_desc); dwc 463 drivers/dma/dw/core.c dwc_dump_lli(dwc, child); dwc 465 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 468 drivers/dma/dw/core.c dwc_descriptor_complete(dwc, bad_desc, true); dwc 474 drivers/dma/dw/core.c struct dw_dma_chan *dwc; dwc 485 drivers/dma/dw/core.c dwc = &dw->chan[i]; dwc 486 drivers/dma/dw/core.c if (test_bit(DW_DMA_IS_CYCLIC, &dwc->flags)) dwc 489 drivers/dma/dw/core.c dwc_handle_error(dw, dwc); dwc 491 drivers/dma/dw/core.c dwc_scan_descriptors(dw, dwc); dwc 548 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(chan); dwc 555 drivers/dma/dw/core.c u8 m_master = dwc->dws.m_master; dwc 571 drivers/dma/dw/core.c dwc->direction = DMA_MEM_TO_MEM; dwc 575 drivers/dma/dw/core.c ctllo = dw->prepare_ctllo(dwc) dwc 584 drivers/dma/dw/core.c desc = dwc_desc_get(dwc); dwc 588 drivers/dma/dw/core.c ctlhi = dw->bytes2block(dwc, len - offset, src_width, &xfer_count); dwc 617 drivers/dma/dw/core.c dwc_desc_put(dwc, first); dwc 626 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(chan); dwc 628 drivers/dma/dw/core.c struct dma_slave_config *sconfig = &dwc->dma_sconfig; dwc 632 drivers/dma/dw/core.c u8 m_master = dwc->dws.m_master; dwc 647 drivers/dma/dw/core.c dwc->direction = direction; dwc 655 drivers/dma/dw/core.c ctllo = dw->prepare_ctllo(dwc) dwc 674 drivers/dma/dw/core.c desc = dwc_desc_get(dwc); dwc 678 drivers/dma/dw/core.c ctlhi = dw->bytes2block(dwc, len, mem_width, &dlen); dwc 705 drivers/dma/dw/core.c ctllo = dw->prepare_ctllo(dwc) dwc 722 drivers/dma/dw/core.c desc = dwc_desc_get(dwc); dwc 726 drivers/dma/dw/core.c ctlhi = dw->bytes2block(dwc, len, reg_width, &dlen); dwc 768 drivers/dma/dw/core.c dwc_desc_put(dwc, first); dwc 774 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(chan); dwc 781 drivers/dma/dw/core.c memcpy(&dwc->dws, dws, sizeof(struct dw_dma_slave)); dwc 789 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(chan); dwc 792 drivers/dma/dw/core.c memcpy(&dwc->dma_sconfig, sconfig, sizeof(*sconfig)); dwc 794 drivers/dma/dw/core.c dw->encode_maxburst(dwc, &dwc->dma_sconfig.src_maxburst); dwc 795 drivers/dma/dw/core.c dw->encode_maxburst(dwc, &dwc->dma_sconfig.dst_maxburst); dwc 800 drivers/dma/dw/core.c static void dwc_chan_pause(struct dw_dma_chan *dwc, bool drain) dwc 802 drivers/dma/dw/core.c struct dw_dma *dw = to_dw_dma(dwc->chan.device); dwc 805 drivers/dma/dw/core.c dw->suspend_chan(dwc, drain); dwc 807 drivers/dma/dw/core.c while (!(channel_readl(dwc, CFG_LO) & DWC_CFGL_FIFO_EMPTY) && count--) dwc 810 drivers/dma/dw/core.c set_bit(DW_DMA_IS_PAUSED, &dwc->flags); dwc 815 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(chan); dwc 818 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 819 drivers/dma/dw/core.c dwc_chan_pause(dwc, false); dwc 820 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 825 drivers/dma/dw/core.c static inline void dwc_chan_resume(struct dw_dma_chan *dwc, bool drain) dwc 827 drivers/dma/dw/core.c struct dw_dma *dw = to_dw_dma(dwc->chan.device); dwc 829 drivers/dma/dw/core.c dw->resume_chan(dwc, drain); dwc 831 drivers/dma/dw/core.c clear_bit(DW_DMA_IS_PAUSED, &dwc->flags); dwc 836 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(chan); dwc 839 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 841 drivers/dma/dw/core.c if (test_bit(DW_DMA_IS_PAUSED, &dwc->flags)) dwc 842 drivers/dma/dw/core.c dwc_chan_resume(dwc, false); dwc 844 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 851 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(chan); dwc 857 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 859 drivers/dma/dw/core.c clear_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags); dwc 861 drivers/dma/dw/core.c dwc_chan_pause(dwc, true); dwc 863 drivers/dma/dw/core.c dwc_chan_disable(dw, dwc); dwc 865 drivers/dma/dw/core.c dwc_chan_resume(dwc, true); dwc 868 drivers/dma/dw/core.c list_splice_init(&dwc->queue, &list); dwc 869 drivers/dma/dw/core.c list_splice_init(&dwc->active_list, &list); dwc 871 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 875 drivers/dma/dw/core.c dwc_descriptor_complete(dwc, desc, false); dwc 880 drivers/dma/dw/core.c static struct dw_desc *dwc_find_desc(struct dw_dma_chan *dwc, dma_cookie_t c) dwc 884 drivers/dma/dw/core.c list_for_each_entry(desc, &dwc->active_list, desc_node) dwc 891 drivers/dma/dw/core.c static u32 dwc_get_residue(struct dw_dma_chan *dwc, dma_cookie_t cookie) dwc 897 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 899 drivers/dma/dw/core.c desc = dwc_find_desc(dwc, cookie); dwc 901 drivers/dma/dw/core.c if (desc == dwc_first_active(dwc)) { dwc 903 drivers/dma/dw/core.c if (test_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags) && residue) dwc 904 drivers/dma/dw/core.c residue -= dwc_get_sent(dwc); dwc 912 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 921 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(chan); dwc 928 drivers/dma/dw/core.c dwc_scan_descriptors(to_dw_dma(chan->device), dwc); dwc 934 drivers/dma/dw/core.c dma_set_residue(txstate, dwc_get_residue(dwc, cookie)); dwc 936 drivers/dma/dw/core.c if (test_bit(DW_DMA_IS_PAUSED, &dwc->flags) && ret == DMA_IN_PROGRESS) dwc 944 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(chan); dwc 947 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 948 drivers/dma/dw/core.c if (list_empty(&dwc->active_list)) dwc 949 drivers/dma/dw/core.c dwc_dostart_first_queued(dwc); dwc 950 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 981 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(chan); dwc 987 drivers/dma/dw/core.c if (dma_readl(dw, CH_EN) & dwc->mask) { dwc 1011 drivers/dma/dw/core.c dw->in_use |= dwc->mask; dwc 1018 drivers/dma/dw/core.c struct dw_dma_chan *dwc = to_dw_dma_chan(chan); dwc 1023 drivers/dma/dw/core.c dwc->descs_allocated); dwc 1026 drivers/dma/dw/core.c BUG_ON(!list_empty(&dwc->active_list)); dwc 1027 drivers/dma/dw/core.c BUG_ON(!list_empty(&dwc->queue)); dwc 1028 drivers/dma/dw/core.c BUG_ON(dma_readl(to_dw_dma(chan->device), CH_EN) & dwc->mask); dwc 1030 drivers/dma/dw/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 1033 drivers/dma/dw/core.c memset(&dwc->dws, 0, sizeof(struct dw_dma_slave)); dwc 1035 drivers/dma/dw/core.c clear_bit(DW_DMA_IS_INITIALIZED, &dwc->flags); dwc 1038 drivers/dma/dw/core.c channel_clear_bit(dw, MASK.XFER, dwc->mask); dwc 1039 drivers/dma/dw/core.c channel_clear_bit(dw, MASK.BLOCK, dwc->mask); dwc 1040 drivers/dma/dw/core.c channel_clear_bit(dw, MASK.ERROR, dwc->mask); dwc 1042 drivers/dma/dw/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1045 drivers/dma/dw/core.c dw->in_use &= ~dwc->mask; dwc 1138 drivers/dma/dw/core.c struct dw_dma_chan *dwc = &dw->chan[i]; dwc 1140 drivers/dma/dw/core.c dwc->chan.device = &dw->dma; dwc 1141 drivers/dma/dw/core.c dma_cookie_init(&dwc->chan); dwc 1143 drivers/dma/dw/core.c list_add_tail(&dwc->chan.device_node, dwc 1146 drivers/dma/dw/core.c list_add(&dwc->chan.device_node, &dw->dma.channels); dwc 1150 drivers/dma/dw/core.c dwc->priority = pdata->nr_channels - i - 1; dwc 1152 drivers/dma/dw/core.c dwc->priority = i; dwc 1154 drivers/dma/dw/core.c dwc->ch_regs = &__dw_regs(dw)->CHAN[i]; dwc 1155 drivers/dma/dw/core.c spin_lock_init(&dwc->lock); dwc 1156 drivers/dma/dw/core.c dwc->mask = 1 << i; dwc 1158 drivers/dma/dw/core.c INIT_LIST_HEAD(&dwc->active_list); dwc 1159 drivers/dma/dw/core.c INIT_LIST_HEAD(&dwc->queue); dwc 1161 drivers/dma/dw/core.c channel_clear_bit(dw, CH_EN, dwc->mask); dwc 1163 drivers/dma/dw/core.c dwc->direction = DMA_TRANS_NONE; dwc 1179 drivers/dma/dw/core.c dwc->block_size = dwc 1181 drivers/dma/dw/core.c dwc->nollp = dwc 1184 drivers/dma/dw/core.c dwc->block_size = pdata->block_size; dwc 1185 drivers/dma/dw/core.c dwc->nollp = !pdata->multi_block[i]; dwc 1244 drivers/dma/dw/core.c struct dw_dma_chan *dwc, *_dwc; dwc 1254 drivers/dma/dw/core.c list_for_each_entry_safe(dwc, _dwc, &dw->dma.channels, dwc 1256 drivers/dma/dw/core.c list_del(&dwc->chan.device_node); dwc 1257 drivers/dma/dw/core.c channel_clear_bit(dw, CH_EN, dwc->mask); dwc 14 drivers/dma/dw/dw.c static void dw_dma_initialize_chan(struct dw_dma_chan *dwc) dwc 16 drivers/dma/dw/dw.c struct dw_dma *dw = to_dw_dma(dwc->chan.device); dwc 18 drivers/dma/dw/dw.c u32 cfglo = DWC_CFGL_CH_PRIOR(dwc->priority); dwc 19 drivers/dma/dw/dw.c bool hs_polarity = dwc->dws.hs_polarity; dwc 21 drivers/dma/dw/dw.c cfghi |= DWC_CFGH_DST_PER(dwc->dws.dst_id); dwc 22 drivers/dma/dw/dw.c cfghi |= DWC_CFGH_SRC_PER(dwc->dws.src_id); dwc 28 drivers/dma/dw/dw.c channel_writel(dwc, CFG_LO, cfglo); dwc 29 drivers/dma/dw/dw.c channel_writel(dwc, CFG_HI, cfghi); dwc 32 drivers/dma/dw/dw.c static void dw_dma_suspend_chan(struct dw_dma_chan *dwc, bool drain) dwc 34 drivers/dma/dw/dw.c u32 cfglo = channel_readl(dwc, CFG_LO); dwc 36 drivers/dma/dw/dw.c channel_writel(dwc, CFG_LO, cfglo | DWC_CFGL_CH_SUSP); dwc 39 drivers/dma/dw/dw.c static void dw_dma_resume_chan(struct dw_dma_chan *dwc, bool drain) dwc 41 drivers/dma/dw/dw.c u32 cfglo = channel_readl(dwc, CFG_LO); dwc 43 drivers/dma/dw/dw.c channel_writel(dwc, CFG_LO, cfglo & ~DWC_CFGL_CH_SUSP); dwc 46 drivers/dma/dw/dw.c static u32 dw_dma_bytes2block(struct dw_dma_chan *dwc, dwc 51 drivers/dma/dw/dw.c if ((bytes >> width) > dwc->block_size) { dwc 52 drivers/dma/dw/dw.c block = dwc->block_size; dwc 53 drivers/dma/dw/dw.c *len = dwc->block_size << width; dwc 62 drivers/dma/dw/dw.c static size_t dw_dma_block2bytes(struct dw_dma_chan *dwc, u32 block, u32 width) dwc 67 drivers/dma/dw/dw.c static u32 dw_dma_prepare_ctllo(struct dw_dma_chan *dwc) dwc 69 drivers/dma/dw/dw.c struct dma_slave_config *sconfig = &dwc->dma_sconfig; dwc 70 drivers/dma/dw/dw.c bool is_slave = is_slave_direction(dwc->direction); dwc 73 drivers/dma/dw/dw.c u8 p_master = dwc->dws.p_master; dwc 74 drivers/dma/dw/dw.c u8 m_master = dwc->dws.m_master; dwc 75 drivers/dma/dw/dw.c u8 dms = (dwc->direction == DMA_MEM_TO_DEV) ? p_master : m_master; dwc 76 drivers/dma/dw/dw.c u8 sms = (dwc->direction == DMA_DEV_TO_MEM) ? p_master : m_master; dwc 83 drivers/dma/dw/dw.c static void dw_dma_encode_maxburst(struct dw_dma_chan *dwc, u32 *maxburst) dwc 12 drivers/dma/dw/idma32.c static void idma32_initialize_chan(struct dw_dma_chan *dwc) dwc 21 drivers/dma/dw/idma32.c cfghi |= IDMA32C_CFGH_DST_PER(dwc->dws.dst_id & 0xf); dwc 22 drivers/dma/dw/idma32.c cfghi |= IDMA32C_CFGH_SRC_PER(dwc->dws.src_id & 0xf); dwc 25 drivers/dma/dw/idma32.c cfghi |= IDMA32C_CFGH_DST_PER_EXT(dwc->dws.dst_id >> 4 & 0x3); dwc 26 drivers/dma/dw/idma32.c cfghi |= IDMA32C_CFGH_SRC_PER_EXT(dwc->dws.src_id >> 4 & 0x3); dwc 28 drivers/dma/dw/idma32.c channel_writel(dwc, CFG_LO, cfglo); dwc 29 drivers/dma/dw/idma32.c channel_writel(dwc, CFG_HI, cfghi); dwc 32 drivers/dma/dw/idma32.c static void idma32_suspend_chan(struct dw_dma_chan *dwc, bool drain) dwc 34 drivers/dma/dw/idma32.c u32 cfglo = channel_readl(dwc, CFG_LO); dwc 39 drivers/dma/dw/idma32.c channel_writel(dwc, CFG_LO, cfglo | DWC_CFGL_CH_SUSP); dwc 42 drivers/dma/dw/idma32.c static void idma32_resume_chan(struct dw_dma_chan *dwc, bool drain) dwc 44 drivers/dma/dw/idma32.c u32 cfglo = channel_readl(dwc, CFG_LO); dwc 49 drivers/dma/dw/idma32.c channel_writel(dwc, CFG_LO, cfglo & ~DWC_CFGL_CH_SUSP); dwc 52 drivers/dma/dw/idma32.c static u32 idma32_bytes2block(struct dw_dma_chan *dwc, dwc 57 drivers/dma/dw/idma32.c if (bytes > dwc->block_size) { dwc 58 drivers/dma/dw/idma32.c block = dwc->block_size; dwc 59 drivers/dma/dw/idma32.c *len = dwc->block_size; dwc 68 drivers/dma/dw/idma32.c static size_t idma32_block2bytes(struct dw_dma_chan *dwc, u32 block, u32 width) dwc 73 drivers/dma/dw/idma32.c static u32 idma32_prepare_ctllo(struct dw_dma_chan *dwc) dwc 75 drivers/dma/dw/idma32.c struct dma_slave_config *sconfig = &dwc->dma_sconfig; dwc 76 drivers/dma/dw/idma32.c bool is_slave = is_slave_direction(dwc->direction); dwc 84 drivers/dma/dw/idma32.c static void idma32_encode_maxburst(struct dw_dma_chan *dwc, u32 *maxburst) dwc 295 drivers/dma/dw/regs.h __dwc_regs(struct dw_dma_chan *dwc) dwc 297 drivers/dma/dw/regs.h return dwc->ch_regs; dwc 300 drivers/dma/dw/regs.h #define channel_readl(dwc, name) \ dwc 301 drivers/dma/dw/regs.h readl(&(__dwc_regs(dwc)->name)) dwc 302 drivers/dma/dw/regs.h #define channel_writel(dwc, name, val) \ dwc 303 drivers/dma/dw/regs.h writel((val), &(__dwc_regs(dwc)->name)) dwc 323 drivers/dma/dw/regs.h void (*initialize_chan)(struct dw_dma_chan *dwc); dwc 324 drivers/dma/dw/regs.h void (*suspend_chan)(struct dw_dma_chan *dwc, bool drain); dwc 325 drivers/dma/dw/regs.h void (*resume_chan)(struct dw_dma_chan *dwc, bool drain); dwc 326 drivers/dma/dw/regs.h u32 (*prepare_ctllo)(struct dw_dma_chan *dwc); dwc 327 drivers/dma/dw/regs.h void (*encode_maxburst)(struct dw_dma_chan *dwc, u32 *maxburst); dwc 328 drivers/dma/dw/regs.h u32 (*bytes2block)(struct dw_dma_chan *dwc, size_t bytes, dwc 330 drivers/dma/dw/regs.h size_t (*block2bytes)(struct dw_dma_chan *dwc, u32 block, u32 width); dwc 47 drivers/usb/dwc3/core.c static int dwc3_get_dr_mode(struct dwc3 *dwc) dwc 50 drivers/usb/dwc3/core.c struct device *dev = dwc->dev; dwc 53 drivers/usb/dwc3/core.c if (dwc->dr_mode == USB_DR_MODE_UNKNOWN) dwc 54 drivers/usb/dwc3/core.c dwc->dr_mode = USB_DR_MODE_OTG; dwc 56 drivers/usb/dwc3/core.c mode = dwc->dr_mode; dwc 57 drivers/usb/dwc3/core.c hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); dwc 88 drivers/usb/dwc3/core.c dwc->revision >= DWC3_REVISION_330A) dwc 92 drivers/usb/dwc3/core.c if (mode != dwc->dr_mode) { dwc 97 drivers/usb/dwc3/core.c dwc->dr_mode = mode; dwc 103 drivers/usb/dwc3/core.c void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode) dwc 107 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GCTL); dwc 110 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GCTL, reg); dwc 112 drivers/usb/dwc3/core.c dwc->current_dr_role = mode; dwc 117 drivers/usb/dwc3/core.c struct dwc3 *dwc = work_to_dwc(work); dwc 121 drivers/usb/dwc3/core.c if (dwc->dr_mode != USB_DR_MODE_OTG) dwc 124 drivers/usb/dwc3/core.c if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_OTG) dwc 125 drivers/usb/dwc3/core.c dwc3_otg_update(dwc, 0); dwc 127 drivers/usb/dwc3/core.c if (!dwc->desired_dr_role) dwc 130 drivers/usb/dwc3/core.c if (dwc->desired_dr_role == dwc->current_dr_role) dwc 133 drivers/usb/dwc3/core.c if (dwc->desired_dr_role == DWC3_GCTL_PRTCAP_OTG && dwc->edev) dwc 136 drivers/usb/dwc3/core.c switch (dwc->current_dr_role) { dwc 138 drivers/usb/dwc3/core.c dwc3_host_exit(dwc); dwc 141 drivers/usb/dwc3/core.c dwc3_gadget_exit(dwc); dwc 142 drivers/usb/dwc3/core.c dwc3_event_buffers_cleanup(dwc); dwc 145 drivers/usb/dwc3/core.c dwc3_otg_exit(dwc); dwc 146 drivers/usb/dwc3/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 147 drivers/usb/dwc3/core.c dwc->desired_otg_role = DWC3_OTG_ROLE_IDLE; dwc 148 drivers/usb/dwc3/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 149 drivers/usb/dwc3/core.c dwc3_otg_update(dwc, 1); dwc 155 drivers/usb/dwc3/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 157 drivers/usb/dwc3/core.c dwc3_set_prtcap(dwc, dwc->desired_dr_role); dwc 159 drivers/usb/dwc3/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 161 drivers/usb/dwc3/core.c switch (dwc->desired_dr_role) { dwc 163 drivers/usb/dwc3/core.c ret = dwc3_host_init(dwc); dwc 165 drivers/usb/dwc3/core.c dev_err(dwc->dev, "failed to initialize host\n"); dwc 167 drivers/usb/dwc3/core.c if (dwc->usb2_phy) dwc 168 drivers/usb/dwc3/core.c otg_set_vbus(dwc->usb2_phy->otg, true); dwc 169 drivers/usb/dwc3/core.c phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST); dwc 170 drivers/usb/dwc3/core.c phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_HOST); dwc 174 drivers/usb/dwc3/core.c dwc3_event_buffers_setup(dwc); dwc 176 drivers/usb/dwc3/core.c if (dwc->usb2_phy) dwc 177 drivers/usb/dwc3/core.c otg_set_vbus(dwc->usb2_phy->otg, false); dwc 178 drivers/usb/dwc3/core.c phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_DEVICE); dwc 179 drivers/usb/dwc3/core.c phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_DEVICE); dwc 181 drivers/usb/dwc3/core.c ret = dwc3_gadget_init(dwc); dwc 183 drivers/usb/dwc3/core.c dev_err(dwc->dev, "failed to initialize peripheral\n"); dwc 186 drivers/usb/dwc3/core.c dwc3_otg_init(dwc); dwc 187 drivers/usb/dwc3/core.c dwc3_otg_update(dwc, 0); dwc 195 drivers/usb/dwc3/core.c void dwc3_set_mode(struct dwc3 *dwc, u32 mode) dwc 199 drivers/usb/dwc3/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 200 drivers/usb/dwc3/core.c dwc->desired_dr_role = mode; dwc 201 drivers/usb/dwc3/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 203 drivers/usb/dwc3/core.c queue_work(system_freezable_wq, &dwc->drd_work); dwc 208 drivers/usb/dwc3/core.c struct dwc3 *dwc = dep->dwc; dwc 211 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GDBGFIFOSPACE, dwc 215 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GDBGFIFOSPACE); dwc 224 drivers/usb/dwc3/core.c static int dwc3_core_soft_reset(struct dwc3 *dwc) dwc 230 drivers/usb/dwc3/core.c usb_phy_init(dwc->usb2_phy); dwc 231 drivers/usb/dwc3/core.c usb_phy_init(dwc->usb3_phy); dwc 232 drivers/usb/dwc3/core.c ret = phy_init(dwc->usb2_generic_phy); dwc 236 drivers/usb/dwc3/core.c ret = phy_init(dwc->usb3_generic_phy); dwc 238 drivers/usb/dwc3/core.c phy_exit(dwc->usb2_generic_phy); dwc 247 drivers/usb/dwc3/core.c if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST) dwc 250 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 252 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 260 drivers/usb/dwc3/core.c if (dwc3_is_usb31(dwc) && dwc->revision >= DWC3_USB31_REVISION_190A) dwc 264 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 268 drivers/usb/dwc3/core.c if (dwc3_is_usb31(dwc) && dwc 269 drivers/usb/dwc3/core.c dwc->revision >= DWC3_USB31_REVISION_190A) dwc 275 drivers/usb/dwc3/core.c phy_exit(dwc->usb3_generic_phy); dwc 276 drivers/usb/dwc3/core.c phy_exit(dwc->usb2_generic_phy); dwc 286 drivers/usb/dwc3/core.c if (dwc3_is_usb31(dwc) && dwc->revision <= DWC3_USB31_REVISION_180A) dwc 302 drivers/usb/dwc3/core.c static void dwc3_frame_length_adjustment(struct dwc3 *dwc) dwc 307 drivers/usb/dwc3/core.c if (dwc->revision < DWC3_REVISION_250A) dwc 310 drivers/usb/dwc3/core.c if (dwc->fladj == 0) dwc 313 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GFLADJ); dwc 315 drivers/usb/dwc3/core.c if (dft != dwc->fladj) { dwc 317 drivers/usb/dwc3/core.c reg |= DWC3_GFLADJ_30MHZ_SDBND_SEL | dwc->fladj; dwc 318 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GFLADJ, reg); dwc 327 drivers/usb/dwc3/core.c static void dwc3_free_one_event_buffer(struct dwc3 *dwc, dwc 330 drivers/usb/dwc3/core.c dma_free_coherent(dwc->sysdev, evt->length, evt->buf, evt->dma); dwc 341 drivers/usb/dwc3/core.c static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc, dwc 346 drivers/usb/dwc3/core.c evt = devm_kzalloc(dwc->dev, sizeof(*evt), GFP_KERNEL); dwc 350 drivers/usb/dwc3/core.c evt->dwc = dwc; dwc 352 drivers/usb/dwc3/core.c evt->cache = devm_kzalloc(dwc->dev, length, GFP_KERNEL); dwc 356 drivers/usb/dwc3/core.c evt->buf = dma_alloc_coherent(dwc->sysdev, length, dwc 368 drivers/usb/dwc3/core.c static void dwc3_free_event_buffers(struct dwc3 *dwc) dwc 372 drivers/usb/dwc3/core.c evt = dwc->ev_buf; dwc 374 drivers/usb/dwc3/core.c dwc3_free_one_event_buffer(dwc, evt); dwc 385 drivers/usb/dwc3/core.c static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned length) dwc 389 drivers/usb/dwc3/core.c evt = dwc3_alloc_one_event_buffer(dwc, length); dwc 391 drivers/usb/dwc3/core.c dev_err(dwc->dev, "can't allocate event buffer\n"); dwc 394 drivers/usb/dwc3/core.c dwc->ev_buf = evt; dwc 405 drivers/usb/dwc3/core.c int dwc3_event_buffers_setup(struct dwc3 *dwc) dwc 409 drivers/usb/dwc3/core.c evt = dwc->ev_buf; dwc 411 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(0), dwc 413 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(0), dwc 415 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), dwc 417 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 0); dwc 422 drivers/usb/dwc3/core.c void dwc3_event_buffers_cleanup(struct dwc3 *dwc) dwc 426 drivers/usb/dwc3/core.c evt = dwc->ev_buf; dwc 430 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(0), 0); dwc 431 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(0), 0); dwc 432 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), DWC3_GEVNTSIZ_INTMASK dwc 434 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 0); dwc 437 drivers/usb/dwc3/core.c static int dwc3_alloc_scratch_buffers(struct dwc3 *dwc) dwc 439 drivers/usb/dwc3/core.c if (!dwc->has_hibernation) dwc 442 drivers/usb/dwc3/core.c if (!dwc->nr_scratch) dwc 445 drivers/usb/dwc3/core.c dwc->scratchbuf = kmalloc_array(dwc->nr_scratch, dwc 447 drivers/usb/dwc3/core.c if (!dwc->scratchbuf) dwc 453 drivers/usb/dwc3/core.c static int dwc3_setup_scratch_buffers(struct dwc3 *dwc) dwc 459 drivers/usb/dwc3/core.c if (!dwc->has_hibernation) dwc 462 drivers/usb/dwc3/core.c if (!dwc->nr_scratch) dwc 466 drivers/usb/dwc3/core.c if (!WARN_ON(dwc->scratchbuf)) dwc 469 drivers/usb/dwc3/core.c scratch_addr = dma_map_single(dwc->sysdev, dwc->scratchbuf, dwc 470 drivers/usb/dwc3/core.c dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE, dwc 472 drivers/usb/dwc3/core.c if (dma_mapping_error(dwc->sysdev, scratch_addr)) { dwc 473 drivers/usb/dwc3/core.c dev_err(dwc->sysdev, "failed to map scratch buffer\n"); dwc 478 drivers/usb/dwc3/core.c dwc->scratch_addr = scratch_addr; dwc 482 drivers/usb/dwc3/core.c ret = dwc3_send_gadget_generic_command(dwc, dwc 489 drivers/usb/dwc3/core.c ret = dwc3_send_gadget_generic_command(dwc, dwc 497 drivers/usb/dwc3/core.c dma_unmap_single(dwc->sysdev, dwc->scratch_addr, dwc->nr_scratch * dwc 504 drivers/usb/dwc3/core.c static void dwc3_free_scratch_buffers(struct dwc3 *dwc) dwc 506 drivers/usb/dwc3/core.c if (!dwc->has_hibernation) dwc 509 drivers/usb/dwc3/core.c if (!dwc->nr_scratch) dwc 513 drivers/usb/dwc3/core.c if (!WARN_ON(dwc->scratchbuf)) dwc 516 drivers/usb/dwc3/core.c dma_unmap_single(dwc->sysdev, dwc->scratch_addr, dwc->nr_scratch * dwc 518 drivers/usb/dwc3/core.c kfree(dwc->scratchbuf); dwc 521 drivers/usb/dwc3/core.c static void dwc3_core_num_eps(struct dwc3 *dwc) dwc 523 drivers/usb/dwc3/core.c struct dwc3_hwparams *parms = &dwc->hwparams; dwc 525 drivers/usb/dwc3/core.c dwc->num_eps = DWC3_NUM_EPS(parms); dwc 528 drivers/usb/dwc3/core.c static void dwc3_cache_hwparams(struct dwc3 *dwc) dwc 530 drivers/usb/dwc3/core.c struct dwc3_hwparams *parms = &dwc->hwparams; dwc 532 drivers/usb/dwc3/core.c parms->hwparams0 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS0); dwc 533 drivers/usb/dwc3/core.c parms->hwparams1 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS1); dwc 534 drivers/usb/dwc3/core.c parms->hwparams2 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS2); dwc 535 drivers/usb/dwc3/core.c parms->hwparams3 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS3); dwc 536 drivers/usb/dwc3/core.c parms->hwparams4 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS4); dwc 537 drivers/usb/dwc3/core.c parms->hwparams5 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS5); dwc 538 drivers/usb/dwc3/core.c parms->hwparams6 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS6); dwc 539 drivers/usb/dwc3/core.c parms->hwparams7 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS7); dwc 540 drivers/usb/dwc3/core.c parms->hwparams8 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS8); dwc 543 drivers/usb/dwc3/core.c static int dwc3_core_ulpi_init(struct dwc3 *dwc) dwc 548 drivers/usb/dwc3/core.c intf = DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3); dwc 552 drivers/usb/dwc3/core.c dwc->hsphy_interface && dwc 553 drivers/usb/dwc3/core.c !strncmp(dwc->hsphy_interface, "ulpi", 4))) dwc 554 drivers/usb/dwc3/core.c ret = dwc3_ulpi_init(dwc); dwc 567 drivers/usb/dwc3/core.c static int dwc3_phy_setup(struct dwc3 *dwc) dwc 571 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0)); dwc 585 drivers/usb/dwc3/core.c if (dwc->revision > DWC3_REVISION_194A) dwc 588 drivers/usb/dwc3/core.c if (dwc->u2ss_inp3_quirk) dwc 591 drivers/usb/dwc3/core.c if (dwc->dis_rxdet_inp3_quirk) dwc 594 drivers/usb/dwc3/core.c if (dwc->req_p1p2p3_quirk) dwc 597 drivers/usb/dwc3/core.c if (dwc->del_p1p2p3_quirk) dwc 600 drivers/usb/dwc3/core.c if (dwc->del_phy_power_chg_quirk) dwc 603 drivers/usb/dwc3/core.c if (dwc->lfps_filter_quirk) dwc 606 drivers/usb/dwc3/core.c if (dwc->rx_detect_poll_quirk) dwc 609 drivers/usb/dwc3/core.c if (dwc->tx_de_emphasis_quirk) dwc 610 drivers/usb/dwc3/core.c reg |= DWC3_GUSB3PIPECTL_TX_DEEPH(dwc->tx_de_emphasis); dwc 612 drivers/usb/dwc3/core.c if (dwc->dis_u3_susphy_quirk) dwc 615 drivers/usb/dwc3/core.c if (dwc->dis_del_phy_power_chg_quirk) dwc 618 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg); dwc 620 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); dwc 623 drivers/usb/dwc3/core.c switch (DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3)) { dwc 625 drivers/usb/dwc3/core.c if (dwc->hsphy_interface && dwc 626 drivers/usb/dwc3/core.c !strncmp(dwc->hsphy_interface, "utmi", 4)) { dwc 629 drivers/usb/dwc3/core.c } else if (dwc->hsphy_interface && dwc 630 drivers/usb/dwc3/core.c !strncmp(dwc->hsphy_interface, "ulpi", 4)) { dwc 632 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); dwc 645 drivers/usb/dwc3/core.c switch (dwc->hsphy_mode) { dwc 668 drivers/usb/dwc3/core.c if (dwc->revision > DWC3_REVISION_194A) dwc 671 drivers/usb/dwc3/core.c if (dwc->dis_u2_susphy_quirk) dwc 674 drivers/usb/dwc3/core.c if (dwc->dis_enblslpm_quirk) dwc 679 drivers/usb/dwc3/core.c if (dwc->dis_u2_freeclk_exists_quirk) dwc 682 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); dwc 687 drivers/usb/dwc3/core.c static void dwc3_core_exit(struct dwc3 *dwc) dwc 689 drivers/usb/dwc3/core.c dwc3_event_buffers_cleanup(dwc); dwc 691 drivers/usb/dwc3/core.c usb_phy_shutdown(dwc->usb2_phy); dwc 692 drivers/usb/dwc3/core.c usb_phy_shutdown(dwc->usb3_phy); dwc 693 drivers/usb/dwc3/core.c phy_exit(dwc->usb2_generic_phy); dwc 694 drivers/usb/dwc3/core.c phy_exit(dwc->usb3_generic_phy); dwc 696 drivers/usb/dwc3/core.c usb_phy_set_suspend(dwc->usb2_phy, 1); dwc 697 drivers/usb/dwc3/core.c usb_phy_set_suspend(dwc->usb3_phy, 1); dwc 698 drivers/usb/dwc3/core.c phy_power_off(dwc->usb2_generic_phy); dwc 699 drivers/usb/dwc3/core.c phy_power_off(dwc->usb3_generic_phy); dwc 700 drivers/usb/dwc3/core.c clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks); dwc 701 drivers/usb/dwc3/core.c reset_control_assert(dwc->reset); dwc 704 drivers/usb/dwc3/core.c static bool dwc3_core_is_valid(struct dwc3 *dwc) dwc 708 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GSNPSID); dwc 713 drivers/usb/dwc3/core.c dwc->revision = reg; dwc 716 drivers/usb/dwc3/core.c dwc->revision = dwc3_readl(dwc->regs, DWC3_VER_NUMBER); dwc 717 drivers/usb/dwc3/core.c dwc->revision |= DWC3_REVISION_IS_DWC31; dwc 718 drivers/usb/dwc3/core.c dwc->version_type = dwc3_readl(dwc->regs, DWC3_VER_TYPE); dwc 726 drivers/usb/dwc3/core.c static void dwc3_core_setup_global_control(struct dwc3 *dwc) dwc 728 drivers/usb/dwc3/core.c u32 hwparams4 = dwc->hwparams.hwparams4; dwc 731 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GCTL); dwc 734 drivers/usb/dwc3/core.c switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1)) { dwc 748 drivers/usb/dwc3/core.c if ((dwc->dr_mode == USB_DR_MODE_HOST || dwc 749 drivers/usb/dwc3/core.c dwc->dr_mode == USB_DR_MODE_OTG) && dwc 750 drivers/usb/dwc3/core.c (dwc->revision >= DWC3_REVISION_210A && dwc 751 drivers/usb/dwc3/core.c dwc->revision <= DWC3_REVISION_250A)) dwc 758 drivers/usb/dwc3/core.c dwc->nr_scratch = DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(hwparams4); dwc 772 drivers/usb/dwc3/core.c if (dwc->hwparams.hwparams6 & DWC3_GHWPARAMS6_EN_FPGA) { dwc 773 drivers/usb/dwc3/core.c dev_info(dwc->dev, "Running with FPGA optimizations\n"); dwc 774 drivers/usb/dwc3/core.c dwc->is_fpga = true; dwc 777 drivers/usb/dwc3/core.c WARN_ONCE(dwc->disable_scramble_quirk && !dwc->is_fpga, dwc 780 drivers/usb/dwc3/core.c if (dwc->disable_scramble_quirk && dwc->is_fpga) dwc 785 drivers/usb/dwc3/core.c if (dwc->u2exit_lfps_quirk) dwc 794 drivers/usb/dwc3/core.c if (dwc->revision < DWC3_REVISION_190A) dwc 797 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GCTL, reg); dwc 800 drivers/usb/dwc3/core.c static int dwc3_core_get_phy(struct dwc3 *dwc); dwc 801 drivers/usb/dwc3/core.c static int dwc3_core_ulpi_init(struct dwc3 *dwc); dwc 804 drivers/usb/dwc3/core.c static void dwc3_set_incr_burst_type(struct dwc3 *dwc) dwc 806 drivers/usb/dwc3/core.c struct device *dev = dwc->dev; dwc 817 drivers/usb/dwc3/core.c cfg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0); dwc 894 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, cfg); dwc 903 drivers/usb/dwc3/core.c static int dwc3_core_init(struct dwc3 *dwc) dwc 912 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GUID, LINUX_VERSION_CODE); dwc 915 drivers/usb/dwc3/core.c if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) == dwc 917 drivers/usb/dwc3/core.c if (dwc->maximum_speed == USB_SPEED_SUPER) dwc 918 drivers/usb/dwc3/core.c dwc->maximum_speed = USB_SPEED_HIGH; dwc 921 drivers/usb/dwc3/core.c ret = dwc3_phy_setup(dwc); dwc 925 drivers/usb/dwc3/core.c if (!dwc->ulpi_ready) { dwc 926 drivers/usb/dwc3/core.c ret = dwc3_core_ulpi_init(dwc); dwc 929 drivers/usb/dwc3/core.c dwc->ulpi_ready = true; dwc 932 drivers/usb/dwc3/core.c if (!dwc->phys_ready) { dwc 933 drivers/usb/dwc3/core.c ret = dwc3_core_get_phy(dwc); dwc 936 drivers/usb/dwc3/core.c dwc->phys_ready = true; dwc 939 drivers/usb/dwc3/core.c ret = dwc3_core_soft_reset(dwc); dwc 943 drivers/usb/dwc3/core.c dwc3_core_setup_global_control(dwc); dwc 944 drivers/usb/dwc3/core.c dwc3_core_num_eps(dwc); dwc 946 drivers/usb/dwc3/core.c ret = dwc3_setup_scratch_buffers(dwc); dwc 951 drivers/usb/dwc3/core.c dwc3_frame_length_adjustment(dwc); dwc 953 drivers/usb/dwc3/core.c dwc3_set_incr_burst_type(dwc); dwc 955 drivers/usb/dwc3/core.c usb_phy_set_suspend(dwc->usb2_phy, 0); dwc 956 drivers/usb/dwc3/core.c usb_phy_set_suspend(dwc->usb3_phy, 0); dwc 957 drivers/usb/dwc3/core.c ret = phy_power_on(dwc->usb2_generic_phy); dwc 961 drivers/usb/dwc3/core.c ret = phy_power_on(dwc->usb3_generic_phy); dwc 965 drivers/usb/dwc3/core.c ret = dwc3_event_buffers_setup(dwc); dwc 967 drivers/usb/dwc3/core.c dev_err(dwc->dev, "failed to setup event buffers\n"); dwc 976 drivers/usb/dwc3/core.c if (!dwc3_is_usb31(dwc) && dwc->revision >= DWC3_REVISION_310A) { dwc 977 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GUCTL2); dwc 979 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GUCTL2, reg); dwc 982 drivers/usb/dwc3/core.c if (dwc->revision >= DWC3_REVISION_250A) { dwc 983 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GUCTL1); dwc 989 drivers/usb/dwc3/core.c if (dwc->revision >= DWC3_REVISION_290A) dwc 992 drivers/usb/dwc3/core.c if (dwc->dis_tx_ipgap_linecheck_quirk) dwc 995 drivers/usb/dwc3/core.c if (dwc->parkmode_disable_ss_quirk) dwc 998 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GUCTL1, reg); dwc 1001 drivers/usb/dwc3/core.c if (dwc->dr_mode == USB_DR_MODE_HOST || dwc 1002 drivers/usb/dwc3/core.c dwc->dr_mode == USB_DR_MODE_OTG) { dwc 1003 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GUCTL); dwc 1014 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GUCTL, reg); dwc 1021 drivers/usb/dwc3/core.c if (dwc3_is_usb31(dwc) && dwc->dr_mode == USB_DR_MODE_HOST) { dwc 1022 drivers/usb/dwc3/core.c u8 rx_thr_num = dwc->rx_thr_num_pkt_prd; dwc 1023 drivers/usb/dwc3/core.c u8 rx_maxburst = dwc->rx_max_burst_prd; dwc 1024 drivers/usb/dwc3/core.c u8 tx_thr_num = dwc->tx_thr_num_pkt_prd; dwc 1025 drivers/usb/dwc3/core.c u8 tx_maxburst = dwc->tx_max_burst_prd; dwc 1028 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GRXTHRCFG); dwc 1037 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GRXTHRCFG, reg); dwc 1041 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GTXTHRCFG); dwc 1050 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GTXTHRCFG, reg); dwc 1057 drivers/usb/dwc3/core.c phy_power_off(dwc->usb3_generic_phy); dwc 1060 drivers/usb/dwc3/core.c phy_power_off(dwc->usb2_generic_phy); dwc 1063 drivers/usb/dwc3/core.c usb_phy_set_suspend(dwc->usb2_phy, 1); dwc 1064 drivers/usb/dwc3/core.c usb_phy_set_suspend(dwc->usb3_phy, 1); dwc 1067 drivers/usb/dwc3/core.c usb_phy_shutdown(dwc->usb2_phy); dwc 1068 drivers/usb/dwc3/core.c usb_phy_shutdown(dwc->usb3_phy); dwc 1069 drivers/usb/dwc3/core.c phy_exit(dwc->usb2_generic_phy); dwc 1070 drivers/usb/dwc3/core.c phy_exit(dwc->usb3_generic_phy); dwc 1073 drivers/usb/dwc3/core.c dwc3_ulpi_exit(dwc); dwc 1079 drivers/usb/dwc3/core.c static int dwc3_core_get_phy(struct dwc3 *dwc) dwc 1081 drivers/usb/dwc3/core.c struct device *dev = dwc->dev; dwc 1086 drivers/usb/dwc3/core.c dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0); dwc 1087 drivers/usb/dwc3/core.c dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1); dwc 1089 drivers/usb/dwc3/core.c dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); dwc 1090 drivers/usb/dwc3/core.c dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3); dwc 1093 drivers/usb/dwc3/core.c if (IS_ERR(dwc->usb2_phy)) { dwc 1094 drivers/usb/dwc3/core.c ret = PTR_ERR(dwc->usb2_phy); dwc 1096 drivers/usb/dwc3/core.c dwc->usb2_phy = NULL; dwc 1105 drivers/usb/dwc3/core.c if (IS_ERR(dwc->usb3_phy)) { dwc 1106 drivers/usb/dwc3/core.c ret = PTR_ERR(dwc->usb3_phy); dwc 1108 drivers/usb/dwc3/core.c dwc->usb3_phy = NULL; dwc 1117 drivers/usb/dwc3/core.c dwc->usb2_generic_phy = devm_phy_get(dev, "usb2-phy"); dwc 1118 drivers/usb/dwc3/core.c if (IS_ERR(dwc->usb2_generic_phy)) { dwc 1119 drivers/usb/dwc3/core.c ret = PTR_ERR(dwc->usb2_generic_phy); dwc 1121 drivers/usb/dwc3/core.c dwc->usb2_generic_phy = NULL; dwc 1130 drivers/usb/dwc3/core.c dwc->usb3_generic_phy = devm_phy_get(dev, "usb3-phy"); dwc 1131 drivers/usb/dwc3/core.c if (IS_ERR(dwc->usb3_generic_phy)) { dwc 1132 drivers/usb/dwc3/core.c ret = PTR_ERR(dwc->usb3_generic_phy); dwc 1134 drivers/usb/dwc3/core.c dwc->usb3_generic_phy = NULL; dwc 1146 drivers/usb/dwc3/core.c static int dwc3_core_init_mode(struct dwc3 *dwc) dwc 1148 drivers/usb/dwc3/core.c struct device *dev = dwc->dev; dwc 1151 drivers/usb/dwc3/core.c switch (dwc->dr_mode) { dwc 1153 drivers/usb/dwc3/core.c dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); dwc 1155 drivers/usb/dwc3/core.c if (dwc->usb2_phy) dwc 1156 drivers/usb/dwc3/core.c otg_set_vbus(dwc->usb2_phy->otg, false); dwc 1157 drivers/usb/dwc3/core.c phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_DEVICE); dwc 1158 drivers/usb/dwc3/core.c phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_DEVICE); dwc 1160 drivers/usb/dwc3/core.c ret = dwc3_gadget_init(dwc); dwc 1168 drivers/usb/dwc3/core.c dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); dwc 1170 drivers/usb/dwc3/core.c if (dwc->usb2_phy) dwc 1171 drivers/usb/dwc3/core.c otg_set_vbus(dwc->usb2_phy->otg, true); dwc 1172 drivers/usb/dwc3/core.c phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST); dwc 1173 drivers/usb/dwc3/core.c phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_HOST); dwc 1175 drivers/usb/dwc3/core.c ret = dwc3_host_init(dwc); dwc 1183 drivers/usb/dwc3/core.c INIT_WORK(&dwc->drd_work, __dwc3_set_mode); dwc 1184 drivers/usb/dwc3/core.c ret = dwc3_drd_init(dwc); dwc 1192 drivers/usb/dwc3/core.c dev_err(dev, "Unsupported mode of operation %d\n", dwc->dr_mode); dwc 1199 drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) dwc 1201 drivers/usb/dwc3/core.c switch (dwc->dr_mode) { dwc 1203 drivers/usb/dwc3/core.c dwc3_gadget_exit(dwc); dwc 1206 drivers/usb/dwc3/core.c dwc3_host_exit(dwc); dwc 1209 drivers/usb/dwc3/core.c dwc3_drd_exit(dwc); dwc 1217 drivers/usb/dwc3/core.c dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); dwc 1220 drivers/usb/dwc3/core.c static void dwc3_get_properties(struct dwc3 *dwc) dwc 1222 drivers/usb/dwc3/core.c struct device *dev = dwc->dev; dwc 1243 drivers/usb/dwc3/core.c dwc->maximum_speed = usb_get_maximum_speed(dev); dwc 1244 drivers/usb/dwc3/core.c dwc->dr_mode = usb_get_dr_mode(dev); dwc 1245 drivers/usb/dwc3/core.c dwc->hsphy_mode = of_usb_get_phy_mode(dev->of_node); dwc 1247 drivers/usb/dwc3/core.c dwc->sysdev_is_parent = device_property_read_bool(dev, dwc 1249 drivers/usb/dwc3/core.c if (dwc->sysdev_is_parent) dwc 1250 drivers/usb/dwc3/core.c dwc->sysdev = dwc->dev->parent; dwc 1252 drivers/usb/dwc3/core.c dwc->sysdev = dwc->dev; dwc 1254 drivers/usb/dwc3/core.c dwc->has_lpm_erratum = device_property_read_bool(dev, dwc 1258 drivers/usb/dwc3/core.c dwc->is_utmi_l1_suspend = device_property_read_bool(dev, dwc 1262 drivers/usb/dwc3/core.c dwc->dis_start_transfer_quirk = device_property_read_bool(dev, dwc 1264 drivers/usb/dwc3/core.c dwc->usb3_lpm_capable = device_property_read_bool(dev, dwc 1266 drivers/usb/dwc3/core.c dwc->usb2_lpm_disable = device_property_read_bool(dev, dwc 1277 drivers/usb/dwc3/core.c dwc->disable_scramble_quirk = device_property_read_bool(dev, dwc 1279 drivers/usb/dwc3/core.c dwc->u2exit_lfps_quirk = device_property_read_bool(dev, dwc 1281 drivers/usb/dwc3/core.c dwc->u2ss_inp3_quirk = device_property_read_bool(dev, dwc 1283 drivers/usb/dwc3/core.c dwc->req_p1p2p3_quirk = device_property_read_bool(dev, dwc 1285 drivers/usb/dwc3/core.c dwc->del_p1p2p3_quirk = device_property_read_bool(dev, dwc 1287 drivers/usb/dwc3/core.c dwc->del_phy_power_chg_quirk = device_property_read_bool(dev, dwc 1289 drivers/usb/dwc3/core.c dwc->lfps_filter_quirk = device_property_read_bool(dev, dwc 1291 drivers/usb/dwc3/core.c dwc->rx_detect_poll_quirk = device_property_read_bool(dev, dwc 1293 drivers/usb/dwc3/core.c dwc->dis_u3_susphy_quirk = device_property_read_bool(dev, dwc 1295 drivers/usb/dwc3/core.c dwc->dis_u2_susphy_quirk = device_property_read_bool(dev, dwc 1297 drivers/usb/dwc3/core.c dwc->dis_enblslpm_quirk = device_property_read_bool(dev, dwc 1299 drivers/usb/dwc3/core.c dwc->dis_u1_entry_quirk = device_property_read_bool(dev, dwc 1301 drivers/usb/dwc3/core.c dwc->dis_u2_entry_quirk = device_property_read_bool(dev, dwc 1303 drivers/usb/dwc3/core.c dwc->dis_rxdet_inp3_quirk = device_property_read_bool(dev, dwc 1305 drivers/usb/dwc3/core.c dwc->dis_u2_freeclk_exists_quirk = device_property_read_bool(dev, dwc 1307 drivers/usb/dwc3/core.c dwc->dis_del_phy_power_chg_quirk = device_property_read_bool(dev, dwc 1309 drivers/usb/dwc3/core.c dwc->dis_tx_ipgap_linecheck_quirk = device_property_read_bool(dev, dwc 1311 drivers/usb/dwc3/core.c dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev, dwc 1314 drivers/usb/dwc3/core.c dwc->tx_de_emphasis_quirk = device_property_read_bool(dev, dwc 1319 drivers/usb/dwc3/core.c &dwc->hsphy_interface); dwc 1321 drivers/usb/dwc3/core.c &dwc->fladj); dwc 1323 drivers/usb/dwc3/core.c dwc->dis_metastability_quirk = device_property_read_bool(dev, dwc 1326 drivers/usb/dwc3/core.c dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc 1327 drivers/usb/dwc3/core.c dwc->tx_de_emphasis = tx_de_emphasis; dwc 1329 drivers/usb/dwc3/core.c dwc->hird_threshold = hird_threshold; dwc 1331 drivers/usb/dwc3/core.c dwc->rx_thr_num_pkt_prd = rx_thr_num_pkt_prd; dwc 1332 drivers/usb/dwc3/core.c dwc->rx_max_burst_prd = rx_max_burst_prd; dwc 1334 drivers/usb/dwc3/core.c dwc->tx_thr_num_pkt_prd = tx_thr_num_pkt_prd; dwc 1335 drivers/usb/dwc3/core.c dwc->tx_max_burst_prd = tx_max_burst_prd; dwc 1337 drivers/usb/dwc3/core.c dwc->imod_interval = 0; dwc 1341 drivers/usb/dwc3/core.c bool dwc3_has_imod(struct dwc3 *dwc) dwc 1343 drivers/usb/dwc3/core.c return ((dwc3_is_usb3(dwc) && dwc 1344 drivers/usb/dwc3/core.c dwc->revision >= DWC3_REVISION_300A) || dwc 1345 drivers/usb/dwc3/core.c (dwc3_is_usb31(dwc) && dwc 1346 drivers/usb/dwc3/core.c dwc->revision >= DWC3_USB31_REVISION_120A)); dwc 1349 drivers/usb/dwc3/core.c static void dwc3_check_params(struct dwc3 *dwc) dwc 1351 drivers/usb/dwc3/core.c struct device *dev = dwc->dev; dwc 1354 drivers/usb/dwc3/core.c if (dwc->imod_interval && !dwc3_has_imod(dwc)) { dwc 1355 drivers/usb/dwc3/core.c dev_warn(dwc->dev, "Interrupt moderation not supported\n"); dwc 1356 drivers/usb/dwc3/core.c dwc->imod_interval = 0; dwc 1366 drivers/usb/dwc3/core.c if (!dwc->imod_interval && dwc 1367 drivers/usb/dwc3/core.c (dwc->revision == DWC3_REVISION_300A)) dwc 1368 drivers/usb/dwc3/core.c dwc->imod_interval = 1; dwc 1371 drivers/usb/dwc3/core.c switch (dwc->maximum_speed) { dwc 1380 drivers/usb/dwc3/core.c dwc->maximum_speed); dwc 1384 drivers/usb/dwc3/core.c dwc->maximum_speed = USB_SPEED_SUPER; dwc 1389 drivers/usb/dwc3/core.c if (dwc3_is_usb31(dwc) && dwc 1390 drivers/usb/dwc3/core.c (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) == dwc 1392 drivers/usb/dwc3/core.c dwc->maximum_speed = USB_SPEED_SUPER_PLUS; dwc 1402 drivers/usb/dwc3/core.c struct dwc3 *dwc; dwc 1408 drivers/usb/dwc3/core.c dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL); dwc 1409 drivers/usb/dwc3/core.c if (!dwc) dwc 1412 drivers/usb/dwc3/core.c dwc->clks = devm_kmemdup(dev, dwc3_core_clks, sizeof(dwc3_core_clks), dwc 1414 drivers/usb/dwc3/core.c if (!dwc->clks) dwc 1417 drivers/usb/dwc3/core.c dwc->dev = dev; dwc 1425 drivers/usb/dwc3/core.c dwc->xhci_resources[0].start = res->start; dwc 1426 drivers/usb/dwc3/core.c dwc->xhci_resources[0].end = dwc->xhci_resources[0].start + dwc 1428 drivers/usb/dwc3/core.c dwc->xhci_resources[0].flags = res->flags; dwc 1429 drivers/usb/dwc3/core.c dwc->xhci_resources[0].name = res->name; dwc 1442 drivers/usb/dwc3/core.c dwc->regs = regs; dwc 1443 drivers/usb/dwc3/core.c dwc->regs_size = resource_size(&dwc_res); dwc 1445 drivers/usb/dwc3/core.c dwc3_get_properties(dwc); dwc 1447 drivers/usb/dwc3/core.c dwc->reset = devm_reset_control_get_optional_shared(dev, NULL); dwc 1448 drivers/usb/dwc3/core.c if (IS_ERR(dwc->reset)) dwc 1449 drivers/usb/dwc3/core.c return PTR_ERR(dwc->reset); dwc 1452 drivers/usb/dwc3/core.c dwc->num_clks = ARRAY_SIZE(dwc3_core_clks); dwc 1454 drivers/usb/dwc3/core.c ret = devm_clk_bulk_get(dev, dwc->num_clks, dwc->clks); dwc 1462 drivers/usb/dwc3/core.c dwc->num_clks = 0; dwc 1465 drivers/usb/dwc3/core.c ret = reset_control_deassert(dwc->reset); dwc 1469 drivers/usb/dwc3/core.c ret = clk_bulk_prepare_enable(dwc->num_clks, dwc->clks); dwc 1473 drivers/usb/dwc3/core.c if (!dwc3_core_is_valid(dwc)) { dwc 1474 drivers/usb/dwc3/core.c dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n"); dwc 1479 drivers/usb/dwc3/core.c platform_set_drvdata(pdev, dwc); dwc 1480 drivers/usb/dwc3/core.c dwc3_cache_hwparams(dwc); dwc 1482 drivers/usb/dwc3/core.c spin_lock_init(&dwc->lock); dwc 1494 drivers/usb/dwc3/core.c ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE); dwc 1496 drivers/usb/dwc3/core.c dev_err(dwc->dev, "failed to allocate event buffers\n"); dwc 1501 drivers/usb/dwc3/core.c ret = dwc3_get_dr_mode(dwc); dwc 1505 drivers/usb/dwc3/core.c ret = dwc3_alloc_scratch_buffers(dwc); dwc 1509 drivers/usb/dwc3/core.c ret = dwc3_core_init(dwc); dwc 1516 drivers/usb/dwc3/core.c dwc3_check_params(dwc); dwc 1518 drivers/usb/dwc3/core.c ret = dwc3_core_init_mode(dwc); dwc 1522 drivers/usb/dwc3/core.c dwc3_debugfs_init(dwc); dwc 1528 drivers/usb/dwc3/core.c dwc3_event_buffers_cleanup(dwc); dwc 1529 drivers/usb/dwc3/core.c dwc3_ulpi_exit(dwc); dwc 1532 drivers/usb/dwc3/core.c dwc3_free_scratch_buffers(dwc); dwc 1535 drivers/usb/dwc3/core.c dwc3_free_event_buffers(dwc); dwc 1545 drivers/usb/dwc3/core.c clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks); dwc 1547 drivers/usb/dwc3/core.c reset_control_assert(dwc->reset); dwc 1554 drivers/usb/dwc3/core.c struct dwc3 *dwc = platform_get_drvdata(pdev); dwc 1558 drivers/usb/dwc3/core.c dwc3_debugfs_exit(dwc); dwc 1559 drivers/usb/dwc3/core.c dwc3_core_exit_mode(dwc); dwc 1561 drivers/usb/dwc3/core.c dwc3_core_exit(dwc); dwc 1562 drivers/usb/dwc3/core.c dwc3_ulpi_exit(dwc); dwc 1568 drivers/usb/dwc3/core.c dwc3_free_event_buffers(dwc); dwc 1569 drivers/usb/dwc3/core.c dwc3_free_scratch_buffers(dwc); dwc 1575 drivers/usb/dwc3/core.c static int dwc3_core_init_for_resume(struct dwc3 *dwc) dwc 1579 drivers/usb/dwc3/core.c ret = reset_control_deassert(dwc->reset); dwc 1583 drivers/usb/dwc3/core.c ret = clk_bulk_prepare_enable(dwc->num_clks, dwc->clks); dwc 1587 drivers/usb/dwc3/core.c ret = dwc3_core_init(dwc); dwc 1594 drivers/usb/dwc3/core.c clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks); dwc 1596 drivers/usb/dwc3/core.c reset_control_assert(dwc->reset); dwc 1601 drivers/usb/dwc3/core.c static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) dwc 1606 drivers/usb/dwc3/core.c switch (dwc->current_dr_role) { dwc 1608 drivers/usb/dwc3/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 1609 drivers/usb/dwc3/core.c dwc3_gadget_suspend(dwc); dwc 1610 drivers/usb/dwc3/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1611 drivers/usb/dwc3/core.c synchronize_irq(dwc->irq_gadget); dwc 1612 drivers/usb/dwc3/core.c dwc3_core_exit(dwc); dwc 1616 drivers/usb/dwc3/core.c dwc3_core_exit(dwc); dwc 1621 drivers/usb/dwc3/core.c if (dwc->dis_u2_susphy_quirk || dwc 1622 drivers/usb/dwc3/core.c dwc->dis_enblslpm_quirk) { dwc 1623 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); dwc 1626 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); dwc 1632 drivers/usb/dwc3/core.c phy_pm_runtime_put_sync(dwc->usb2_generic_phy); dwc 1633 drivers/usb/dwc3/core.c phy_pm_runtime_put_sync(dwc->usb3_generic_phy); dwc 1640 drivers/usb/dwc3/core.c if (dwc->current_otg_role == DWC3_OTG_ROLE_DEVICE) { dwc 1641 drivers/usb/dwc3/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 1642 drivers/usb/dwc3/core.c dwc3_gadget_suspend(dwc); dwc 1643 drivers/usb/dwc3/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1644 drivers/usb/dwc3/core.c synchronize_irq(dwc->irq_gadget); dwc 1647 drivers/usb/dwc3/core.c dwc3_otg_exit(dwc); dwc 1648 drivers/usb/dwc3/core.c dwc3_core_exit(dwc); dwc 1658 drivers/usb/dwc3/core.c static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg) dwc 1664 drivers/usb/dwc3/core.c switch (dwc->current_dr_role) { dwc 1666 drivers/usb/dwc3/core.c ret = dwc3_core_init_for_resume(dwc); dwc 1670 drivers/usb/dwc3/core.c dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); dwc 1671 drivers/usb/dwc3/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 1672 drivers/usb/dwc3/core.c dwc3_gadget_resume(dwc); dwc 1673 drivers/usb/dwc3/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1677 drivers/usb/dwc3/core.c ret = dwc3_core_init_for_resume(dwc); dwc 1680 drivers/usb/dwc3/core.c dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); dwc 1684 drivers/usb/dwc3/core.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); dwc 1685 drivers/usb/dwc3/core.c if (dwc->dis_u2_susphy_quirk) dwc 1688 drivers/usb/dwc3/core.c if (dwc->dis_enblslpm_quirk) dwc 1691 drivers/usb/dwc3/core.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); dwc 1693 drivers/usb/dwc3/core.c phy_pm_runtime_get_sync(dwc->usb2_generic_phy); dwc 1694 drivers/usb/dwc3/core.c phy_pm_runtime_get_sync(dwc->usb3_generic_phy); dwc 1701 drivers/usb/dwc3/core.c ret = dwc3_core_init(dwc); dwc 1705 drivers/usb/dwc3/core.c dwc3_set_prtcap(dwc, dwc->current_dr_role); dwc 1707 drivers/usb/dwc3/core.c dwc3_otg_init(dwc); dwc 1708 drivers/usb/dwc3/core.c if (dwc->current_otg_role == DWC3_OTG_ROLE_HOST) { dwc 1709 drivers/usb/dwc3/core.c dwc3_otg_host_init(dwc); dwc 1710 drivers/usb/dwc3/core.c } else if (dwc->current_otg_role == DWC3_OTG_ROLE_DEVICE) { dwc 1711 drivers/usb/dwc3/core.c spin_lock_irqsave(&dwc->lock, flags); dwc 1712 drivers/usb/dwc3/core.c dwc3_gadget_resume(dwc); dwc 1713 drivers/usb/dwc3/core.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1725 drivers/usb/dwc3/core.c static int dwc3_runtime_checks(struct dwc3 *dwc) dwc 1727 drivers/usb/dwc3/core.c switch (dwc->current_dr_role) { dwc 1729 drivers/usb/dwc3/core.c if (dwc->connected) dwc 1743 drivers/usb/dwc3/core.c struct dwc3 *dwc = dev_get_drvdata(dev); dwc 1746 drivers/usb/dwc3/core.c if (dwc3_runtime_checks(dwc)) dwc 1749 drivers/usb/dwc3/core.c ret = dwc3_suspend_common(dwc, PMSG_AUTO_SUSPEND); dwc 1760 drivers/usb/dwc3/core.c struct dwc3 *dwc = dev_get_drvdata(dev); dwc 1765 drivers/usb/dwc3/core.c ret = dwc3_resume_common(dwc, PMSG_AUTO_RESUME); dwc 1769 drivers/usb/dwc3/core.c switch (dwc->current_dr_role) { dwc 1771 drivers/usb/dwc3/core.c dwc3_gadget_process_pending_events(dwc); dwc 1786 drivers/usb/dwc3/core.c struct dwc3 *dwc = dev_get_drvdata(dev); dwc 1788 drivers/usb/dwc3/core.c switch (dwc->current_dr_role) { dwc 1790 drivers/usb/dwc3/core.c if (dwc3_runtime_checks(dwc)) dwc 1809 drivers/usb/dwc3/core.c struct dwc3 *dwc = dev_get_drvdata(dev); dwc 1812 drivers/usb/dwc3/core.c ret = dwc3_suspend_common(dwc, PMSG_SUSPEND); dwc 1823 drivers/usb/dwc3/core.c struct dwc3 *dwc = dev_get_drvdata(dev); dwc 1828 drivers/usb/dwc3/core.c ret = dwc3_resume_common(dwc, PMSG_RESUME); dwc 640 drivers/usb/dwc3/core.h struct dwc3 *dwc; dwc 688 drivers/usb/dwc3/core.h struct dwc3 *dwc; dwc 1393 drivers/usb/dwc3/core.h void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode); dwc 1394 drivers/usb/dwc3/core.h void dwc3_set_mode(struct dwc3 *dwc, u32 mode); dwc 1398 drivers/usb/dwc3/core.h static inline bool dwc3_is_usb3(struct dwc3 *dwc) dwc 1400 drivers/usb/dwc3/core.h return !(dwc->revision & DWC3_REVISION_IS_DWC31); dwc 1404 drivers/usb/dwc3/core.h static inline bool dwc3_is_usb31(struct dwc3 *dwc) dwc 1406 drivers/usb/dwc3/core.h return !!(dwc->revision & DWC3_REVISION_IS_DWC31); dwc 1409 drivers/usb/dwc3/core.h bool dwc3_has_imod(struct dwc3 *dwc); dwc 1411 drivers/usb/dwc3/core.h int dwc3_event_buffers_setup(struct dwc3 *dwc); dwc 1412 drivers/usb/dwc3/core.h void dwc3_event_buffers_cleanup(struct dwc3 *dwc); dwc 1415 drivers/usb/dwc3/core.h int dwc3_host_init(struct dwc3 *dwc); dwc 1416 drivers/usb/dwc3/core.h void dwc3_host_exit(struct dwc3 *dwc); dwc 1418 drivers/usb/dwc3/core.h static inline int dwc3_host_init(struct dwc3 *dwc) dwc 1420 drivers/usb/dwc3/core.h static inline void dwc3_host_exit(struct dwc3 *dwc) dwc 1425 drivers/usb/dwc3/core.h int dwc3_gadget_init(struct dwc3 *dwc); dwc 1426 drivers/usb/dwc3/core.h void dwc3_gadget_exit(struct dwc3 *dwc); dwc 1427 drivers/usb/dwc3/core.h int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode); dwc 1428 drivers/usb/dwc3/core.h int dwc3_gadget_get_link_state(struct dwc3 *dwc); dwc 1429 drivers/usb/dwc3/core.h int dwc3_gadget_set_link_state(struct dwc3 *dwc, enum dwc3_link_state state); dwc 1432 drivers/usb/dwc3/core.h int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, u32 param); dwc 1434 drivers/usb/dwc3/core.h static inline int dwc3_gadget_init(struct dwc3 *dwc) dwc 1436 drivers/usb/dwc3/core.h static inline void dwc3_gadget_exit(struct dwc3 *dwc) dwc 1438 drivers/usb/dwc3/core.h static inline int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode) dwc 1440 drivers/usb/dwc3/core.h static inline int dwc3_gadget_get_link_state(struct dwc3 *dwc) dwc 1442 drivers/usb/dwc3/core.h static inline int dwc3_gadget_set_link_state(struct dwc3 *dwc, dwc 1449 drivers/usb/dwc3/core.h static inline int dwc3_send_gadget_generic_command(struct dwc3 *dwc, dwc 1455 drivers/usb/dwc3/core.h int dwc3_drd_init(struct dwc3 *dwc); dwc 1456 drivers/usb/dwc3/core.h void dwc3_drd_exit(struct dwc3 *dwc); dwc 1457 drivers/usb/dwc3/core.h void dwc3_otg_init(struct dwc3 *dwc); dwc 1458 drivers/usb/dwc3/core.h void dwc3_otg_exit(struct dwc3 *dwc); dwc 1459 drivers/usb/dwc3/core.h void dwc3_otg_update(struct dwc3 *dwc, bool ignore_idstatus); dwc 1460 drivers/usb/dwc3/core.h void dwc3_otg_host_init(struct dwc3 *dwc); dwc 1462 drivers/usb/dwc3/core.h static inline int dwc3_drd_init(struct dwc3 *dwc) dwc 1464 drivers/usb/dwc3/core.h static inline void dwc3_drd_exit(struct dwc3 *dwc) dwc 1466 drivers/usb/dwc3/core.h static inline void dwc3_otg_init(struct dwc3 *dwc) dwc 1468 drivers/usb/dwc3/core.h static inline void dwc3_otg_exit(struct dwc3 *dwc) dwc 1470 drivers/usb/dwc3/core.h static inline void dwc3_otg_update(struct dwc3 *dwc, bool ignore_idstatus) dwc 1472 drivers/usb/dwc3/core.h static inline void dwc3_otg_host_init(struct dwc3 *dwc) dwc 1478 drivers/usb/dwc3/core.h int dwc3_gadget_suspend(struct dwc3 *dwc); dwc 1479 drivers/usb/dwc3/core.h int dwc3_gadget_resume(struct dwc3 *dwc); dwc 1480 drivers/usb/dwc3/core.h void dwc3_gadget_process_pending_events(struct dwc3 *dwc); dwc 1482 drivers/usb/dwc3/core.h static inline int dwc3_gadget_suspend(struct dwc3 *dwc) dwc 1487 drivers/usb/dwc3/core.h static inline int dwc3_gadget_resume(struct dwc3 *dwc) dwc 1492 drivers/usb/dwc3/core.h static inline void dwc3_gadget_process_pending_events(struct dwc3 *dwc) dwc 1498 drivers/usb/dwc3/core.h int dwc3_ulpi_init(struct dwc3 *dwc); dwc 1499 drivers/usb/dwc3/core.h void dwc3_ulpi_exit(struct dwc3 *dwc); dwc 1501 drivers/usb/dwc3/core.h static inline int dwc3_ulpi_init(struct dwc3 *dwc) dwc 1503 drivers/usb/dwc3/core.h static inline void dwc3_ulpi_exit(struct dwc3 *dwc) dwc 282 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = s->private; dwc 288 drivers/usb/dwc3/debugfs.c dbc_enabled = !!(dwc->hwparams.hwparams1 & DWC3_GHWPARAMS1_ENDBC); dwc 290 drivers/usb/dwc3/debugfs.c sel = dwc->dbg_lsp_select; dwc 298 drivers/usb/dwc3/debugfs.c dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg); dwc 299 drivers/usb/dwc3/debugfs.c val = dwc3_readl(dwc->regs, DWC3_GDBGLSP); dwc 304 drivers/usb/dwc3/debugfs.c dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg); dwc 305 drivers/usb/dwc3/debugfs.c val = dwc3_readl(dwc->regs, DWC3_GDBGLSP); dwc 312 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = s->private; dwc 318 drivers/usb/dwc3/debugfs.c dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg); dwc 319 drivers/usb/dwc3/debugfs.c reg = dwc3_readl(dwc->regs, DWC3_GDBGLSP); dwc 326 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = s->private; dwc 331 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 332 drivers/usb/dwc3/debugfs.c reg = dwc3_readl(dwc->regs, DWC3_GSTS); dwc 346 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 360 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = s->private; dwc 373 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 374 drivers/usb/dwc3/debugfs.c dwc->dbg_lsp_select = sel; dwc 375 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 390 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = s->private; dwc 394 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 395 drivers/usb/dwc3/debugfs.c reg = dwc3_readl(dwc->regs, DWC3_GCTL); dwc 396 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 424 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = s->private; dwc 440 drivers/usb/dwc3/debugfs.c dwc3_set_mode(dwc, mode); dwc 455 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = s->private; dwc 459 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 460 drivers/usb/dwc3/debugfs.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 463 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 500 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = s->private; dwc 521 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 522 drivers/usb/dwc3/debugfs.c dwc3_gadget_set_test_mode(dwc, testmode); dwc 523 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 538 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = s->private; dwc 544 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 545 drivers/usb/dwc3/debugfs.c reg = dwc3_readl(dwc->regs, DWC3_GSTS); dwc 548 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 552 drivers/usb/dwc3/debugfs.c reg = dwc3_readl(dwc->regs, DWC3_DSTS); dwc 559 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 573 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = s->private; dwc 598 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 599 drivers/usb/dwc3/debugfs.c reg = dwc3_readl(dwc->regs, DWC3_GSTS); dwc 601 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 605 drivers/usb/dwc3/debugfs.c reg = dwc3_readl(dwc->regs, DWC3_DSTS); dwc 610 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 614 drivers/usb/dwc3/debugfs.c dwc3_gadget_set_link_state(dwc, state); dwc 615 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 636 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = dep->dwc; dwc 640 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 644 drivers/usb/dwc3/debugfs.c val *= DWC3_MDWIDTH(dwc->hwparams.hwparams0); dwc 647 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 655 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = dep->dwc; dwc 659 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 663 drivers/usb/dwc3/debugfs.c val *= DWC3_MDWIDTH(dwc->hwparams.hwparams0); dwc 666 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 674 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = dep->dwc; dwc 678 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 681 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 689 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = dep->dwc; dwc 693 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 696 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 704 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = dep->dwc; dwc 708 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 711 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 719 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = dep->dwc; dwc 723 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 726 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 734 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = dep->dwc; dwc 738 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 741 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 749 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = dep->dwc; dwc 752 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 777 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 785 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = dep->dwc; dwc 789 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 815 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 823 drivers/usb/dwc3/debugfs.c struct dwc3 *dwc = dep->dwc; dwc 830 drivers/usb/dwc3/debugfs.c spin_lock_irqsave(&dwc->lock, flags); dwc 832 drivers/usb/dwc3/debugfs.c dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg); dwc 834 drivers/usb/dwc3/debugfs.c lower_32_bits = dwc3_readl(dwc->regs, DWC3_GDBGEPINFO0); dwc 835 drivers/usb/dwc3/debugfs.c upper_32_bits = dwc3_readl(dwc->regs, DWC3_GDBGEPINFO1); dwc 839 drivers/usb/dwc3/debugfs.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 890 drivers/usb/dwc3/debugfs.c static void dwc3_debugfs_create_endpoint_dirs(struct dwc3 *dwc, dwc 895 drivers/usb/dwc3/debugfs.c for (i = 0; i < dwc->num_eps; i++) { dwc 896 drivers/usb/dwc3/debugfs.c struct dwc3_ep *dep = dwc->eps[i]; dwc 905 drivers/usb/dwc3/debugfs.c void dwc3_debugfs_init(struct dwc3 *dwc) dwc 909 drivers/usb/dwc3/debugfs.c dwc->regset = kzalloc(sizeof(*dwc->regset), GFP_KERNEL); dwc 910 drivers/usb/dwc3/debugfs.c if (!dwc->regset) dwc 913 drivers/usb/dwc3/debugfs.c dwc->dbg_lsp_select = DWC3_LSP_MUX_UNSELECTED; dwc 915 drivers/usb/dwc3/debugfs.c dwc->regset->regs = dwc3_regs; dwc 916 drivers/usb/dwc3/debugfs.c dwc->regset->nregs = ARRAY_SIZE(dwc3_regs); dwc 917 drivers/usb/dwc3/debugfs.c dwc->regset->base = dwc->regs - DWC3_GLOBALS_REGS_START; dwc 919 drivers/usb/dwc3/debugfs.c root = debugfs_create_dir(dev_name(dwc->dev), NULL); dwc 920 drivers/usb/dwc3/debugfs.c dwc->root = root; dwc 922 drivers/usb/dwc3/debugfs.c debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); dwc 924 drivers/usb/dwc3/debugfs.c debugfs_create_file("lsp_dump", S_IRUGO | S_IWUSR, root, dwc, dwc 928 drivers/usb/dwc3/debugfs.c debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, dwc, dwc 934 drivers/usb/dwc3/debugfs.c debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, dwc, dwc 936 drivers/usb/dwc3/debugfs.c debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, dwc, dwc 938 drivers/usb/dwc3/debugfs.c dwc3_debugfs_create_endpoint_dirs(dwc, root); dwc 942 drivers/usb/dwc3/debugfs.c void dwc3_debugfs_exit(struct dwc3 *dwc) dwc 944 drivers/usb/dwc3/debugfs.c debugfs_remove_recursive(dwc->root); dwc 945 drivers/usb/dwc3/debugfs.c kfree(dwc->regset); dwc 19 drivers/usb/dwc3/drd.c static void dwc3_otg_disable_events(struct dwc3 *dwc, u32 disable_mask) dwc 21 drivers/usb/dwc3/drd.c u32 reg = dwc3_readl(dwc->regs, DWC3_OEVTEN); dwc 24 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OEVTEN, reg); dwc 27 drivers/usb/dwc3/drd.c static void dwc3_otg_enable_events(struct dwc3 *dwc, u32 enable_mask) dwc 29 drivers/usb/dwc3/drd.c u32 reg = dwc3_readl(dwc->regs, DWC3_OEVTEN); dwc 32 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OEVTEN, reg); dwc 35 drivers/usb/dwc3/drd.c static void dwc3_otg_clear_events(struct dwc3 *dwc) dwc 37 drivers/usb/dwc3/drd.c u32 reg = dwc3_readl(dwc->regs, DWC3_OEVT); dwc 39 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OEVTEN, reg); dwc 54 drivers/usb/dwc3/drd.c struct dwc3 *dwc = _dwc; dwc 56 drivers/usb/dwc3/drd.c spin_lock(&dwc->lock); dwc 57 drivers/usb/dwc3/drd.c if (dwc->otg_restart_host) { dwc 58 drivers/usb/dwc3/drd.c dwc3_otg_host_init(dwc); dwc 59 drivers/usb/dwc3/drd.c dwc->otg_restart_host = 0; dwc 62 drivers/usb/dwc3/drd.c spin_unlock(&dwc->lock); dwc 64 drivers/usb/dwc3/drd.c dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); dwc 72 drivers/usb/dwc3/drd.c struct dwc3 *dwc = _dwc; dwc 75 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OEVT); dwc 79 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OEVT, reg); dwc 83 drivers/usb/dwc3/drd.c if (dwc->current_otg_role == DWC3_OTG_ROLE_HOST && dwc 85 drivers/usb/dwc3/drd.c dwc->otg_restart_host = 1; dwc 86 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OEVT, reg); dwc 93 drivers/usb/dwc3/drd.c static void dwc3_otgregs_init(struct dwc3 *dwc) dwc 103 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OCFG); dwc 105 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OCFG, reg); dwc 108 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_GCTL); dwc 110 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_GCTL, reg); dwc 117 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OCFG); dwc 119 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OCFG, reg); dwc 121 drivers/usb/dwc3/drd.c dwc3_otg_clear_events(dwc); dwc 123 drivers/usb/dwc3/drd.c dwc3_otg_disable_events(dwc, DWC3_OTG_ALL_EVENTS); dwc 125 drivers/usb/dwc3/drd.c dwc3_otg_enable_events(dwc, DWC3_OTG_ALL_EVENTS); dwc 130 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OCTL); dwc 134 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OCTL, reg); dwc 137 drivers/usb/dwc3/drd.c static int dwc3_otg_get_irq(struct dwc3 *dwc) dwc 139 drivers/usb/dwc3/drd.c struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); dwc 167 drivers/usb/dwc3/drd.c void dwc3_otg_init(struct dwc3 *dwc) dwc 176 drivers/usb/dwc3/drd.c dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG); dwc 178 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); dwc 180 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); dwc 183 drivers/usb/dwc3/drd.c dwc3_otgregs_init(dwc); dwc 186 drivers/usb/dwc3/drd.c void dwc3_otg_exit(struct dwc3 *dwc) dwc 189 drivers/usb/dwc3/drd.c dwc3_otg_disable_events(dwc, DWC3_OTG_ALL_EVENTS); dwc 191 drivers/usb/dwc3/drd.c dwc3_otg_clear_events(dwc); dwc 195 drivers/usb/dwc3/drd.c void dwc3_otg_host_init(struct dwc3 *dwc) dwc 206 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OCTL); dwc 209 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OCTL, reg); dwc 214 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OCFG); dwc 216 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OCFG, reg); dwc 231 drivers/usb/dwc3/drd.c if (!dwc->dis_u2_susphy_quirk) { dwc 232 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); dwc 234 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); dwc 238 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OCTL); dwc 240 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OCTL, reg); dwc 244 drivers/usb/dwc3/drd.c static void dwc3_otg_host_exit(struct dwc3 *dwc) dwc 261 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OCTL); dwc 263 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OCTL, reg); dwc 267 drivers/usb/dwc3/drd.c static void dwc3_otg_device_init(struct dwc3 *dwc) dwc 277 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OCFG); dwc 280 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OCFG, reg); dwc 286 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OCTL); dwc 290 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OCTL, reg); dwc 292 drivers/usb/dwc3/drd.c dwc3_otg_enable_events(dwc, DWC3_OEVTEN_BDEVSESSVLDDETEN); dwc 294 drivers/usb/dwc3/drd.c if (!dwc->dis_u2_susphy_quirk) { dwc 295 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); dwc 297 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); dwc 303 drivers/usb/dwc3/drd.c static void dwc3_otg_device_exit(struct dwc3 *dwc) dwc 317 drivers/usb/dwc3/drd.c dwc3_otg_disable_events(dwc, DWC3_OEVTEN_BDEVHNPCHNGEN | dwc 322 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OCTL); dwc 325 drivers/usb/dwc3/drd.c dwc3_writel(dwc->regs, DWC3_OCTL, reg); dwc 328 drivers/usb/dwc3/drd.c void dwc3_otg_update(struct dwc3 *dwc, bool ignore_idstatus) dwc 335 drivers/usb/dwc3/drd.c if (dwc->dr_mode != USB_DR_MODE_OTG) dwc 339 drivers/usb/dwc3/drd.c if (dwc->current_dr_role != DWC3_GCTL_PRTCAP_OTG) dwc 343 drivers/usb/dwc3/drd.c reg = dwc3_readl(dwc->regs, DWC3_OSTS); dwc 346 drivers/usb/dwc3/drd.c dwc->desired_otg_role = id ? DWC3_OTG_ROLE_DEVICE : dwc 350 drivers/usb/dwc3/drd.c if (dwc->desired_otg_role == dwc->current_otg_role) dwc 353 drivers/usb/dwc3/drd.c switch (dwc->current_otg_role) { dwc 355 drivers/usb/dwc3/drd.c dwc3_host_exit(dwc); dwc 356 drivers/usb/dwc3/drd.c spin_lock_irqsave(&dwc->lock, flags); dwc 357 drivers/usb/dwc3/drd.c dwc3_otg_host_exit(dwc); dwc 358 drivers/usb/dwc3/drd.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 361 drivers/usb/dwc3/drd.c dwc3_gadget_exit(dwc); dwc 362 drivers/usb/dwc3/drd.c spin_lock_irqsave(&dwc->lock, flags); dwc 363 drivers/usb/dwc3/drd.c dwc3_event_buffers_cleanup(dwc); dwc 364 drivers/usb/dwc3/drd.c dwc3_otg_device_exit(dwc); dwc 365 drivers/usb/dwc3/drd.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 371 drivers/usb/dwc3/drd.c spin_lock_irqsave(&dwc->lock, flags); dwc 373 drivers/usb/dwc3/drd.c dwc->current_otg_role = dwc->desired_otg_role; dwc 375 drivers/usb/dwc3/drd.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 377 drivers/usb/dwc3/drd.c switch (dwc->desired_otg_role) { dwc 379 drivers/usb/dwc3/drd.c spin_lock_irqsave(&dwc->lock, flags); dwc 380 drivers/usb/dwc3/drd.c dwc3_otgregs_init(dwc); dwc 381 drivers/usb/dwc3/drd.c dwc3_otg_host_init(dwc); dwc 382 drivers/usb/dwc3/drd.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 383 drivers/usb/dwc3/drd.c ret = dwc3_host_init(dwc); dwc 385 drivers/usb/dwc3/drd.c dev_err(dwc->dev, "failed to initialize host\n"); dwc 387 drivers/usb/dwc3/drd.c if (dwc->usb2_phy) dwc 388 drivers/usb/dwc3/drd.c otg_set_vbus(dwc->usb2_phy->otg, true); dwc 389 drivers/usb/dwc3/drd.c if (dwc->usb2_generic_phy) dwc 390 drivers/usb/dwc3/drd.c phy_set_mode(dwc->usb2_generic_phy, dwc 395 drivers/usb/dwc3/drd.c spin_lock_irqsave(&dwc->lock, flags); dwc 396 drivers/usb/dwc3/drd.c dwc3_otgregs_init(dwc); dwc 397 drivers/usb/dwc3/drd.c dwc3_otg_device_init(dwc); dwc 398 drivers/usb/dwc3/drd.c dwc3_event_buffers_setup(dwc); dwc 399 drivers/usb/dwc3/drd.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 401 drivers/usb/dwc3/drd.c if (dwc->usb2_phy) dwc 402 drivers/usb/dwc3/drd.c otg_set_vbus(dwc->usb2_phy->otg, false); dwc 403 drivers/usb/dwc3/drd.c if (dwc->usb2_generic_phy) dwc 404 drivers/usb/dwc3/drd.c phy_set_mode(dwc->usb2_generic_phy, dwc 406 drivers/usb/dwc3/drd.c ret = dwc3_gadget_init(dwc); dwc 408 drivers/usb/dwc3/drd.c dev_err(dwc->dev, "failed to initialize peripheral\n"); dwc 415 drivers/usb/dwc3/drd.c static void dwc3_drd_update(struct dwc3 *dwc) dwc 419 drivers/usb/dwc3/drd.c if (dwc->edev) { dwc 420 drivers/usb/dwc3/drd.c id = extcon_get_state(dwc->edev, EXTCON_USB_HOST); dwc 423 drivers/usb/dwc3/drd.c dwc3_set_mode(dwc, id ? dwc 432 drivers/usb/dwc3/drd.c struct dwc3 *dwc = container_of(nb, struct dwc3, edev_nb); dwc 434 drivers/usb/dwc3/drd.c dwc3_set_mode(dwc, event ? dwc 441 drivers/usb/dwc3/drd.c static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) dwc 443 drivers/usb/dwc3/drd.c struct device *dev = dwc->dev; dwc 479 drivers/usb/dwc3/drd.c int dwc3_drd_init(struct dwc3 *dwc) dwc 483 drivers/usb/dwc3/drd.c dwc->edev = dwc3_get_extcon(dwc); dwc 484 drivers/usb/dwc3/drd.c if (IS_ERR(dwc->edev)) dwc 485 drivers/usb/dwc3/drd.c return PTR_ERR(dwc->edev); dwc 487 drivers/usb/dwc3/drd.c if (dwc->edev) { dwc 488 drivers/usb/dwc3/drd.c dwc->edev_nb.notifier_call = dwc3_drd_notifier; dwc 489 drivers/usb/dwc3/drd.c ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST, dwc 490 drivers/usb/dwc3/drd.c &dwc->edev_nb); dwc 492 drivers/usb/dwc3/drd.c dev_err(dwc->dev, "couldn't register cable notifier\n"); dwc 496 drivers/usb/dwc3/drd.c dwc3_drd_update(dwc); dwc 498 drivers/usb/dwc3/drd.c dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG); dwc 499 drivers/usb/dwc3/drd.c dwc->current_dr_role = DWC3_GCTL_PRTCAP_OTG; dwc 502 drivers/usb/dwc3/drd.c irq = dwc3_otg_get_irq(dwc); dwc 506 drivers/usb/dwc3/drd.c dwc->otg_irq = irq; dwc 509 drivers/usb/dwc3/drd.c dwc3_otg_disable_events(dwc, DWC3_OTG_ALL_EVENTS); dwc 511 drivers/usb/dwc3/drd.c dwc3_otg_clear_events(dwc); dwc 513 drivers/usb/dwc3/drd.c ret = request_threaded_irq(dwc->otg_irq, dwc3_otg_irq, dwc 515 drivers/usb/dwc3/drd.c IRQF_SHARED, "dwc3-otg", dwc); dwc 517 drivers/usb/dwc3/drd.c dev_err(dwc->dev, "failed to request irq #%d --> %d\n", dwc 518 drivers/usb/dwc3/drd.c dwc->otg_irq, ret); dwc 523 drivers/usb/dwc3/drd.c dwc3_otg_init(dwc); dwc 524 drivers/usb/dwc3/drd.c dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); dwc 530 drivers/usb/dwc3/drd.c void dwc3_drd_exit(struct dwc3 *dwc) dwc 534 drivers/usb/dwc3/drd.c if (dwc->edev) dwc 535 drivers/usb/dwc3/drd.c extcon_unregister_notifier(dwc->edev, EXTCON_USB_HOST, dwc 536 drivers/usb/dwc3/drd.c &dwc->edev_nb); dwc 538 drivers/usb/dwc3/drd.c cancel_work_sync(&dwc->drd_work); dwc 541 drivers/usb/dwc3/drd.c switch (dwc->current_dr_role) { dwc 543 drivers/usb/dwc3/drd.c dwc3_host_exit(dwc); dwc 546 drivers/usb/dwc3/drd.c dwc3_gadget_exit(dwc); dwc 547 drivers/usb/dwc3/drd.c dwc3_event_buffers_cleanup(dwc); dwc 550 drivers/usb/dwc3/drd.c dwc3_otg_exit(dwc); dwc 551 drivers/usb/dwc3/drd.c spin_lock_irqsave(&dwc->lock, flags); dwc 552 drivers/usb/dwc3/drd.c dwc->desired_otg_role = DWC3_OTG_ROLE_IDLE; dwc 553 drivers/usb/dwc3/drd.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 554 drivers/usb/dwc3/drd.c dwc3_otg_update(dwc, 1); dwc 560 drivers/usb/dwc3/drd.c if (!dwc->edev) dwc 561 drivers/usb/dwc3/drd.c free_irq(dwc->otg_irq, dwc); dwc 39 drivers/usb/dwc3/dwc3-haps.c struct dwc3_haps *dwc; dwc 52 drivers/usb/dwc3/dwc3-haps.c dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL); dwc 53 drivers/usb/dwc3/dwc3-haps.c if (!dwc) dwc 56 drivers/usb/dwc3/dwc3-haps.c dwc->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); dwc 57 drivers/usb/dwc3/dwc3-haps.c if (!dwc->dwc3) dwc 71 drivers/usb/dwc3/dwc3-haps.c ret = platform_device_add_resources(dwc->dwc3, res, ARRAY_SIZE(res)); dwc 77 drivers/usb/dwc3/dwc3-haps.c dwc->pci = pci; dwc 78 drivers/usb/dwc3/dwc3-haps.c dwc->dwc3->dev.parent = dev; dwc 80 drivers/usb/dwc3/dwc3-haps.c ret = platform_device_add_properties(dwc->dwc3, initial_properties); dwc 84 drivers/usb/dwc3/dwc3-haps.c ret = platform_device_add(dwc->dwc3); dwc 90 drivers/usb/dwc3/dwc3-haps.c pci_set_drvdata(pci, dwc); dwc 94 drivers/usb/dwc3/dwc3-haps.c platform_device_put(dwc->dwc3); dwc 100 drivers/usb/dwc3/dwc3-haps.c struct dwc3_haps *dwc = pci_get_drvdata(pci); dwc 102 drivers/usb/dwc3/dwc3-haps.c platform_device_unregister(dwc->dwc3); dwc 142 drivers/usb/dwc3/dwc3-pci.c static int dwc3_pci_quirks(struct dwc3_pci *dwc) dwc 144 drivers/usb/dwc3/dwc3-pci.c struct pci_dev *pdev = dwc->pci; dwc 149 drivers/usb/dwc3/dwc3-pci.c guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid); dwc 150 drivers/usb/dwc3/dwc3-pci.c dwc->has_dsm_for_pm = true; dwc 204 drivers/usb/dwc3/dwc3-pci.c struct dwc3_pci *dwc = container_of(work, struct dwc3_pci, wakeup_work); dwc 205 drivers/usb/dwc3/dwc3-pci.c struct platform_device *dwc3 = dwc->dwc3; dwc 220 drivers/usb/dwc3/dwc3-pci.c struct dwc3_pci *dwc; dwc 233 drivers/usb/dwc3/dwc3-pci.c dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL); dwc 234 drivers/usb/dwc3/dwc3-pci.c if (!dwc) dwc 237 drivers/usb/dwc3/dwc3-pci.c dwc->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); dwc 238 drivers/usb/dwc3/dwc3-pci.c if (!dwc->dwc3) dwc 252 drivers/usb/dwc3/dwc3-pci.c ret = platform_device_add_resources(dwc->dwc3, res, ARRAY_SIZE(res)); dwc 258 drivers/usb/dwc3/dwc3-pci.c dwc->pci = pci; dwc 259 drivers/usb/dwc3/dwc3-pci.c dwc->dwc3->dev.parent = dev; dwc 260 drivers/usb/dwc3/dwc3-pci.c ACPI_COMPANION_SET(&dwc->dwc3->dev, ACPI_COMPANION(dev)); dwc 262 drivers/usb/dwc3/dwc3-pci.c ret = platform_device_add_properties(dwc->dwc3, p); dwc 266 drivers/usb/dwc3/dwc3-pci.c ret = dwc3_pci_quirks(dwc); dwc 270 drivers/usb/dwc3/dwc3-pci.c ret = platform_device_add(dwc->dwc3); dwc 277 drivers/usb/dwc3/dwc3-pci.c pci_set_drvdata(pci, dwc); dwc 280 drivers/usb/dwc3/dwc3-pci.c INIT_WORK(&dwc->wakeup_work, dwc3_pci_resume_work); dwc 285 drivers/usb/dwc3/dwc3-pci.c platform_device_put(dwc->dwc3); dwc 291 drivers/usb/dwc3/dwc3-pci.c struct dwc3_pci *dwc = pci_get_drvdata(pci); dwc 292 drivers/usb/dwc3/dwc3-pci.c struct pci_dev *pdev = dwc->pci; dwc 297 drivers/usb/dwc3/dwc3-pci.c cancel_work_sync(&dwc->wakeup_work); dwc 301 drivers/usb/dwc3/dwc3-pci.c platform_device_unregister(dwc->dwc3); dwc 366 drivers/usb/dwc3/dwc3-pci.c static int dwc3_pci_dsm(struct dwc3_pci *dwc, int param) dwc 372 drivers/usb/dwc3/dwc3-pci.c if (!dwc->has_dsm_for_pm) dwc 378 drivers/usb/dwc3/dwc3-pci.c obj = acpi_evaluate_dsm(ACPI_HANDLE(&dwc->pci->dev), &dwc->guid, dwc 381 drivers/usb/dwc3/dwc3-pci.c dev_err(&dwc->pci->dev, "failed to evaluate _DSM\n"); dwc 394 drivers/usb/dwc3/dwc3-pci.c struct dwc3_pci *dwc = dev_get_drvdata(dev); dwc 397 drivers/usb/dwc3/dwc3-pci.c return dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D3); dwc 404 drivers/usb/dwc3/dwc3-pci.c struct dwc3_pci *dwc = dev_get_drvdata(dev); dwc 407 drivers/usb/dwc3/dwc3-pci.c ret = dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D0); dwc 411 drivers/usb/dwc3/dwc3-pci.c queue_work(pm_wq, &dwc->wakeup_work); dwc 420 drivers/usb/dwc3/dwc3-pci.c struct dwc3_pci *dwc = dev_get_drvdata(dev); dwc 422 drivers/usb/dwc3/dwc3-pci.c return dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D3); dwc 427 drivers/usb/dwc3/dwc3-pci.c struct dwc3_pci *dwc = dev_get_drvdata(dev); dwc 429 drivers/usb/dwc3/dwc3-pci.c return dwc3_pci_dsm(dwc, PCI_INTEL_BXT_STATE_D0); dwc 291 drivers/usb/dwc3/dwc3-qcom.c struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); dwc 297 drivers/usb/dwc3/dwc3-qcom.c if (dwc->xhci) dwc 298 drivers/usb/dwc3/dwc3-qcom.c pm_runtime_resume(&dwc->xhci->dev); dwc 30 drivers/usb/dwc3/ep0.c static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep); dwc 31 drivers/usb/dwc3/ep0.c static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, dwc 38 drivers/usb/dwc3/ep0.c struct dwc3 *dwc; dwc 40 drivers/usb/dwc3/ep0.c dwc = dep->dwc; dwc 41 drivers/usb/dwc3/ep0.c trb = &dwc->ep0_trb[dep->trb_enqueue]; dwc 66 drivers/usb/dwc3/ep0.c struct dwc3 *dwc; dwc 72 drivers/usb/dwc3/ep0.c dwc = dep->dwc; dwc 75 drivers/usb/dwc3/ep0.c params.param0 = upper_32_bits(dwc->ep0_trb_addr); dwc 76 drivers/usb/dwc3/ep0.c params.param1 = lower_32_bits(dwc->ep0_trb_addr); dwc 82 drivers/usb/dwc3/ep0.c dwc->ep0_next_event = DWC3_EP0_COMPLETE; dwc 90 drivers/usb/dwc3/ep0.c struct dwc3 *dwc = dep->dwc; dwc 112 drivers/usb/dwc3/ep0.c if (dwc->ep0state != EP0_DATA_PHASE) { dwc 113 drivers/usb/dwc3/ep0.c dev_WARN(dwc->dev, "Unexpected pending request\n"); dwc 117 drivers/usb/dwc3/ep0.c __dwc3_ep0_do_control_data(dwc, dwc->eps[direction], req); dwc 129 drivers/usb/dwc3/ep0.c if (dwc->delayed_status) { dwc 132 drivers/usb/dwc3/ep0.c direction = !dwc->ep0_expect_in; dwc 133 drivers/usb/dwc3/ep0.c dwc->delayed_status = false; dwc 134 drivers/usb/dwc3/ep0.c usb_gadget_set_state(&dwc->gadget, USB_STATE_CONFIGURED); dwc 136 drivers/usb/dwc3/ep0.c if (dwc->ep0state == EP0_STATUS_PHASE) dwc 137 drivers/usb/dwc3/ep0.c __dwc3_ep0_do_control_status(dwc, dwc->eps[direction]); dwc 174 drivers/usb/dwc3/ep0.c if (dwc->three_stage_setup) { dwc 177 drivers/usb/dwc3/ep0.c direction = dwc->ep0_expect_in; dwc 178 drivers/usb/dwc3/ep0.c dwc->ep0state = EP0_DATA_PHASE; dwc 180 drivers/usb/dwc3/ep0.c __dwc3_ep0_do_control_data(dwc, dwc->eps[direction], req); dwc 193 drivers/usb/dwc3/ep0.c struct dwc3 *dwc = dep->dwc; dwc 199 drivers/usb/dwc3/ep0.c spin_lock_irqsave(&dwc->lock, flags); dwc 201 drivers/usb/dwc3/ep0.c dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n", dwc 216 drivers/usb/dwc3/ep0.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 221 drivers/usb/dwc3/ep0.c static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) dwc 226 drivers/usb/dwc3/ep0.c dep = dwc->eps[1]; dwc 230 drivers/usb/dwc3/ep0.c dep = dwc->eps[0]; dwc 233 drivers/usb/dwc3/ep0.c dwc->delayed_status = false; dwc 242 drivers/usb/dwc3/ep0.c dwc->ep0state = EP0_SETUP_PHASE; dwc 243 drivers/usb/dwc3/ep0.c dwc3_ep0_out_start(dwc); dwc 249 drivers/usb/dwc3/ep0.c struct dwc3 *dwc = dep->dwc; dwc 251 drivers/usb/dwc3/ep0.c dwc3_ep0_stall_and_restart(dwc); dwc 259 drivers/usb/dwc3/ep0.c struct dwc3 *dwc = dep->dwc; dwc 263 drivers/usb/dwc3/ep0.c spin_lock_irqsave(&dwc->lock, flags); dwc 265 drivers/usb/dwc3/ep0.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 270 drivers/usb/dwc3/ep0.c void dwc3_ep0_out_start(struct dwc3 *dwc) dwc 275 drivers/usb/dwc3/ep0.c complete(&dwc->ep0_in_setup); dwc 277 drivers/usb/dwc3/ep0.c dep = dwc->eps[0]; dwc 278 drivers/usb/dwc3/ep0.c dwc3_ep0_prepare_one_trb(dep, dwc->ep0_trb_addr, 8, dwc 284 drivers/usb/dwc3/ep0.c static struct dwc3_ep *dwc3_wIndex_to_dep(struct dwc3 *dwc, __le16 wIndex_le) dwc 294 drivers/usb/dwc3/ep0.c dep = dwc->eps[epnum]; dwc 307 drivers/usb/dwc3/ep0.c static int dwc3_ep0_handle_status(struct dwc3 *dwc, dwc 328 drivers/usb/dwc3/ep0.c usb_status |= dwc->gadget.is_selfpowered; dwc 330 drivers/usb/dwc3/ep0.c if ((dwc->speed == DWC3_DSTS_SUPERSPEED) || dwc 331 drivers/usb/dwc3/ep0.c (dwc->speed == DWC3_DSTS_SUPERSPEED_PLUS)) { dwc 332 drivers/usb/dwc3/ep0.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 349 drivers/usb/dwc3/ep0.c dep = dwc3_wIndex_to_dep(dwc, ctrl->wIndex); dwc 360 drivers/usb/dwc3/ep0.c response_pkt = (__le16 *) dwc->setup_buf; dwc 363 drivers/usb/dwc3/ep0.c dep = dwc->eps[0]; dwc 364 drivers/usb/dwc3/ep0.c dwc->ep0_usb_req.dep = dep; dwc 365 drivers/usb/dwc3/ep0.c dwc->ep0_usb_req.request.length = sizeof(*response_pkt); dwc 366 drivers/usb/dwc3/ep0.c dwc->ep0_usb_req.request.buf = dwc->setup_buf; dwc 367 drivers/usb/dwc3/ep0.c dwc->ep0_usb_req.request.complete = dwc3_ep0_status_cmpl; dwc 369 drivers/usb/dwc3/ep0.c return __dwc3_gadget_ep0_queue(dep, &dwc->ep0_usb_req); dwc 372 drivers/usb/dwc3/ep0.c static int dwc3_ep0_handle_u1(struct dwc3 *dwc, enum usb_device_state state, dwc 379 drivers/usb/dwc3/ep0.c if ((dwc->speed != DWC3_DSTS_SUPERSPEED) && dwc 380 drivers/usb/dwc3/ep0.c (dwc->speed != DWC3_DSTS_SUPERSPEED_PLUS)) dwc 382 drivers/usb/dwc3/ep0.c if (set && dwc->dis_u1_entry_quirk) dwc 385 drivers/usb/dwc3/ep0.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 390 drivers/usb/dwc3/ep0.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 395 drivers/usb/dwc3/ep0.c static int dwc3_ep0_handle_u2(struct dwc3 *dwc, enum usb_device_state state, dwc 403 drivers/usb/dwc3/ep0.c if ((dwc->speed != DWC3_DSTS_SUPERSPEED) && dwc 404 drivers/usb/dwc3/ep0.c (dwc->speed != DWC3_DSTS_SUPERSPEED_PLUS)) dwc 406 drivers/usb/dwc3/ep0.c if (set && dwc->dis_u2_entry_quirk) dwc 409 drivers/usb/dwc3/ep0.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 414 drivers/usb/dwc3/ep0.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 419 drivers/usb/dwc3/ep0.c static int dwc3_ep0_handle_test(struct dwc3 *dwc, enum usb_device_state state, dwc 433 drivers/usb/dwc3/ep0.c dwc->test_mode_nr = wIndex >> 8; dwc 434 drivers/usb/dwc3/ep0.c dwc->test_mode = true; dwc 443 drivers/usb/dwc3/ep0.c static int dwc3_ep0_handle_device(struct dwc3 *dwc, dwc 453 drivers/usb/dwc3/ep0.c state = dwc->gadget.state; dwc 463 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_handle_u1(dwc, state, set); dwc 466 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_handle_u2(dwc, state, set); dwc 472 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_handle_test(dwc, state, wIndex, set); dwc 481 drivers/usb/dwc3/ep0.c static int dwc3_ep0_handle_intf(struct dwc3 *dwc, dwc 506 drivers/usb/dwc3/ep0.c static int dwc3_ep0_handle_endpoint(struct dwc3 *dwc, dwc 517 drivers/usb/dwc3/ep0.c dep = dwc3_wIndex_to_dep(dwc, ctrl->wIndex); dwc 535 drivers/usb/dwc3/ep0.c static int dwc3_ep0_handle_feature(struct dwc3 *dwc, dwc 545 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_handle_device(dwc, ctrl, set); dwc 548 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_handle_intf(dwc, ctrl, set); dwc 551 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_handle_endpoint(dwc, ctrl, set); dwc 560 drivers/usb/dwc3/ep0.c static int dwc3_ep0_set_address(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) dwc 562 drivers/usb/dwc3/ep0.c enum usb_device_state state = dwc->gadget.state; dwc 568 drivers/usb/dwc3/ep0.c dev_err(dwc->dev, "invalid device address %d\n", addr); dwc 573 drivers/usb/dwc3/ep0.c dev_err(dwc->dev, "can't SetAddress() from Configured State\n"); dwc 577 drivers/usb/dwc3/ep0.c reg = dwc3_readl(dwc->regs, DWC3_DCFG); dwc 580 drivers/usb/dwc3/ep0.c dwc3_writel(dwc->regs, DWC3_DCFG, reg); dwc 583 drivers/usb/dwc3/ep0.c usb_gadget_set_state(&dwc->gadget, USB_STATE_ADDRESS); dwc 585 drivers/usb/dwc3/ep0.c usb_gadget_set_state(&dwc->gadget, USB_STATE_DEFAULT); dwc 590 drivers/usb/dwc3/ep0.c static int dwc3_ep0_delegate_req(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) dwc 594 drivers/usb/dwc3/ep0.c spin_unlock(&dwc->lock); dwc 595 drivers/usb/dwc3/ep0.c ret = dwc->gadget_driver->setup(&dwc->gadget, ctrl); dwc 596 drivers/usb/dwc3/ep0.c spin_lock(&dwc->lock); dwc 600 drivers/usb/dwc3/ep0.c static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) dwc 602 drivers/usb/dwc3/ep0.c enum usb_device_state state = dwc->gadget.state; dwc 614 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_delegate_req(dwc, ctrl); dwc 625 drivers/usb/dwc3/ep0.c usb_gadget_set_state(&dwc->gadget, dwc 632 drivers/usb/dwc3/ep0.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 633 drivers/usb/dwc3/ep0.c if (!dwc->dis_u1_entry_quirk) dwc 635 drivers/usb/dwc3/ep0.c if (!dwc->dis_u2_entry_quirk) dwc 637 drivers/usb/dwc3/ep0.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 642 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_delegate_req(dwc, ctrl); dwc 644 drivers/usb/dwc3/ep0.c usb_gadget_set_state(&dwc->gadget, dwc 656 drivers/usb/dwc3/ep0.c struct dwc3 *dwc = dep->dwc; dwc 672 drivers/usb/dwc3/ep0.c dwc->u1sel = timing.u1sel; dwc 673 drivers/usb/dwc3/ep0.c dwc->u1pel = timing.u1pel; dwc 674 drivers/usb/dwc3/ep0.c dwc->u2sel = le16_to_cpu(timing.u2sel); dwc 675 drivers/usb/dwc3/ep0.c dwc->u2pel = le16_to_cpu(timing.u2pel); dwc 677 drivers/usb/dwc3/ep0.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 679 drivers/usb/dwc3/ep0.c param = dwc->u2pel; dwc 681 drivers/usb/dwc3/ep0.c param = dwc->u1pel; dwc 692 drivers/usb/dwc3/ep0.c ret = dwc3_send_gadget_generic_command(dwc, dwc 697 drivers/usb/dwc3/ep0.c static int dwc3_ep0_set_sel(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) dwc 700 drivers/usb/dwc3/ep0.c enum usb_device_state state = dwc->gadget.state; dwc 709 drivers/usb/dwc3/ep0.c dev_err(dwc->dev, "Set SEL should be 6 bytes, got %d\n", dwc 722 drivers/usb/dwc3/ep0.c dep = dwc->eps[0]; dwc 723 drivers/usb/dwc3/ep0.c dwc->ep0_usb_req.dep = dep; dwc 724 drivers/usb/dwc3/ep0.c dwc->ep0_usb_req.request.length = dep->endpoint.maxpacket; dwc 725 drivers/usb/dwc3/ep0.c dwc->ep0_usb_req.request.buf = dwc->setup_buf; dwc 726 drivers/usb/dwc3/ep0.c dwc->ep0_usb_req.request.complete = dwc3_ep0_set_sel_cmpl; dwc 728 drivers/usb/dwc3/ep0.c return __dwc3_gadget_ep0_queue(dep, &dwc->ep0_usb_req); dwc 731 drivers/usb/dwc3/ep0.c static int dwc3_ep0_set_isoch_delay(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) dwc 744 drivers/usb/dwc3/ep0.c dwc->gadget.isoch_delay = wValue; dwc 749 drivers/usb/dwc3/ep0.c static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) dwc 755 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_handle_status(dwc, ctrl); dwc 758 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_handle_feature(dwc, ctrl, 0); dwc 761 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_handle_feature(dwc, ctrl, 1); dwc 764 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_set_address(dwc, ctrl); dwc 767 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_set_config(dwc, ctrl); dwc 770 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_set_sel(dwc, ctrl); dwc 773 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_set_isoch_delay(dwc, ctrl); dwc 776 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_delegate_req(dwc, ctrl); dwc 783 drivers/usb/dwc3/ep0.c static void dwc3_ep0_inspect_setup(struct dwc3 *dwc, dwc 786 drivers/usb/dwc3/ep0.c struct usb_ctrlrequest *ctrl = (void *) dwc->ep0_trb; dwc 790 drivers/usb/dwc3/ep0.c if (!dwc->gadget_driver) dwc 797 drivers/usb/dwc3/ep0.c dwc->three_stage_setup = false; dwc 798 drivers/usb/dwc3/ep0.c dwc->ep0_expect_in = false; dwc 799 drivers/usb/dwc3/ep0.c dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; dwc 801 drivers/usb/dwc3/ep0.c dwc->three_stage_setup = true; dwc 802 drivers/usb/dwc3/ep0.c dwc->ep0_expect_in = !!(ctrl->bRequestType & USB_DIR_IN); dwc 803 drivers/usb/dwc3/ep0.c dwc->ep0_next_event = DWC3_EP0_NRDY_DATA; dwc 807 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_std_request(dwc, ctrl); dwc 809 drivers/usb/dwc3/ep0.c ret = dwc3_ep0_delegate_req(dwc, ctrl); dwc 812 drivers/usb/dwc3/ep0.c dwc->delayed_status = true; dwc 816 drivers/usb/dwc3/ep0.c dwc3_ep0_stall_and_restart(dwc); dwc 819 drivers/usb/dwc3/ep0.c static void dwc3_ep0_complete_data(struct dwc3 *dwc, dwc 832 drivers/usb/dwc3/ep0.c ep0 = dwc->eps[0]; dwc 834 drivers/usb/dwc3/ep0.c dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; dwc 835 drivers/usb/dwc3/ep0.c trb = dwc->ep0_trb; dwc 844 drivers/usb/dwc3/ep0.c dwc->setup_packet_pending = true; dwc 858 drivers/usb/dwc3/ep0.c ur->length && ur->zero) || dwc->ep0_bounced) { dwc 864 drivers/usb/dwc3/ep0.c dwc->eps[1]->trb_enqueue = 0; dwc 866 drivers/usb/dwc3/ep0.c dwc->eps[0]->trb_enqueue = 0; dwc 868 drivers/usb/dwc3/ep0.c dwc->ep0_bounced = false; dwc 872 drivers/usb/dwc3/ep0.c dwc3_ep0_stall_and_restart(dwc); dwc 877 drivers/usb/dwc3/ep0.c static void dwc3_ep0_complete_status(struct dwc3 *dwc, dwc 885 drivers/usb/dwc3/ep0.c dep = dwc->eps[0]; dwc 886 drivers/usb/dwc3/ep0.c trb = dwc->ep0_trb; dwc 896 drivers/usb/dwc3/ep0.c if (dwc->test_mode) { dwc 899 drivers/usb/dwc3/ep0.c ret = dwc3_gadget_set_test_mode(dwc, dwc->test_mode_nr); dwc 901 drivers/usb/dwc3/ep0.c dev_err(dwc->dev, "invalid test #%d\n", dwc 902 drivers/usb/dwc3/ep0.c dwc->test_mode_nr); dwc 903 drivers/usb/dwc3/ep0.c dwc3_ep0_stall_and_restart(dwc); dwc 910 drivers/usb/dwc3/ep0.c dwc->setup_packet_pending = true; dwc 912 drivers/usb/dwc3/ep0.c dwc->ep0state = EP0_SETUP_PHASE; dwc 913 drivers/usb/dwc3/ep0.c dwc3_ep0_out_start(dwc); dwc 916 drivers/usb/dwc3/ep0.c static void dwc3_ep0_xfer_complete(struct dwc3 *dwc, dwc 919 drivers/usb/dwc3/ep0.c struct dwc3_ep *dep = dwc->eps[event->endpoint_number]; dwc 923 drivers/usb/dwc3/ep0.c dwc->setup_packet_pending = false; dwc 925 drivers/usb/dwc3/ep0.c switch (dwc->ep0state) { dwc 927 drivers/usb/dwc3/ep0.c dwc3_ep0_inspect_setup(dwc, event); dwc 931 drivers/usb/dwc3/ep0.c dwc3_ep0_complete_data(dwc, event); dwc 935 drivers/usb/dwc3/ep0.c dwc3_ep0_complete_status(dwc, event); dwc 938 drivers/usb/dwc3/ep0.c WARN(true, "UNKNOWN ep0state %d\n", dwc->ep0state); dwc 942 drivers/usb/dwc3/ep0.c static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, dwc 950 drivers/usb/dwc3/ep0.c dwc3_ep0_prepare_one_trb(dep, dwc->ep0_trb_addr, 0, dwc 958 drivers/usb/dwc3/ep0.c ret = usb_gadget_map_request_by_dev(dwc->sysdev, dwc 965 drivers/usb/dwc3/ep0.c dwc->ep0_bounced = true; dwc 973 drivers/usb/dwc3/ep0.c req->trb = &dwc->ep0_trb[dep->trb_enqueue - 1]; dwc 976 drivers/usb/dwc3/ep0.c dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr, dwc 984 drivers/usb/dwc3/ep0.c ret = usb_gadget_map_request_by_dev(dwc->sysdev, dwc 995 drivers/usb/dwc3/ep0.c req->trb = &dwc->ep0_trb[dep->trb_enqueue - 1]; dwc 998 drivers/usb/dwc3/ep0.c dwc3_ep0_prepare_one_trb(dep, dwc->bounce_addr, dwc 1003 drivers/usb/dwc3/ep0.c ret = usb_gadget_map_request_by_dev(dwc->sysdev, dwc 1012 drivers/usb/dwc3/ep0.c req->trb = &dwc->ep0_trb[dep->trb_enqueue]; dwc 1022 drivers/usb/dwc3/ep0.c struct dwc3 *dwc = dep->dwc; dwc 1025 drivers/usb/dwc3/ep0.c type = dwc->three_stage_setup ? DWC3_TRBCTL_CONTROL_STATUS3 dwc 1028 drivers/usb/dwc3/ep0.c dwc3_ep0_prepare_one_trb(dep, dwc->ep0_trb_addr, 0, type, false); dwc 1032 drivers/usb/dwc3/ep0.c static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep) dwc 1037 drivers/usb/dwc3/ep0.c static void dwc3_ep0_do_control_status(struct dwc3 *dwc, dwc 1040 drivers/usb/dwc3/ep0.c struct dwc3_ep *dep = dwc->eps[event->endpoint_number]; dwc 1042 drivers/usb/dwc3/ep0.c __dwc3_ep0_do_control_status(dwc, dep); dwc 1045 drivers/usb/dwc3/ep0.c static void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep) dwc 1063 drivers/usb/dwc3/ep0.c static void dwc3_ep0_xfernotready(struct dwc3 *dwc, dwc 1077 drivers/usb/dwc3/ep0.c if (dwc->ep0_expect_in != event->endpoint_number) { dwc 1078 drivers/usb/dwc3/ep0.c struct dwc3_ep *dep = dwc->eps[dwc->ep0_expect_in]; dwc 1080 drivers/usb/dwc3/ep0.c dev_err(dwc->dev, "unexpected direction for Data Phase\n"); dwc 1081 drivers/usb/dwc3/ep0.c dwc3_ep0_end_control_data(dwc, dep); dwc 1082 drivers/usb/dwc3/ep0.c dwc3_ep0_stall_and_restart(dwc); dwc 1089 drivers/usb/dwc3/ep0.c if (dwc->ep0_next_event != DWC3_EP0_NRDY_STATUS) dwc 1092 drivers/usb/dwc3/ep0.c dwc->ep0state = EP0_STATUS_PHASE; dwc 1094 drivers/usb/dwc3/ep0.c if (dwc->delayed_status) { dwc 1095 drivers/usb/dwc3/ep0.c struct dwc3_ep *dep = dwc->eps[0]; dwc 1104 drivers/usb/dwc3/ep0.c dwc->delayed_status = false; dwc 1105 drivers/usb/dwc3/ep0.c usb_gadget_set_state(&dwc->gadget, dwc 1107 drivers/usb/dwc3/ep0.c dwc3_ep0_do_control_status(dwc, event); dwc 1113 drivers/usb/dwc3/ep0.c dwc3_ep0_do_control_status(dwc, event); dwc 1117 drivers/usb/dwc3/ep0.c void dwc3_ep0_interrupt(struct dwc3 *dwc, dwc 1120 drivers/usb/dwc3/ep0.c struct dwc3_ep *dep = dwc->eps[event->endpoint_number]; dwc 1125 drivers/usb/dwc3/ep0.c dwc3_ep0_xfer_complete(dwc, event); dwc 1129 drivers/usb/dwc3/ep0.c dwc3_ep0_xfernotready(dwc, event); dwc 41 drivers/usb/dwc3/gadget.c int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode) dwc 45 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 60 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 72 drivers/usb/dwc3/gadget.c int dwc3_gadget_get_link_state(struct dwc3 *dwc) dwc 76 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DSTS); dwc 89 drivers/usb/dwc3/gadget.c int dwc3_gadget_set_link_state(struct dwc3 *dwc, enum dwc3_link_state state) dwc 98 drivers/usb/dwc3/gadget.c if (dwc->revision >= DWC3_REVISION_194A) { dwc 100 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DSTS); dwc 111 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 116 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 122 drivers/usb/dwc3/gadget.c if (dwc->revision >= DWC3_REVISION_194A) dwc 128 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DSTS); dwc 175 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 185 drivers/usb/dwc3/gadget.c usb_gadget_unmap_request_by_dev(dwc->sysdev, dwc 192 drivers/usb/dwc3/gadget.c pm_runtime_put(dwc->dev); dwc 208 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 213 drivers/usb/dwc3/gadget.c spin_unlock(&dwc->lock); dwc 215 drivers/usb/dwc3/gadget.c spin_lock(&dwc->lock); dwc 227 drivers/usb/dwc3/gadget.c int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, u32 param) dwc 234 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DGCMDPAR, param); dwc 235 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DGCMD, cmd | DWC3_DGCMD_CMDACT); dwc 238 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DGCMD); dwc 257 drivers/usb/dwc3/gadget.c static int __dwc3_gadget_wakeup(struct dwc3 *dwc); dwc 272 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 290 drivers/usb/dwc3/gadget.c if (dwc->gadget.speed <= USB_SPEED_HIGH) { dwc 291 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); dwc 303 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); dwc 309 drivers/usb/dwc3/gadget.c needs_wakeup = (dwc->link_state == DWC3_LINK_STATE_U1 || dwc 310 drivers/usb/dwc3/gadget.c dwc->link_state == DWC3_LINK_STATE_U2 || dwc 311 drivers/usb/dwc3/gadget.c dwc->link_state == DWC3_LINK_STATE_U3); dwc 314 drivers/usb/dwc3/gadget.c ret = __dwc3_gadget_wakeup(dwc); dwc 315 drivers/usb/dwc3/gadget.c dev_WARN_ONCE(dwc->dev, ret, "wakeup failed --> %d\n", dwc 373 drivers/usb/dwc3/gadget.c dev_WARN(dwc->dev, "UNKNOWN cmd status\n"); dwc 393 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); dwc 395 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); dwc 403 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 415 drivers/usb/dwc3/gadget.c if (dep->direction && (dwc->revision >= DWC3_REVISION_260A) && dwc 416 drivers/usb/dwc3/gadget.c (dwc->gadget.speed >= USB_SPEED_SUPER)) dwc 434 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 439 drivers/usb/dwc3/gadget.c dep->trb_pool = dma_alloc_coherent(dwc->sysdev, dwc 443 drivers/usb/dwc3/gadget.c dev_err(dep->dwc->dev, "failed to allocate trb pool for %s\n", dwc 453 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 455 drivers/usb/dwc3/gadget.c dma_free_coherent(dwc->sysdev, sizeof(struct dwc3_trb) * DWC3_TRB_NUM, dwc 510 drivers/usb/dwc3/gadget.c struct dwc3 *dwc; dwc 520 drivers/usb/dwc3/gadget.c dwc = dep->dwc; dwc 527 drivers/usb/dwc3/gadget.c struct dwc3_ep *dep = dwc->eps[i]; dwc 545 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 556 drivers/usb/dwc3/gadget.c if (dwc->gadget.speed >= USB_SPEED_SUPER) { dwc 614 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 636 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); dwc 638 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); dwc 692 drivers/usb/dwc3/gadget.c static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep) dwc 730 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 735 drivers/usb/dwc3/gadget.c dwc3_remove_requests(dwc, dep); dwc 741 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); dwc 743 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); dwc 777 drivers/usb/dwc3/gadget.c struct dwc3 *dwc; dwc 792 drivers/usb/dwc3/gadget.c dwc = dep->dwc; dwc 794 drivers/usb/dwc3/gadget.c if (dev_WARN_ONCE(dwc->dev, dep->flags & DWC3_EP_ENABLED, dwc 799 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 801 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 809 drivers/usb/dwc3/gadget.c struct dwc3 *dwc; dwc 819 drivers/usb/dwc3/gadget.c dwc = dep->dwc; dwc 821 drivers/usb/dwc3/gadget.c if (dev_WARN_ONCE(dwc->dev, !(dep->flags & DWC3_EP_ENABLED), dwc 826 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 828 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 914 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 915 drivers/usb/dwc3/gadget.c struct usb_gadget *gadget = &dwc->gadget; dwc 983 drivers/usb/dwc3/gadget.c dev_WARN(dwc->dev, "Unknown endpoint type %d\n", dwc 1082 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 1093 drivers/usb/dwc3/gadget.c __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, dwc 1127 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 1138 drivers/usb/dwc3/gadget.c __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp - rem, dwc 1144 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 1155 drivers/usb/dwc3/gadget.c __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, 0, dwc 1197 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 1200 drivers/usb/dwc3/gadget.c ret = usb_gadget_map_request_by_dev(dwc->sysdev, &req->request, dwc 1273 drivers/usb/dwc3/gadget.c static int __dwc3_gadget_get_frame(struct dwc3 *dwc) dwc 1277 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DSTS); dwc 1342 drivers/usb/dwc3/gadget.c params.param0 = upper_32_bits(dep->dwc->bounce_addr); dwc 1343 drivers/usb/dwc3/gadget.c params.param1 = lower_32_bits(dep->dwc->bounce_addr); dwc 1398 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 1407 drivers/usb/dwc3/gadget.c if (!dwc->dis_start_transfer_quirk && dwc3_is_usb31(dwc) && dwc 1408 drivers/usb/dwc3/gadget.c (dwc->revision <= DWC3_USB31_REVISION_160A || dwc 1409 drivers/usb/dwc3/gadget.c (dwc->revision == DWC3_USB31_REVISION_170A && dwc 1410 drivers/usb/dwc3/gadget.c dwc->version_type >= DWC31_VERSIONTYPE_EA01 && dwc 1411 drivers/usb/dwc3/gadget.c dwc->version_type <= DWC31_VERSIONTYPE_EA06))) { dwc 1413 drivers/usb/dwc3/gadget.c if (dwc->gadget.speed <= USB_SPEED_HIGH && dep->direction) dwc 1430 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 1433 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n", dwc 1447 drivers/usb/dwc3/gadget.c pm_runtime_get(dwc->dev); dwc 1491 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 1497 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 1499 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1547 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 1554 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 1579 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "request %pK was not queued to %s\n", dwc 1589 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1597 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 1601 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "%s is of Isochronous type\n", dep->name); dwc 1616 drivers/usb/dwc3/gadget.c trb = &dwc->ep0_trb[dep->trb_enqueue]; dwc 1629 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "failed to set STALL on %s\n", dwc 1637 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "failed to clear STALL on %s\n", dwc 1649 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 1655 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 1657 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1665 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 1669 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 1676 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1715 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = gadget_to_dwc(g); dwc 1717 drivers/usb/dwc3/gadget.c return __dwc3_gadget_get_frame(dwc); dwc 1720 drivers/usb/dwc3/gadget.c static int __dwc3_gadget_wakeup(struct dwc3 *dwc) dwc 1735 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DSTS); dwc 1749 drivers/usb/dwc3/gadget.c ret = dwc3_gadget_set_link_state(dwc, DWC3_LINK_STATE_RECOV); dwc 1751 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "failed to put link in Recovery\n"); dwc 1756 drivers/usb/dwc3/gadget.c if (dwc->revision < DWC3_REVISION_194A) { dwc 1758 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 1760 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 1767 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DSTS); dwc 1775 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "failed to send remote wakeup\n"); dwc 1784 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = gadget_to_dwc(g); dwc 1788 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 1789 drivers/usb/dwc3/gadget.c ret = __dwc3_gadget_wakeup(dwc); dwc 1790 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1798 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = gadget_to_dwc(g); dwc 1801 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 1803 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1808 drivers/usb/dwc3/gadget.c static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend) dwc 1813 drivers/usb/dwc3/gadget.c if (pm_runtime_suspended(dwc->dev)) dwc 1816 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 1818 drivers/usb/dwc3/gadget.c if (dwc->revision <= DWC3_REVISION_187A) { dwc 1823 drivers/usb/dwc3/gadget.c if (dwc->revision >= DWC3_REVISION_194A) dwc 1827 drivers/usb/dwc3/gadget.c if (dwc->has_hibernation) dwc 1830 drivers/usb/dwc3/gadget.c dwc->pullups_connected = true; dwc 1834 drivers/usb/dwc3/gadget.c if (dwc->has_hibernation && !suspend) dwc 1837 drivers/usb/dwc3/gadget.c dwc->pullups_connected = false; dwc 1840 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 1843 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DSTS); dwc 1855 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = gadget_to_dwc(g); dwc 1865 drivers/usb/dwc3/gadget.c if (!is_on && dwc->ep0state != EP0_SETUP_PHASE) { dwc 1866 drivers/usb/dwc3/gadget.c reinit_completion(&dwc->ep0_in_setup); dwc 1868 drivers/usb/dwc3/gadget.c ret = wait_for_completion_timeout(&dwc->ep0_in_setup, dwc 1871 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "timed out waiting for SETUP phase\n"); dwc 1876 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 1877 drivers/usb/dwc3/gadget.c ret = dwc3_gadget_run_stop(dwc, is_on, false); dwc 1878 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 1883 drivers/usb/dwc3/gadget.c static void dwc3_gadget_enable_irq(struct dwc3 *dwc) dwc 1897 drivers/usb/dwc3/gadget.c if (dwc->revision < DWC3_REVISION_250A) dwc 1900 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DEVTEN, reg); dwc 1903 drivers/usb/dwc3/gadget.c static void dwc3_gadget_disable_irq(struct dwc3 *dwc) dwc 1906 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DEVTEN, 0x00); dwc 1933 drivers/usb/dwc3/gadget.c static void dwc3_gadget_setup_nump(struct dwc3 *dwc) dwc 1940 drivers/usb/dwc3/gadget.c ram2_depth = DWC3_GHWPARAMS7_RAM2_DEPTH(dwc->hwparams.hwparams7); dwc 1941 drivers/usb/dwc3/gadget.c mdwidth = DWC3_GHWPARAMS0_MDWIDTH(dwc->hwparams.hwparams0); dwc 1947 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCFG); dwc 1950 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCFG, reg); dwc 1953 drivers/usb/dwc3/gadget.c static int __dwc3_gadget_start(struct dwc3 *dwc) dwc 1963 drivers/usb/dwc3/gadget.c if (dwc->imod_interval) { dwc 1964 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), dwc->imod_interval); dwc 1965 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), DWC3_GEVNTCOUNT_EHB); dwc 1966 drivers/usb/dwc3/gadget.c } else if (dwc3_has_imod(dwc)) { dwc 1967 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), 0); dwc 1977 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_GRXTHRCFG); dwc 1978 drivers/usb/dwc3/gadget.c if (dwc3_is_usb31(dwc)) dwc 1983 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_GRXTHRCFG, reg); dwc 1985 drivers/usb/dwc3/gadget.c dwc3_gadget_setup_nump(dwc); dwc 1990 drivers/usb/dwc3/gadget.c dep = dwc->eps[0]; dwc 1993 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "failed to enable %s\n", dep->name); dwc 1997 drivers/usb/dwc3/gadget.c dep = dwc->eps[1]; dwc 2000 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "failed to enable %s\n", dep->name); dwc 2005 drivers/usb/dwc3/gadget.c dwc->ep0state = EP0_SETUP_PHASE; dwc 2006 drivers/usb/dwc3/gadget.c dwc->link_state = DWC3_LINK_STATE_SS_DIS; dwc 2007 drivers/usb/dwc3/gadget.c dwc3_ep0_out_start(dwc); dwc 2009 drivers/usb/dwc3/gadget.c dwc3_gadget_enable_irq(dwc); dwc 2014 drivers/usb/dwc3/gadget.c __dwc3_gadget_ep_disable(dwc->eps[0]); dwc 2023 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = gadget_to_dwc(g); dwc 2028 drivers/usb/dwc3/gadget.c irq = dwc->irq_gadget; dwc 2030 drivers/usb/dwc3/gadget.c IRQF_SHARED, "dwc3", dwc->ev_buf); dwc 2032 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "failed to request irq #%d --> %d\n", dwc 2037 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 2038 drivers/usb/dwc3/gadget.c if (dwc->gadget_driver) { dwc 2039 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "%s is already bound to %s\n", dwc 2040 drivers/usb/dwc3/gadget.c dwc->gadget.name, dwc 2041 drivers/usb/dwc3/gadget.c dwc->gadget_driver->driver.name); dwc 2046 drivers/usb/dwc3/gadget.c dwc->gadget_driver = driver; dwc 2048 drivers/usb/dwc3/gadget.c if (pm_runtime_active(dwc->dev)) dwc 2049 drivers/usb/dwc3/gadget.c __dwc3_gadget_start(dwc); dwc 2051 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 2056 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 2057 drivers/usb/dwc3/gadget.c free_irq(irq, dwc); dwc 2063 drivers/usb/dwc3/gadget.c static void __dwc3_gadget_stop(struct dwc3 *dwc) dwc 2065 drivers/usb/dwc3/gadget.c dwc3_gadget_disable_irq(dwc); dwc 2066 drivers/usb/dwc3/gadget.c __dwc3_gadget_ep_disable(dwc->eps[0]); dwc 2067 drivers/usb/dwc3/gadget.c __dwc3_gadget_ep_disable(dwc->eps[1]); dwc 2072 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = gadget_to_dwc(g); dwc 2075 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 2077 drivers/usb/dwc3/gadget.c if (pm_runtime_suspended(dwc->dev)) dwc 2080 drivers/usb/dwc3/gadget.c __dwc3_gadget_stop(dwc); dwc 2083 drivers/usb/dwc3/gadget.c dwc->gadget_driver = NULL; dwc 2084 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 2086 drivers/usb/dwc3/gadget.c free_irq(dwc->irq_gadget, dwc->ev_buf); dwc 2094 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = gadget_to_dwc(g); dwc 2100 drivers/usb/dwc3/gadget.c if (!dwc->dis_enblslpm_quirk) { dwc 2111 drivers/usb/dwc3/gadget.c if (dwc->is_utmi_l1_suspend) dwc 2113 drivers/usb/dwc3/gadget.c clamp_t(u8, dwc->hird_threshold, 2, 15); dwc 2117 drivers/usb/dwc3/gadget.c if (dwc->dis_u1_entry_quirk) dwc 2123 drivers/usb/dwc3/gadget.c if (dwc->dis_u2_entry_quirk) dwc 2133 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = gadget_to_dwc(g); dwc 2137 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 2138 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCFG); dwc 2154 drivers/usb/dwc3/gadget.c if (dwc->revision < DWC3_REVISION_220A && dwc 2155 drivers/usb/dwc3/gadget.c !dwc->dis_metastability_quirk) { dwc 2172 drivers/usb/dwc3/gadget.c if (dwc3_is_usb31(dwc)) dwc 2178 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "invalid speed (%d)\n", speed); dwc 2180 drivers/usb/dwc3/gadget.c if (dwc->revision & DWC3_REVISION_IS_DWC31) dwc 2186 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCFG, reg); dwc 2188 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 2206 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 2212 drivers/usb/dwc3/gadget.c dwc->gadget.ep0 = &dep->endpoint; dwc 2221 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 2225 drivers/usb/dwc3/gadget.c mdwidth = DWC3_MDWIDTH(dwc->hwparams.hwparams0); dwc 2229 drivers/usb/dwc3/gadget.c size = dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(dep->number >> 1)); dwc 2230 drivers/usb/dwc3/gadget.c if (dwc3_is_usb31(dwc)) dwc 2245 drivers/usb/dwc3/gadget.c if (dwc->maximum_speed >= USB_SPEED_SUPER) dwc 2255 drivers/usb/dwc3/gadget.c &dwc->gadget.ep_list); dwc 2265 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 2269 drivers/usb/dwc3/gadget.c mdwidth = DWC3_MDWIDTH(dwc->hwparams.hwparams0); dwc 2275 drivers/usb/dwc3/gadget.c size = dwc3_readl(dwc->regs, DWC3_GRXFIFOSIZ(0)); dwc 2276 drivers/usb/dwc3/gadget.c if (dwc3_is_usb31(dwc)) dwc 2302 drivers/usb/dwc3/gadget.c &dwc->gadget.ep_list); dwc 2310 drivers/usb/dwc3/gadget.c static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum) dwc 2321 drivers/usb/dwc3/gadget.c dep->dwc = dwc; dwc 2324 drivers/usb/dwc3/gadget.c dep->regs = dwc->regs + DWC3_DEP_BASE(epnum); dwc 2325 drivers/usb/dwc3/gadget.c dwc->eps[epnum] = dep; dwc 2359 drivers/usb/dwc3/gadget.c static int dwc3_gadget_init_endpoints(struct dwc3 *dwc, u8 total) dwc 2363 drivers/usb/dwc3/gadget.c INIT_LIST_HEAD(&dwc->gadget.ep_list); dwc 2368 drivers/usb/dwc3/gadget.c ret = dwc3_gadget_init_endpoint(dwc, epnum); dwc 2376 drivers/usb/dwc3/gadget.c static void dwc3_gadget_free_endpoints(struct dwc3 *dwc) dwc 2382 drivers/usb/dwc3/gadget.c dep = dwc->eps[epnum]; dwc 2567 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 2592 drivers/usb/dwc3/gadget.c if (dwc->revision < DWC3_REVISION_183A) { dwc 2597 drivers/usb/dwc3/gadget.c dep = dwc->eps[i]; dwc 2606 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 2607 drivers/usb/dwc3/gadget.c reg |= dwc->u1u2; dwc 2608 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 2610 drivers/usb/dwc3/gadget.c dwc->u1u2 = 0; dwc 2621 drivers/usb/dwc3/gadget.c static void dwc3_endpoint_interrupt(struct dwc3 *dwc, dwc 2628 drivers/usb/dwc3/gadget.c dep = dwc->eps[epnum]; dwc 2640 drivers/usb/dwc3/gadget.c dwc3_ep0_interrupt(dwc, event); dwc 2672 drivers/usb/dwc3/gadget.c static void dwc3_disconnect_gadget(struct dwc3 *dwc) dwc 2674 drivers/usb/dwc3/gadget.c if (dwc->gadget_driver && dwc->gadget_driver->disconnect) { dwc 2675 drivers/usb/dwc3/gadget.c spin_unlock(&dwc->lock); dwc 2676 drivers/usb/dwc3/gadget.c dwc->gadget_driver->disconnect(&dwc->gadget); dwc 2677 drivers/usb/dwc3/gadget.c spin_lock(&dwc->lock); dwc 2681 drivers/usb/dwc3/gadget.c static void dwc3_suspend_gadget(struct dwc3 *dwc) dwc 2683 drivers/usb/dwc3/gadget.c if (dwc->gadget_driver && dwc->gadget_driver->suspend) { dwc 2684 drivers/usb/dwc3/gadget.c spin_unlock(&dwc->lock); dwc 2685 drivers/usb/dwc3/gadget.c dwc->gadget_driver->suspend(&dwc->gadget); dwc 2686 drivers/usb/dwc3/gadget.c spin_lock(&dwc->lock); dwc 2690 drivers/usb/dwc3/gadget.c static void dwc3_resume_gadget(struct dwc3 *dwc) dwc 2692 drivers/usb/dwc3/gadget.c if (dwc->gadget_driver && dwc->gadget_driver->resume) { dwc 2693 drivers/usb/dwc3/gadget.c spin_unlock(&dwc->lock); dwc 2694 drivers/usb/dwc3/gadget.c dwc->gadget_driver->resume(&dwc->gadget); dwc 2695 drivers/usb/dwc3/gadget.c spin_lock(&dwc->lock); dwc 2699 drivers/usb/dwc3/gadget.c static void dwc3_reset_gadget(struct dwc3 *dwc) dwc 2701 drivers/usb/dwc3/gadget.c if (!dwc->gadget_driver) dwc 2704 drivers/usb/dwc3/gadget.c if (dwc->gadget.speed != USB_SPEED_UNKNOWN) { dwc 2705 drivers/usb/dwc3/gadget.c spin_unlock(&dwc->lock); dwc 2706 drivers/usb/dwc3/gadget.c usb_gadget_udc_reset(&dwc->gadget, dwc->gadget_driver); dwc 2707 drivers/usb/dwc3/gadget.c spin_lock(&dwc->lock); dwc 2714 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = dep->dwc; dwc 2768 drivers/usb/dwc3/gadget.c if (dwc3_is_usb31(dwc) || dwc->revision < DWC3_REVISION_310A) dwc 2772 drivers/usb/dwc3/gadget.c static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) dwc 2780 drivers/usb/dwc3/gadget.c dep = dwc->eps[epnum]; dwc 2794 drivers/usb/dwc3/gadget.c static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc) dwc 2798 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 2800 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 2803 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 2805 drivers/usb/dwc3/gadget.c dwc3_disconnect_gadget(dwc); dwc 2807 drivers/usb/dwc3/gadget.c dwc->gadget.speed = USB_SPEED_UNKNOWN; dwc 2808 drivers/usb/dwc3/gadget.c dwc->setup_packet_pending = false; dwc 2809 drivers/usb/dwc3/gadget.c usb_gadget_set_state(&dwc->gadget, USB_STATE_NOTATTACHED); dwc 2811 drivers/usb/dwc3/gadget.c dwc->connected = false; dwc 2814 drivers/usb/dwc3/gadget.c static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) dwc 2818 drivers/usb/dwc3/gadget.c dwc->connected = true; dwc 2846 drivers/usb/dwc3/gadget.c if (dwc->revision < DWC3_REVISION_188A) { dwc 2847 drivers/usb/dwc3/gadget.c if (dwc->setup_packet_pending) dwc 2848 drivers/usb/dwc3/gadget.c dwc3_gadget_disconnect_interrupt(dwc); dwc 2851 drivers/usb/dwc3/gadget.c dwc3_reset_gadget(dwc); dwc 2853 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 2855 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 2856 drivers/usb/dwc3/gadget.c dwc->test_mode = false; dwc 2857 drivers/usb/dwc3/gadget.c dwc3_clear_stall_all_ep(dwc); dwc 2860 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCFG); dwc 2862 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCFG, reg); dwc 2865 drivers/usb/dwc3/gadget.c static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) dwc 2872 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DSTS); dwc 2874 drivers/usb/dwc3/gadget.c dwc->speed = speed; dwc 2888 drivers/usb/dwc3/gadget.c dwc->gadget.ep0->maxpacket = 512; dwc 2889 drivers/usb/dwc3/gadget.c dwc->gadget.speed = USB_SPEED_SUPER_PLUS; dwc 2905 drivers/usb/dwc3/gadget.c if (dwc->revision < DWC3_REVISION_190A) dwc 2906 drivers/usb/dwc3/gadget.c dwc3_gadget_reset_interrupt(dwc); dwc 2909 drivers/usb/dwc3/gadget.c dwc->gadget.ep0->maxpacket = 512; dwc 2910 drivers/usb/dwc3/gadget.c dwc->gadget.speed = USB_SPEED_SUPER; dwc 2914 drivers/usb/dwc3/gadget.c dwc->gadget.ep0->maxpacket = 64; dwc 2915 drivers/usb/dwc3/gadget.c dwc->gadget.speed = USB_SPEED_HIGH; dwc 2919 drivers/usb/dwc3/gadget.c dwc->gadget.ep0->maxpacket = 64; dwc 2920 drivers/usb/dwc3/gadget.c dwc->gadget.speed = USB_SPEED_FULL; dwc 2924 drivers/usb/dwc3/gadget.c dwc->gadget.ep0->maxpacket = 8; dwc 2925 drivers/usb/dwc3/gadget.c dwc->gadget.speed = USB_SPEED_LOW; dwc 2929 drivers/usb/dwc3/gadget.c dwc->eps[1]->endpoint.maxpacket = dwc->gadget.ep0->maxpacket; dwc 2933 drivers/usb/dwc3/gadget.c if ((dwc->revision > DWC3_REVISION_194A) && dwc 2936 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCFG); dwc 2938 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCFG, reg); dwc 2940 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 2943 drivers/usb/dwc3/gadget.c reg |= DWC3_DCTL_HIRD_THRES(dwc->hird_threshold | dwc 2944 drivers/usb/dwc3/gadget.c (dwc->is_utmi_l1_suspend << 4)); dwc 2952 drivers/usb/dwc3/gadget.c WARN_ONCE(dwc->revision < DWC3_REVISION_240A dwc 2953 drivers/usb/dwc3/gadget.c && dwc->has_lpm_erratum, dwc 2956 drivers/usb/dwc3/gadget.c if (dwc->has_lpm_erratum && dwc->revision >= DWC3_REVISION_240A) dwc 2957 drivers/usb/dwc3/gadget.c reg |= DWC3_DCTL_NYET_THRES(dwc->lpm_nyet_threshold); dwc 2959 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 2961 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 2963 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 2966 drivers/usb/dwc3/gadget.c dep = dwc->eps[0]; dwc 2969 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "failed to enable %s\n", dep->name); dwc 2973 drivers/usb/dwc3/gadget.c dep = dwc->eps[1]; dwc 2976 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "failed to enable %s\n", dep->name); dwc 2989 drivers/usb/dwc3/gadget.c static void dwc3_gadget_wakeup_interrupt(struct dwc3 *dwc) dwc 2996 drivers/usb/dwc3/gadget.c if (dwc->gadget_driver && dwc->gadget_driver->resume) { dwc 2997 drivers/usb/dwc3/gadget.c spin_unlock(&dwc->lock); dwc 2998 drivers/usb/dwc3/gadget.c dwc->gadget_driver->resume(&dwc->gadget); dwc 2999 drivers/usb/dwc3/gadget.c spin_lock(&dwc->lock); dwc 3003 drivers/usb/dwc3/gadget.c static void dwc3_gadget_linksts_change_interrupt(struct dwc3 *dwc, dwc 3026 drivers/usb/dwc3/gadget.c pwropt = DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1); dwc 3027 drivers/usb/dwc3/gadget.c if ((dwc->revision < DWC3_REVISION_250A) && dwc 3029 drivers/usb/dwc3/gadget.c if ((dwc->link_state == DWC3_LINK_STATE_U3) && dwc 3053 drivers/usb/dwc3/gadget.c if (dwc->revision < DWC3_REVISION_183A) { dwc 3058 drivers/usb/dwc3/gadget.c switch (dwc->link_state) { dwc 3061 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_DCTL); dwc 3067 drivers/usb/dwc3/gadget.c if (!dwc->u1u2) dwc 3068 drivers/usb/dwc3/gadget.c dwc->u1u2 = reg & u1u2; dwc 3072 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DCTL, reg); dwc 3083 drivers/usb/dwc3/gadget.c if (dwc->speed == USB_SPEED_SUPER) dwc 3084 drivers/usb/dwc3/gadget.c dwc3_suspend_gadget(dwc); dwc 3088 drivers/usb/dwc3/gadget.c dwc3_suspend_gadget(dwc); dwc 3091 drivers/usb/dwc3/gadget.c dwc3_resume_gadget(dwc); dwc 3098 drivers/usb/dwc3/gadget.c dwc->link_state = next; dwc 3101 drivers/usb/dwc3/gadget.c static void dwc3_gadget_suspend_interrupt(struct dwc3 *dwc, dwc 3106 drivers/usb/dwc3/gadget.c if (dwc->link_state != next && next == DWC3_LINK_STATE_U3) dwc 3107 drivers/usb/dwc3/gadget.c dwc3_suspend_gadget(dwc); dwc 3109 drivers/usb/dwc3/gadget.c dwc->link_state = next; dwc 3112 drivers/usb/dwc3/gadget.c static void dwc3_gadget_hibernation_interrupt(struct dwc3 *dwc, dwc 3130 drivers/usb/dwc3/gadget.c if (is_ss ^ (dwc->speed == USB_SPEED_SUPER)) dwc 3136 drivers/usb/dwc3/gadget.c static void dwc3_gadget_interrupt(struct dwc3 *dwc, dwc 3141 drivers/usb/dwc3/gadget.c dwc3_gadget_disconnect_interrupt(dwc); dwc 3144 drivers/usb/dwc3/gadget.c dwc3_gadget_reset_interrupt(dwc); dwc 3147 drivers/usb/dwc3/gadget.c dwc3_gadget_conndone_interrupt(dwc); dwc 3150 drivers/usb/dwc3/gadget.c dwc3_gadget_wakeup_interrupt(dwc); dwc 3153 drivers/usb/dwc3/gadget.c if (dev_WARN_ONCE(dwc->dev, !dwc->has_hibernation, dwc 3157 drivers/usb/dwc3/gadget.c dwc3_gadget_hibernation_interrupt(dwc, event->event_info); dwc 3160 drivers/usb/dwc3/gadget.c dwc3_gadget_linksts_change_interrupt(dwc, event->event_info); dwc 3164 drivers/usb/dwc3/gadget.c if (dwc->revision >= DWC3_REVISION_230A) { dwc 3169 drivers/usb/dwc3/gadget.c if (dwc->gadget.state >= USB_STATE_CONFIGURED) dwc 3170 drivers/usb/dwc3/gadget.c dwc3_gadget_suspend_interrupt(dwc, dwc 3180 drivers/usb/dwc3/gadget.c dev_WARN(dwc->dev, "UNKNOWN IRQ %d\n", event->type); dwc 3184 drivers/usb/dwc3/gadget.c static void dwc3_process_event_entry(struct dwc3 *dwc, dwc 3187 drivers/usb/dwc3/gadget.c trace_dwc3_event(event->raw, dwc); dwc 3190 drivers/usb/dwc3/gadget.c dwc3_endpoint_interrupt(dwc, &event->depevt); dwc 3192 drivers/usb/dwc3/gadget.c dwc3_gadget_interrupt(dwc, &event->devt); dwc 3194 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "UNKNOWN IRQ type %d\n", event->raw); dwc 3199 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = evt->dwc; dwc 3214 drivers/usb/dwc3/gadget.c dwc3_process_event_entry(dwc, &event); dwc 3234 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_GEVNTSIZ(0)); dwc 3236 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), reg); dwc 3238 drivers/usb/dwc3/gadget.c if (dwc->imod_interval) { dwc 3239 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), DWC3_GEVNTCOUNT_EHB); dwc 3240 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), dwc->imod_interval); dwc 3249 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = evt->dwc; dwc 3253 drivers/usb/dwc3/gadget.c spin_lock_irqsave(&dwc->lock, flags); dwc 3255 drivers/usb/dwc3/gadget.c spin_unlock_irqrestore(&dwc->lock, flags); dwc 3262 drivers/usb/dwc3/gadget.c struct dwc3 *dwc = evt->dwc; dwc 3267 drivers/usb/dwc3/gadget.c if (pm_runtime_suspended(dwc->dev)) { dwc 3268 drivers/usb/dwc3/gadget.c pm_runtime_get(dwc->dev); dwc 3269 drivers/usb/dwc3/gadget.c disable_irq_nosync(dwc->irq_gadget); dwc 3270 drivers/usb/dwc3/gadget.c dwc->pending_events = true; dwc 3283 drivers/usb/dwc3/gadget.c count = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); dwc 3292 drivers/usb/dwc3/gadget.c reg = dwc3_readl(dwc->regs, DWC3_GEVNTSIZ(0)); dwc 3294 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), reg); dwc 3302 drivers/usb/dwc3/gadget.c dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), count); dwc 3314 drivers/usb/dwc3/gadget.c static int dwc3_gadget_get_irq(struct dwc3 *dwc) dwc 3316 drivers/usb/dwc3/gadget.c struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); dwc 3350 drivers/usb/dwc3/gadget.c int dwc3_gadget_init(struct dwc3 *dwc) dwc 3355 drivers/usb/dwc3/gadget.c irq = dwc3_gadget_get_irq(dwc); dwc 3361 drivers/usb/dwc3/gadget.c dwc->irq_gadget = irq; dwc 3363 drivers/usb/dwc3/gadget.c dwc->ep0_trb = dma_alloc_coherent(dwc->sysdev, dwc 3364 drivers/usb/dwc3/gadget.c sizeof(*dwc->ep0_trb) * 2, dwc 3365 drivers/usb/dwc3/gadget.c &dwc->ep0_trb_addr, GFP_KERNEL); dwc 3366 drivers/usb/dwc3/gadget.c if (!dwc->ep0_trb) { dwc 3367 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "failed to allocate ep0 trb\n"); dwc 3372 drivers/usb/dwc3/gadget.c dwc->setup_buf = kzalloc(DWC3_EP0_SETUP_SIZE, GFP_KERNEL); dwc 3373 drivers/usb/dwc3/gadget.c if (!dwc->setup_buf) { dwc 3378 drivers/usb/dwc3/gadget.c dwc->bounce = dma_alloc_coherent(dwc->sysdev, DWC3_BOUNCE_SIZE, dwc 3379 drivers/usb/dwc3/gadget.c &dwc->bounce_addr, GFP_KERNEL); dwc 3380 drivers/usb/dwc3/gadget.c if (!dwc->bounce) { dwc 3385 drivers/usb/dwc3/gadget.c init_completion(&dwc->ep0_in_setup); dwc 3387 drivers/usb/dwc3/gadget.c dwc->gadget.ops = &dwc3_gadget_ops; dwc 3388 drivers/usb/dwc3/gadget.c dwc->gadget.speed = USB_SPEED_UNKNOWN; dwc 3389 drivers/usb/dwc3/gadget.c dwc->gadget.sg_supported = true; dwc 3390 drivers/usb/dwc3/gadget.c dwc->gadget.name = "dwc3-gadget"; dwc 3391 drivers/usb/dwc3/gadget.c dwc->gadget.lpm_capable = true; dwc 3409 drivers/usb/dwc3/gadget.c if (dwc->revision < DWC3_REVISION_220A && dwc 3410 drivers/usb/dwc3/gadget.c !dwc->dis_metastability_quirk) dwc 3411 drivers/usb/dwc3/gadget.c dev_info(dwc->dev, "changing max_speed on rev %08x\n", dwc 3412 drivers/usb/dwc3/gadget.c dwc->revision); dwc 3414 drivers/usb/dwc3/gadget.c dwc->gadget.max_speed = dwc->maximum_speed; dwc 3421 drivers/usb/dwc3/gadget.c ret = dwc3_gadget_init_endpoints(dwc, dwc->num_eps); dwc 3425 drivers/usb/dwc3/gadget.c ret = usb_add_gadget_udc(dwc->dev, &dwc->gadget); dwc 3427 drivers/usb/dwc3/gadget.c dev_err(dwc->dev, "failed to register udc\n"); dwc 3431 drivers/usb/dwc3/gadget.c dwc3_gadget_set_speed(&dwc->gadget, dwc->maximum_speed); dwc 3436 drivers/usb/dwc3/gadget.c dwc3_gadget_free_endpoints(dwc); dwc 3439 drivers/usb/dwc3/gadget.c dma_free_coherent(dwc->sysdev, DWC3_BOUNCE_SIZE, dwc->bounce, dwc 3440 drivers/usb/dwc3/gadget.c dwc->bounce_addr); dwc 3443 drivers/usb/dwc3/gadget.c kfree(dwc->setup_buf); dwc 3446 drivers/usb/dwc3/gadget.c dma_free_coherent(dwc->sysdev, sizeof(*dwc->ep0_trb) * 2, dwc 3447 drivers/usb/dwc3/gadget.c dwc->ep0_trb, dwc->ep0_trb_addr); dwc 3455 drivers/usb/dwc3/gadget.c void dwc3_gadget_exit(struct dwc3 *dwc) dwc 3457 drivers/usb/dwc3/gadget.c usb_del_gadget_udc(&dwc->gadget); dwc 3458 drivers/usb/dwc3/gadget.c dwc3_gadget_free_endpoints(dwc); dwc 3459 drivers/usb/dwc3/gadget.c dma_free_coherent(dwc->sysdev, DWC3_BOUNCE_SIZE, dwc->bounce, dwc 3460 drivers/usb/dwc3/gadget.c dwc->bounce_addr); dwc 3461 drivers/usb/dwc3/gadget.c kfree(dwc->setup_buf); dwc 3462 drivers/usb/dwc3/gadget.c dma_free_coherent(dwc->sysdev, sizeof(*dwc->ep0_trb) * 2, dwc 3463 drivers/usb/dwc3/gadget.c dwc->ep0_trb, dwc->ep0_trb_addr); dwc 3466 drivers/usb/dwc3/gadget.c int dwc3_gadget_suspend(struct dwc3 *dwc) dwc 3468 drivers/usb/dwc3/gadget.c if (!dwc->gadget_driver) dwc 3471 drivers/usb/dwc3/gadget.c dwc3_gadget_run_stop(dwc, false, false); dwc 3472 drivers/usb/dwc3/gadget.c dwc3_disconnect_gadget(dwc); dwc 3473 drivers/usb/dwc3/gadget.c __dwc3_gadget_stop(dwc); dwc 3478 drivers/usb/dwc3/gadget.c int dwc3_gadget_resume(struct dwc3 *dwc) dwc 3482 drivers/usb/dwc3/gadget.c if (!dwc->gadget_driver) dwc 3485 drivers/usb/dwc3/gadget.c ret = __dwc3_gadget_start(dwc); dwc 3489 drivers/usb/dwc3/gadget.c ret = dwc3_gadget_run_stop(dwc, true, false); dwc 3496 drivers/usb/dwc3/gadget.c __dwc3_gadget_stop(dwc); dwc 3502 drivers/usb/dwc3/gadget.c void dwc3_gadget_process_pending_events(struct dwc3 *dwc) dwc 3504 drivers/usb/dwc3/gadget.c if (dwc->pending_events) { dwc 3505 drivers/usb/dwc3/gadget.c dwc3_interrupt(dwc->irq_gadget, dwc->ev_buf); dwc 3506 drivers/usb/dwc3/gadget.c dwc->pending_events = false; dwc 3507 drivers/usb/dwc3/gadget.c enable_irq(dwc->irq_gadget); dwc 106 drivers/usb/dwc3/gadget.h void dwc3_ep0_interrupt(struct dwc3 *dwc, dwc 108 drivers/usb/dwc3/gadget.h void dwc3_ep0_out_start(struct dwc3 *dwc); dwc 14 drivers/usb/dwc3/host.c static int dwc3_host_get_irq(struct dwc3 *dwc) dwc 16 drivers/usb/dwc3/host.c struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); dwc 44 drivers/usb/dwc3/host.c int dwc3_host_init(struct dwc3 *dwc) dwc 50 drivers/usb/dwc3/host.c struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); dwc 53 drivers/usb/dwc3/host.c irq = dwc3_host_get_irq(dwc); dwc 66 drivers/usb/dwc3/host.c dwc->xhci_resources[1].start = irq; dwc 67 drivers/usb/dwc3/host.c dwc->xhci_resources[1].end = irq; dwc 68 drivers/usb/dwc3/host.c dwc->xhci_resources[1].flags = res->flags; dwc 69 drivers/usb/dwc3/host.c dwc->xhci_resources[1].name = res->name; dwc 73 drivers/usb/dwc3/host.c dev_err(dwc->dev, "couldn't allocate xHCI device\n"); dwc 77 drivers/usb/dwc3/host.c xhci->dev.parent = dwc->dev; dwc 79 drivers/usb/dwc3/host.c dwc->xhci = xhci; dwc 81 drivers/usb/dwc3/host.c ret = platform_device_add_resources(xhci, dwc->xhci_resources, dwc 84 drivers/usb/dwc3/host.c dev_err(dwc->dev, "couldn't add resources to xHCI device\n"); dwc 90 drivers/usb/dwc3/host.c if (dwc->usb3_lpm_capable) dwc 93 drivers/usb/dwc3/host.c if (dwc->usb2_lpm_disable) dwc 105 drivers/usb/dwc3/host.c if (dwc->revision <= DWC3_REVISION_300A) dwc 111 drivers/usb/dwc3/host.c dev_err(dwc->dev, "failed to add properties to xHCI\n"); dwc 118 drivers/usb/dwc3/host.c dev_err(dwc->dev, "failed to register xHCI device\n"); dwc 128 drivers/usb/dwc3/host.c void dwc3_host_exit(struct dwc3 *dwc) dwc 130 drivers/usb/dwc3/host.c platform_device_unregister(dwc->xhci); dwc 50 drivers/usb/dwc3/trace.h TP_PROTO(u32 event, struct dwc3 *dwc), dwc 51 drivers/usb/dwc3/trace.h TP_ARGS(event, dwc), dwc 59 drivers/usb/dwc3/trace.h __entry->ep0state = dwc->ep0state; dwc 67 drivers/usb/dwc3/trace.h TP_PROTO(u32 event, struct dwc3 *dwc), dwc 68 drivers/usb/dwc3/trace.h TP_ARGS(event, dwc) dwc 20 drivers/usb/dwc3/ulpi.c static int dwc3_ulpi_busyloop(struct dwc3 *dwc) dwc 26 drivers/usb/dwc3/ulpi.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYACC(0)); dwc 37 drivers/usb/dwc3/ulpi.c struct dwc3 *dwc = dev_get_drvdata(dev); dwc 41 drivers/usb/dwc3/ulpi.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); dwc 44 drivers/usb/dwc3/ulpi.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); dwc 48 drivers/usb/dwc3/ulpi.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYACC(0), reg); dwc 50 drivers/usb/dwc3/ulpi.c ret = dwc3_ulpi_busyloop(dwc); dwc 54 drivers/usb/dwc3/ulpi.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYACC(0)); dwc 61 drivers/usb/dwc3/ulpi.c struct dwc3 *dwc = dev_get_drvdata(dev); dwc 64 drivers/usb/dwc3/ulpi.c reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); dwc 67 drivers/usb/dwc3/ulpi.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); dwc 72 drivers/usb/dwc3/ulpi.c dwc3_writel(dwc->regs, DWC3_GUSB2PHYACC(0), reg); dwc 74 drivers/usb/dwc3/ulpi.c return dwc3_ulpi_busyloop(dwc); dwc 82 drivers/usb/dwc3/ulpi.c int dwc3_ulpi_init(struct dwc3 *dwc) dwc 85 drivers/usb/dwc3/ulpi.c dwc->ulpi = ulpi_register_interface(dwc->dev, &dwc3_ulpi_ops); dwc 86 drivers/usb/dwc3/ulpi.c if (IS_ERR(dwc->ulpi)) { dwc 87 drivers/usb/dwc3/ulpi.c dev_err(dwc->dev, "failed to register ULPI interface"); dwc 88 drivers/usb/dwc3/ulpi.c return PTR_ERR(dwc->ulpi); dwc 94 drivers/usb/dwc3/ulpi.c void dwc3_ulpi_exit(struct dwc3 *dwc) dwc 96 drivers/usb/dwc3/ulpi.c if (dwc->ulpi) { dwc 97 drivers/usb/dwc3/ulpi.c ulpi_unregister_interface(dwc->ulpi); dwc 98 drivers/usb/dwc3/ulpi.c dwc->ulpi = NULL; dwc 2102 fs/ocfs2/aops.c struct ocfs2_dio_write_ctxt *dwc = NULL; dwc 2107 fs/ocfs2/aops.c dwc = kmalloc(sizeof(struct ocfs2_dio_write_ctxt), GFP_NOFS); dwc 2108 fs/ocfs2/aops.c if (dwc == NULL) dwc 2110 fs/ocfs2/aops.c INIT_LIST_HEAD(&dwc->dw_zero_list); dwc 2111 fs/ocfs2/aops.c dwc->dw_zero_count = 0; dwc 2112 fs/ocfs2/aops.c dwc->dw_orphaned = 0; dwc 2113 fs/ocfs2/aops.c dwc->dw_writer_pid = task_pid_nr(current); dwc 2114 fs/ocfs2/aops.c bh->b_private = dwc; dwc 2117 fs/ocfs2/aops.c return dwc; dwc 2121 fs/ocfs2/aops.c struct ocfs2_dio_write_ctxt *dwc) dwc 2123 fs/ocfs2/aops.c ocfs2_free_unwritten_list(inode, &dwc->dw_zero_list); dwc 2124 fs/ocfs2/aops.c kfree(dwc); dwc 2147 fs/ocfs2/aops.c struct ocfs2_dio_write_ctxt *dwc = NULL; dwc 2195 fs/ocfs2/aops.c dwc = ocfs2_dio_alloc_write_ctx(bh_result, &first_get_block); dwc 2196 fs/ocfs2/aops.c if (unlikely(dwc == NULL)) { dwc 2204 fs/ocfs2/aops.c !dwc->dw_orphaned) { dwc 2215 fs/ocfs2/aops.c dwc->dw_orphaned = 1; dwc 2274 fs/ocfs2/aops.c list_splice_tail_init(&wc->w_unwritten_list, &dwc->dw_zero_list); dwc 2275 fs/ocfs2/aops.c dwc->dw_zero_count += wc->w_unwritten_count; dwc 2292 fs/ocfs2/aops.c struct ocfs2_dio_write_ctxt *dwc, dwc 2313 fs/ocfs2/aops.c if (list_empty(&dwc->dw_zero_list) && dwc 2315 fs/ocfs2/aops.c !dwc->dw_orphaned) dwc 2320 fs/ocfs2/aops.c if (dwc->dw_writer_pid != task_pid_nr(current)) { dwc 2334 fs/ocfs2/aops.c if (dwc->dw_orphaned) { dwc 2335 fs/ocfs2/aops.c BUG_ON(dwc->dw_writer_pid != task_pid_nr(current)); dwc 2355 fs/ocfs2/aops.c ret = ocfs2_lock_allocators(inode, &et, 0, dwc->dw_zero_count*2, dwc 2377 fs/ocfs2/aops.c list_for_each_entry(ue, &dwc->dw_zero_list, ue_node) { dwc 2407 fs/ocfs2/aops.c ocfs2_dio_free_write_ctx(inode, dwc); dwc 826 include/math-emu/op-common.h #define FP_CONV(dfs,sfs,dwc,swc,D,S) \ dwc 828 include/math-emu/op-common.h _FP_FRAC_CONV_##dwc##_##swc(dfs, sfs, D, S); \