Linux Audio

Check our new training course

Loading...
v6.8
 1// SPDX-License-Identifier: GPL-2.0+
 2/*
 3 * Freescale QUICC Engine USB Host Controller Driver
 4 *
 5 * Copyright (c) Freescale Semicondutor, Inc. 2006.
 6 *               Shlomi Gridish <gridish@freescale.com>
 7 *               Jerry Huang <Chang-Ming.Huang@freescale.com>
 8 * Copyright (c) Logic Product Development, Inc. 2007
 9 *               Peter Barada <peterb@logicpd.com>
10 * Copyright (c) MontaVista Software, Inc. 2008.
11 *               Anton Vorontsov <avorontsov@ru.mvista.com>
12 */
13
14#include <linux/kernel.h>
15#include <linux/errno.h>
16#include <linux/debugfs.h>
17#include <linux/seq_file.h>
18#include <linux/usb.h>
19#include <linux/usb/hcd.h>
20#include "fhci.h"
21
22void fhci_dbg_isr(struct fhci_hcd *fhci, int usb_er)
23{
24	int i;
25
26	if (usb_er == -1) {
27		fhci->usb_irq_stat[12]++;
28		return;
29	}
30
31	for (i = 0; i < 12; ++i) {
32		if (usb_er & (1 << i))
33			fhci->usb_irq_stat[i]++;
34	}
35}
36
37static int fhci_dfs_regs_show(struct seq_file *s, void *v)
38{
39	struct fhci_hcd *fhci = s->private;
40	struct qe_usb_ctlr __iomem *regs = fhci->regs;
41
42	seq_printf(s,
43		"mode: 0x%x\n" "addr: 0x%x\n"
44		"command: 0x%x\n" "ep0: 0x%x\n"
45		"event: 0x%x\n" "mask: 0x%x\n"
46		"status: 0x%x\n" "SOF timer: %d\n"
47		"frame number: %d\n"
48		"lines status: 0x%x\n",
49		in_8(&regs->usb_usmod), in_8(&regs->usb_usadr),
50		in_8(&regs->usb_uscom), in_be16(&regs->usb_usep[0]),
51		in_be16(&regs->usb_usber), in_be16(&regs->usb_usbmr),
52		in_8(&regs->usb_usbs), in_be16(&regs->usb_ussft),
53		in_be16(&regs->usb_usfrn),
54		fhci_ioports_check_bus_state(fhci));
55
56	return 0;
57}
58DEFINE_SHOW_ATTRIBUTE(fhci_dfs_regs);
59
60static int fhci_dfs_irq_stat_show(struct seq_file *s, void *v)
61{
62	struct fhci_hcd *fhci = s->private;
63	int *usb_irq_stat = fhci->usb_irq_stat;
64
65	seq_printf(s,
66		"RXB: %d\n" "TXB: %d\n" "BSY: %d\n"
67		"SOF: %d\n" "TXE0: %d\n" "TXE1: %d\n"
68		"TXE2: %d\n" "TXE3: %d\n" "IDLE: %d\n"
69		"RESET: %d\n" "SFT: %d\n" "MSF: %d\n"
70		"IDLE_ONLY: %d\n",
71		usb_irq_stat[0], usb_irq_stat[1], usb_irq_stat[2],
72		usb_irq_stat[3], usb_irq_stat[4], usb_irq_stat[5],
73		usb_irq_stat[6], usb_irq_stat[7], usb_irq_stat[8],
74		usb_irq_stat[9], usb_irq_stat[10], usb_irq_stat[11],
75		usb_irq_stat[12]);
76
77	return 0;
78}
79DEFINE_SHOW_ATTRIBUTE(fhci_dfs_irq_stat);
80
81void fhci_dfs_create(struct fhci_hcd *fhci)
82{
83	struct device *dev = fhci_to_hcd(fhci)->self.controller;
84
85	fhci->dfs_root = debugfs_create_dir(dev_name(dev), usb_debug_root);
 
 
 
 
86
87	debugfs_create_file("regs", S_IFREG | S_IRUGO, fhci->dfs_root, fhci,
88			    &fhci_dfs_regs_fops);
89	debugfs_create_file("irq_stat", S_IFREG | S_IRUGO, fhci->dfs_root, fhci,
90			    &fhci_dfs_irq_stat_fops);
 
 
 
 
91}
92
93void fhci_dfs_destroy(struct fhci_hcd *fhci)
94{
95	debugfs_remove_recursive(fhci->dfs_root);
 
 
 
 
 
96}
v4.17
  1// SPDX-License-Identifier: GPL-2.0+
  2/*
  3 * Freescale QUICC Engine USB Host Controller Driver
  4 *
  5 * Copyright (c) Freescale Semicondutor, Inc. 2006.
  6 *               Shlomi Gridish <gridish@freescale.com>
  7 *               Jerry Huang <Chang-Ming.Huang@freescale.com>
  8 * Copyright (c) Logic Product Development, Inc. 2007
  9 *               Peter Barada <peterb@logicpd.com>
 10 * Copyright (c) MontaVista Software, Inc. 2008.
 11 *               Anton Vorontsov <avorontsov@ru.mvista.com>
 12 */
 13
 14#include <linux/kernel.h>
 15#include <linux/errno.h>
 16#include <linux/debugfs.h>
 17#include <linux/seq_file.h>
 18#include <linux/usb.h>
 19#include <linux/usb/hcd.h>
 20#include "fhci.h"
 21
 22void fhci_dbg_isr(struct fhci_hcd *fhci, int usb_er)
 23{
 24	int i;
 25
 26	if (usb_er == -1) {
 27		fhci->usb_irq_stat[12]++;
 28		return;
 29	}
 30
 31	for (i = 0; i < 12; ++i) {
 32		if (usb_er & (1 << i))
 33			fhci->usb_irq_stat[i]++;
 34	}
 35}
 36
 37static int fhci_dfs_regs_show(struct seq_file *s, void *v)
 38{
 39	struct fhci_hcd *fhci = s->private;
 40	struct qe_usb_ctlr __iomem *regs = fhci->regs;
 41
 42	seq_printf(s,
 43		"mode: 0x%x\n" "addr: 0x%x\n"
 44		"command: 0x%x\n" "ep0: 0x%x\n"
 45		"event: 0x%x\n" "mask: 0x%x\n"
 46		"status: 0x%x\n" "SOF timer: %d\n"
 47		"frame number: %d\n"
 48		"lines status: 0x%x\n",
 49		in_8(&regs->usb_usmod), in_8(&regs->usb_usadr),
 50		in_8(&regs->usb_uscom), in_be16(&regs->usb_usep[0]),
 51		in_be16(&regs->usb_usber), in_be16(&regs->usb_usbmr),
 52		in_8(&regs->usb_usbs), in_be16(&regs->usb_ussft),
 53		in_be16(&regs->usb_usfrn),
 54		fhci_ioports_check_bus_state(fhci));
 55
 56	return 0;
 57}
 58DEFINE_SHOW_ATTRIBUTE(fhci_dfs_regs);
 59
 60static int fhci_dfs_irq_stat_show(struct seq_file *s, void *v)
 61{
 62	struct fhci_hcd *fhci = s->private;
 63	int *usb_irq_stat = fhci->usb_irq_stat;
 64
 65	seq_printf(s,
 66		"RXB: %d\n" "TXB: %d\n" "BSY: %d\n"
 67		"SOF: %d\n" "TXE0: %d\n" "TXE1: %d\n"
 68		"TXE2: %d\n" "TXE3: %d\n" "IDLE: %d\n"
 69		"RESET: %d\n" "SFT: %d\n" "MSF: %d\n"
 70		"IDLE_ONLY: %d\n",
 71		usb_irq_stat[0], usb_irq_stat[1], usb_irq_stat[2],
 72		usb_irq_stat[3], usb_irq_stat[4], usb_irq_stat[5],
 73		usb_irq_stat[6], usb_irq_stat[7], usb_irq_stat[8],
 74		usb_irq_stat[9], usb_irq_stat[10], usb_irq_stat[11],
 75		usb_irq_stat[12]);
 76
 77	return 0;
 78}
 79DEFINE_SHOW_ATTRIBUTE(fhci_dfs_irq_stat);
 80
 81void fhci_dfs_create(struct fhci_hcd *fhci)
 82{
 83	struct device *dev = fhci_to_hcd(fhci)->self.controller;
 84
 85	fhci->dfs_root = debugfs_create_dir(dev_name(dev), usb_debug_root);
 86	if (!fhci->dfs_root) {
 87		WARN_ON(1);
 88		return;
 89	}
 90
 91	fhci->dfs_regs = debugfs_create_file("regs", S_IFREG | S_IRUGO,
 92		fhci->dfs_root, fhci, &fhci_dfs_regs_fops);
 93
 94	fhci->dfs_irq_stat = debugfs_create_file("irq_stat",
 95		S_IFREG | S_IRUGO, fhci->dfs_root, fhci,
 96		&fhci_dfs_irq_stat_fops);
 97
 98	WARN_ON(!fhci->dfs_regs || !fhci->dfs_irq_stat);
 99}
100
101void fhci_dfs_destroy(struct fhci_hcd *fhci)
102{
103	if (!fhci->dfs_root)
104		return;
105
106	debugfs_remove(fhci->dfs_irq_stat);
107	debugfs_remove(fhci->dfs_regs);
108	debugfs_remove(fhci->dfs_root);
109}