Lines Matching +full:- +full:chn +full:- +full:disabled

1 // SPDX-License-Identifier: GPL-2.0
3 * debugfs.c - DesignWare USB3 DRD Controller DebugFS file
5 * Copyright (C) 2010-2011 Texas Instruments Incorporated - https://www.ti.com
287 struct dwc3 *dwc = s->private; in dwc3_host_lsp()
293 dbc_enabled = !!(dwc->hwparams.hwparams1 & DWC3_GHWPARAMS1_ENDBC); in dwc3_host_lsp()
295 sel = dwc->dbg_lsp_select; in dwc3_host_lsp()
303 dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg); in dwc3_host_lsp()
304 val = dwc3_readl(dwc->regs, DWC3_GDBGLSP); in dwc3_host_lsp()
309 dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg); in dwc3_host_lsp()
310 val = dwc3_readl(dwc->regs, DWC3_GDBGLSP); in dwc3_host_lsp()
317 struct dwc3 *dwc = s->private; in dwc3_gadget_lsp()
323 dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg); in dwc3_gadget_lsp()
324 reg = dwc3_readl(dwc->regs, DWC3_GDBGLSP); in dwc3_gadget_lsp()
331 struct dwc3 *dwc = s->private; in dwc3_lsp_show()
337 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_lsp_show()
341 spin_lock_irqsave(&dwc->lock, flags); in dwc3_lsp_show()
342 reg = dwc3_readl(dwc->regs, DWC3_GSTS); in dwc3_lsp_show()
356 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_lsp_show()
358 pm_runtime_put_sync(dwc->dev); in dwc3_lsp_show()
365 return single_open(file, dwc3_lsp_show, inode->i_private); in dwc3_lsp_open()
371 struct seq_file *s = file->private_data; in dwc3_lsp_write()
372 struct dwc3 *dwc = s->private; in dwc3_lsp_write()
378 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) in dwc3_lsp_write()
379 return -EFAULT; in dwc3_lsp_write()
385 spin_lock_irqsave(&dwc->lock, flags); in dwc3_lsp_write()
386 dwc->dbg_lsp_select = sel; in dwc3_lsp_write()
387 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_lsp_write()
402 struct dwc3 *dwc = s->private; in dwc3_mode_show()
407 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_mode_show()
411 spin_lock_irqsave(&dwc->lock, flags); in dwc3_mode_show()
412 reg = dwc3_readl(dwc->regs, DWC3_GCTL); in dwc3_mode_show()
413 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_mode_show()
429 pm_runtime_put_sync(dwc->dev); in dwc3_mode_show()
436 return single_open(file, dwc3_mode_show, inode->i_private); in dwc3_mode_open()
442 struct seq_file *s = file->private_data; in dwc3_mode_write()
443 struct dwc3 *dwc = s->private; in dwc3_mode_write()
447 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) in dwc3_mode_write()
448 return -EFAULT; in dwc3_mode_write()
450 if (dwc->dr_mode != USB_DR_MODE_OTG) in dwc3_mode_write()
477 struct dwc3 *dwc = s->private; in dwc3_testmode_show()
482 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_testmode_show()
486 spin_lock_irqsave(&dwc->lock, flags); in dwc3_testmode_show()
487 reg = dwc3_readl(dwc->regs, DWC3_DCTL); in dwc3_testmode_show()
490 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_testmode_show()
515 pm_runtime_put_sync(dwc->dev); in dwc3_testmode_show()
522 return single_open(file, dwc3_testmode_show, inode->i_private); in dwc3_testmode_open()
528 struct seq_file *s = file->private_data; in dwc3_testmode_write()
529 struct dwc3 *dwc = s->private; in dwc3_testmode_write()
535 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) in dwc3_testmode_write()
536 return -EFAULT; in dwc3_testmode_write()
551 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_testmode_write()
555 spin_lock_irqsave(&dwc->lock, flags); in dwc3_testmode_write()
557 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_testmode_write()
559 pm_runtime_put_sync(dwc->dev); in dwc3_testmode_write()
574 struct dwc3 *dwc = s->private; in dwc3_link_state_show()
581 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_link_state_show()
585 spin_lock_irqsave(&dwc->lock, flags); in dwc3_link_state_show()
586 reg = dwc3_readl(dwc->regs, DWC3_GSTS); in dwc3_link_state_show()
589 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_link_state_show()
590 pm_runtime_put_sync(dwc->dev); in dwc3_link_state_show()
594 reg = dwc3_readl(dwc->regs, DWC3_DSTS); in dwc3_link_state_show()
601 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_link_state_show()
603 pm_runtime_put_sync(dwc->dev); in dwc3_link_state_show()
610 return single_open(file, dwc3_link_state_show, inode->i_private); in dwc3_link_state_open()
616 struct seq_file *s = file->private_data; in dwc3_link_state_write()
617 struct dwc3 *dwc = s->private; in dwc3_link_state_write()
625 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) in dwc3_link_state_write()
626 return -EFAULT; in dwc3_link_state_write()
628 if (!strncmp(buf, "SS.Disabled", 11)) in dwc3_link_state_write()
641 return -EINVAL; in dwc3_link_state_write()
643 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_link_state_write()
647 spin_lock_irqsave(&dwc->lock, flags); in dwc3_link_state_write()
648 reg = dwc3_readl(dwc->regs, DWC3_GSTS); in dwc3_link_state_write()
650 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_link_state_write()
651 pm_runtime_put_sync(dwc->dev); in dwc3_link_state_write()
652 return -EINVAL; in dwc3_link_state_write()
655 reg = dwc3_readl(dwc->regs, DWC3_DSTS); in dwc3_link_state_write()
660 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_link_state_write()
661 pm_runtime_put_sync(dwc->dev); in dwc3_link_state_write()
662 return -EINVAL; in dwc3_link_state_write()
666 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_link_state_write()
668 pm_runtime_put_sync(dwc->dev); in dwc3_link_state_write()
688 struct dwc3_ep *dep = s->private; in dwc3_tx_fifo_size_show()
689 struct dwc3 *dwc = dep->dwc; in dwc3_tx_fifo_size_show()
695 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_tx_fifo_size_show()
699 spin_lock_irqsave(&dwc->lock, flags); in dwc3_tx_fifo_size_show()
708 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_tx_fifo_size_show()
710 pm_runtime_put_sync(dwc->dev); in dwc3_tx_fifo_size_show()
717 struct dwc3_ep *dep = s->private; in dwc3_rx_fifo_size_show()
718 struct dwc3 *dwc = dep->dwc; in dwc3_rx_fifo_size_show()
724 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_rx_fifo_size_show()
728 spin_lock_irqsave(&dwc->lock, flags); in dwc3_rx_fifo_size_show()
737 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_rx_fifo_size_show()
739 pm_runtime_put_sync(dwc->dev); in dwc3_rx_fifo_size_show()
746 struct dwc3_ep *dep = s->private; in dwc3_tx_request_queue_show()
747 struct dwc3 *dwc = dep->dwc; in dwc3_tx_request_queue_show()
752 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_tx_request_queue_show()
756 spin_lock_irqsave(&dwc->lock, flags); in dwc3_tx_request_queue_show()
759 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_tx_request_queue_show()
761 pm_runtime_put_sync(dwc->dev); in dwc3_tx_request_queue_show()
768 struct dwc3_ep *dep = s->private; in dwc3_rx_request_queue_show()
769 struct dwc3 *dwc = dep->dwc; in dwc3_rx_request_queue_show()
774 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_rx_request_queue_show()
778 spin_lock_irqsave(&dwc->lock, flags); in dwc3_rx_request_queue_show()
781 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_rx_request_queue_show()
783 pm_runtime_put_sync(dwc->dev); in dwc3_rx_request_queue_show()
790 struct dwc3_ep *dep = s->private; in dwc3_rx_info_queue_show()
791 struct dwc3 *dwc = dep->dwc; in dwc3_rx_info_queue_show()
796 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_rx_info_queue_show()
800 spin_lock_irqsave(&dwc->lock, flags); in dwc3_rx_info_queue_show()
803 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_rx_info_queue_show()
805 pm_runtime_put_sync(dwc->dev); in dwc3_rx_info_queue_show()
812 struct dwc3_ep *dep = s->private; in dwc3_descriptor_fetch_queue_show()
813 struct dwc3 *dwc = dep->dwc; in dwc3_descriptor_fetch_queue_show()
818 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_descriptor_fetch_queue_show()
822 spin_lock_irqsave(&dwc->lock, flags); in dwc3_descriptor_fetch_queue_show()
825 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_descriptor_fetch_queue_show()
827 pm_runtime_put_sync(dwc->dev); in dwc3_descriptor_fetch_queue_show()
834 struct dwc3_ep *dep = s->private; in dwc3_event_queue_show()
835 struct dwc3 *dwc = dep->dwc; in dwc3_event_queue_show()
840 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_event_queue_show()
844 spin_lock_irqsave(&dwc->lock, flags); in dwc3_event_queue_show()
847 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_event_queue_show()
849 pm_runtime_put_sync(dwc->dev); in dwc3_event_queue_show()
856 struct dwc3_ep *dep = s->private; in dwc3_transfer_type_show()
857 struct dwc3 *dwc = dep->dwc; in dwc3_transfer_type_show()
860 spin_lock_irqsave(&dwc->lock, flags); in dwc3_transfer_type_show()
861 if (!(dep->flags & DWC3_EP_ENABLED) || !dep->endpoint.desc) { in dwc3_transfer_type_show()
862 seq_puts(s, "--\n"); in dwc3_transfer_type_show()
866 switch (usb_endpoint_type(dep->endpoint.desc)) { in dwc3_transfer_type_show()
880 seq_puts(s, "--\n"); in dwc3_transfer_type_show()
884 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_transfer_type_show()
891 struct dwc3_ep *dep = s->private; in dwc3_trb_ring_show()
892 struct dwc3 *dwc = dep->dwc; in dwc3_trb_ring_show()
897 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_trb_ring_show()
901 spin_lock_irqsave(&dwc->lock, flags); in dwc3_trb_ring_show()
902 if (dep->number <= 1) { in dwc3_trb_ring_show()
903 seq_puts(s, "--\n"); in dwc3_trb_ring_show()
907 seq_puts(s, "buffer_addr,size,type,ioc,isp_imi,csp,chn,lst,hwo\n"); in dwc3_trb_ring_show()
910 struct dwc3_trb *trb = &dep->trb_pool[i]; in dwc3_trb_ring_show()
911 unsigned int type = DWC3_TRBCTL_TYPE(trb->ctrl); in dwc3_trb_ring_show()
914 trb->bph, trb->bpl, trb->size, in dwc3_trb_ring_show()
916 !!(trb->ctrl & DWC3_TRB_CTRL_IOC), in dwc3_trb_ring_show()
917 !!(trb->ctrl & DWC3_TRB_CTRL_ISP_IMI), in dwc3_trb_ring_show()
918 !!(trb->ctrl & DWC3_TRB_CTRL_CSP), in dwc3_trb_ring_show()
919 !!(trb->ctrl & DWC3_TRB_CTRL_CHN), in dwc3_trb_ring_show()
920 !!(trb->ctrl & DWC3_TRB_CTRL_LST), in dwc3_trb_ring_show()
921 !!(trb->ctrl & DWC3_TRB_CTRL_HWO), in dwc3_trb_ring_show()
922 dep->trb_enqueue == i ? 'E' : ' ', in dwc3_trb_ring_show()
923 dep->trb_dequeue == i ? 'D' : ' '); in dwc3_trb_ring_show()
927 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_trb_ring_show()
929 pm_runtime_put_sync(dwc->dev); in dwc3_trb_ring_show()
936 struct dwc3_ep *dep = s->private; in dwc3_ep_info_register_show()
937 struct dwc3 *dwc = dep->dwc; in dwc3_ep_info_register_show()
945 ret = pm_runtime_resume_and_get(dwc->dev); in dwc3_ep_info_register_show()
949 spin_lock_irqsave(&dwc->lock, flags); in dwc3_ep_info_register_show()
950 reg = DWC3_GDBGLSPMUX_EPSELECT(dep->number); in dwc3_ep_info_register_show()
951 dwc3_writel(dwc->regs, DWC3_GDBGLSPMUX, reg); in dwc3_ep_info_register_show()
953 lower_32_bits = dwc3_readl(dwc->regs, DWC3_GDBGEPINFO0); in dwc3_ep_info_register_show()
954 upper_32_bits = dwc3_readl(dwc->regs, DWC3_GDBGEPINFO1); in dwc3_ep_info_register_show()
958 spin_unlock_irqrestore(&dwc->lock, flags); in dwc3_ep_info_register_show()
960 pm_runtime_put_sync(dwc->dev); in dwc3_ep_info_register_show()
994 dir = debugfs_create_dir(dep->name, dep->dwc->debug_root); in dwc3_debugfs_create_endpoint_dir()
1005 debugfs_lookup_and_remove(dep->name, dep->dwc->debug_root); in dwc3_debugfs_remove_endpoint_dir()
1012 dwc->regset = kzalloc(sizeof(*dwc->regset), GFP_KERNEL); in dwc3_debugfs_init()
1013 if (!dwc->regset) in dwc3_debugfs_init()
1016 dwc->dbg_lsp_select = DWC3_LSP_MUX_UNSELECTED; in dwc3_debugfs_init()
1018 dwc->regset->regs = dwc3_regs; in dwc3_debugfs_init()
1019 dwc->regset->nregs = ARRAY_SIZE(dwc3_regs); in dwc3_debugfs_init()
1020 dwc->regset->base = dwc->regs - DWC3_GLOBALS_REGS_START; in dwc3_debugfs_init()
1021 dwc->regset->dev = dwc->dev; in dwc3_debugfs_init()
1023 root = debugfs_create_dir(dev_name(dwc->dev), usb_debug_root); in dwc3_debugfs_init()
1024 dwc->debug_root = root; in dwc3_debugfs_init()
1025 debugfs_create_regset32("regdump", 0444, root, dwc->regset); in dwc3_debugfs_init()
1043 debugfs_lookup_and_remove(dev_name(dwc->dev), usb_debug_root); in dwc3_debugfs_exit()
1044 kfree(dwc->regset); in dwc3_debugfs_exit()