1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * debugfs.c - Designware USB2 DRD controller debugfs
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Copyright (C) 2015 Intel Corporation
6*4882a593Smuzhiyun * Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
7*4882a593Smuzhiyun */
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun #include <linux/spinlock.h>
10*4882a593Smuzhiyun #include <linux/debugfs.h>
11*4882a593Smuzhiyun #include <linux/seq_file.h>
12*4882a593Smuzhiyun #include <linux/uaccess.h>
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun #include "core.h"
15*4882a593Smuzhiyun #include "debug.h"
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun #if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \
18*4882a593Smuzhiyun IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun /**
21*4882a593Smuzhiyun * testmode_write() - change usb test mode state.
22*4882a593Smuzhiyun * @file: The file to write to.
23*4882a593Smuzhiyun * @ubuf: The buffer where user wrote.
24*4882a593Smuzhiyun * @count: The ubuf size.
25*4882a593Smuzhiyun * @ppos: Unused parameter.
26*4882a593Smuzhiyun */
testmode_write(struct file * file,const char __user * ubuf,size_t count,loff_t * ppos)27*4882a593Smuzhiyun static ssize_t testmode_write(struct file *file, const char __user *ubuf, size_t
28*4882a593Smuzhiyun count, loff_t *ppos)
29*4882a593Smuzhiyun {
30*4882a593Smuzhiyun struct seq_file *s = file->private_data;
31*4882a593Smuzhiyun struct dwc2_hsotg *hsotg = s->private;
32*4882a593Smuzhiyun unsigned long flags;
33*4882a593Smuzhiyun u32 testmode = 0;
34*4882a593Smuzhiyun char buf[32];
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
37*4882a593Smuzhiyun return -EFAULT;
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun if (!strncmp(buf, "test_j", 6))
40*4882a593Smuzhiyun testmode = USB_TEST_J;
41*4882a593Smuzhiyun else if (!strncmp(buf, "test_k", 6))
42*4882a593Smuzhiyun testmode = USB_TEST_K;
43*4882a593Smuzhiyun else if (!strncmp(buf, "test_se0_nak", 12))
44*4882a593Smuzhiyun testmode = USB_TEST_SE0_NAK;
45*4882a593Smuzhiyun else if (!strncmp(buf, "test_packet", 11))
46*4882a593Smuzhiyun testmode = USB_TEST_PACKET;
47*4882a593Smuzhiyun else if (!strncmp(buf, "test_force_enable", 17))
48*4882a593Smuzhiyun testmode = USB_TEST_FORCE_ENABLE;
49*4882a593Smuzhiyun else
50*4882a593Smuzhiyun testmode = 0;
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun spin_lock_irqsave(&hsotg->lock, flags);
53*4882a593Smuzhiyun dwc2_hsotg_set_test_mode(hsotg, testmode);
54*4882a593Smuzhiyun spin_unlock_irqrestore(&hsotg->lock, flags);
55*4882a593Smuzhiyun return count;
56*4882a593Smuzhiyun }
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun /**
59*4882a593Smuzhiyun * testmode_show() - debugfs: show usb test mode state
60*4882a593Smuzhiyun * @s: The seq file to write to.
61*4882a593Smuzhiyun * @unused: Unused parameter.
62*4882a593Smuzhiyun *
63*4882a593Smuzhiyun * This debugfs entry shows which usb test mode is currently enabled.
64*4882a593Smuzhiyun */
testmode_show(struct seq_file * s,void * unused)65*4882a593Smuzhiyun static int testmode_show(struct seq_file *s, void *unused)
66*4882a593Smuzhiyun {
67*4882a593Smuzhiyun struct dwc2_hsotg *hsotg = s->private;
68*4882a593Smuzhiyun unsigned long flags;
69*4882a593Smuzhiyun int dctl;
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun spin_lock_irqsave(&hsotg->lock, flags);
72*4882a593Smuzhiyun dctl = dwc2_readl(hsotg, DCTL);
73*4882a593Smuzhiyun dctl &= DCTL_TSTCTL_MASK;
74*4882a593Smuzhiyun dctl >>= DCTL_TSTCTL_SHIFT;
75*4882a593Smuzhiyun spin_unlock_irqrestore(&hsotg->lock, flags);
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun switch (dctl) {
78*4882a593Smuzhiyun case 0:
79*4882a593Smuzhiyun seq_puts(s, "no test\n");
80*4882a593Smuzhiyun break;
81*4882a593Smuzhiyun case USB_TEST_J:
82*4882a593Smuzhiyun seq_puts(s, "test_j\n");
83*4882a593Smuzhiyun break;
84*4882a593Smuzhiyun case USB_TEST_K:
85*4882a593Smuzhiyun seq_puts(s, "test_k\n");
86*4882a593Smuzhiyun break;
87*4882a593Smuzhiyun case USB_TEST_SE0_NAK:
88*4882a593Smuzhiyun seq_puts(s, "test_se0_nak\n");
89*4882a593Smuzhiyun break;
90*4882a593Smuzhiyun case USB_TEST_PACKET:
91*4882a593Smuzhiyun seq_puts(s, "test_packet\n");
92*4882a593Smuzhiyun break;
93*4882a593Smuzhiyun case USB_TEST_FORCE_ENABLE:
94*4882a593Smuzhiyun seq_puts(s, "test_force_enable\n");
95*4882a593Smuzhiyun break;
96*4882a593Smuzhiyun default:
97*4882a593Smuzhiyun seq_printf(s, "UNKNOWN %d\n", dctl);
98*4882a593Smuzhiyun }
99*4882a593Smuzhiyun
100*4882a593Smuzhiyun return 0;
101*4882a593Smuzhiyun }
102*4882a593Smuzhiyun
testmode_open(struct inode * inode,struct file * file)103*4882a593Smuzhiyun static int testmode_open(struct inode *inode, struct file *file)
104*4882a593Smuzhiyun {
105*4882a593Smuzhiyun return single_open(file, testmode_show, inode->i_private);
106*4882a593Smuzhiyun }
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun static const struct file_operations testmode_fops = {
109*4882a593Smuzhiyun .owner = THIS_MODULE,
110*4882a593Smuzhiyun .open = testmode_open,
111*4882a593Smuzhiyun .write = testmode_write,
112*4882a593Smuzhiyun .read = seq_read,
113*4882a593Smuzhiyun .llseek = seq_lseek,
114*4882a593Smuzhiyun .release = single_release,
115*4882a593Smuzhiyun };
116*4882a593Smuzhiyun
117*4882a593Smuzhiyun /**
118*4882a593Smuzhiyun * state_show - debugfs: show overall driver and device state.
119*4882a593Smuzhiyun * @seq: The seq file to write to.
120*4882a593Smuzhiyun * @v: Unused parameter.
121*4882a593Smuzhiyun *
122*4882a593Smuzhiyun * This debugfs entry shows the overall state of the hardware and
123*4882a593Smuzhiyun * some general information about each of the endpoints available
124*4882a593Smuzhiyun * to the system.
125*4882a593Smuzhiyun */
state_show(struct seq_file * seq,void * v)126*4882a593Smuzhiyun static int state_show(struct seq_file *seq, void *v)
127*4882a593Smuzhiyun {
128*4882a593Smuzhiyun struct dwc2_hsotg *hsotg = seq->private;
129*4882a593Smuzhiyun int idx;
130*4882a593Smuzhiyun
131*4882a593Smuzhiyun seq_printf(seq, "DCFG=0x%08x, DCTL=0x%08x, DSTS=0x%08x\n",
132*4882a593Smuzhiyun dwc2_readl(hsotg, DCFG),
133*4882a593Smuzhiyun dwc2_readl(hsotg, DCTL),
134*4882a593Smuzhiyun dwc2_readl(hsotg, DSTS));
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun seq_printf(seq, "DIEPMSK=0x%08x, DOEPMASK=0x%08x\n",
137*4882a593Smuzhiyun dwc2_readl(hsotg, DIEPMSK), dwc2_readl(hsotg, DOEPMSK));
138*4882a593Smuzhiyun
139*4882a593Smuzhiyun seq_printf(seq, "GINTMSK=0x%08x, GINTSTS=0x%08x\n",
140*4882a593Smuzhiyun dwc2_readl(hsotg, GINTMSK),
141*4882a593Smuzhiyun dwc2_readl(hsotg, GINTSTS));
142*4882a593Smuzhiyun
143*4882a593Smuzhiyun seq_printf(seq, "DAINTMSK=0x%08x, DAINT=0x%08x\n",
144*4882a593Smuzhiyun dwc2_readl(hsotg, DAINTMSK),
145*4882a593Smuzhiyun dwc2_readl(hsotg, DAINT));
146*4882a593Smuzhiyun
147*4882a593Smuzhiyun seq_printf(seq, "GNPTXSTS=0x%08x, GRXSTSR=%08x\n",
148*4882a593Smuzhiyun dwc2_readl(hsotg, GNPTXSTS),
149*4882a593Smuzhiyun dwc2_readl(hsotg, GRXSTSR));
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun seq_puts(seq, "\nEndpoint status:\n");
152*4882a593Smuzhiyun
153*4882a593Smuzhiyun for (idx = 0; idx < hsotg->num_of_eps; idx++) {
154*4882a593Smuzhiyun u32 in, out;
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun in = dwc2_readl(hsotg, DIEPCTL(idx));
157*4882a593Smuzhiyun out = dwc2_readl(hsotg, DOEPCTL(idx));
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun seq_printf(seq, "ep%d: DIEPCTL=0x%08x, DOEPCTL=0x%08x",
160*4882a593Smuzhiyun idx, in, out);
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun in = dwc2_readl(hsotg, DIEPTSIZ(idx));
163*4882a593Smuzhiyun out = dwc2_readl(hsotg, DOEPTSIZ(idx));
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun seq_printf(seq, ", DIEPTSIZ=0x%08x, DOEPTSIZ=0x%08x",
166*4882a593Smuzhiyun in, out);
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun seq_puts(seq, "\n");
169*4882a593Smuzhiyun }
170*4882a593Smuzhiyun
171*4882a593Smuzhiyun return 0;
172*4882a593Smuzhiyun }
173*4882a593Smuzhiyun DEFINE_SHOW_ATTRIBUTE(state);
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun /**
176*4882a593Smuzhiyun * fifo_show - debugfs: show the fifo information
177*4882a593Smuzhiyun * @seq: The seq_file to write data to.
178*4882a593Smuzhiyun * @v: Unused parameter.
179*4882a593Smuzhiyun *
180*4882a593Smuzhiyun * Show the FIFO information for the overall fifo and all the
181*4882a593Smuzhiyun * periodic transmission FIFOs.
182*4882a593Smuzhiyun */
fifo_show(struct seq_file * seq,void * v)183*4882a593Smuzhiyun static int fifo_show(struct seq_file *seq, void *v)
184*4882a593Smuzhiyun {
185*4882a593Smuzhiyun struct dwc2_hsotg *hsotg = seq->private;
186*4882a593Smuzhiyun int fifo_count = dwc2_hsotg_tx_fifo_count(hsotg);
187*4882a593Smuzhiyun u32 val;
188*4882a593Smuzhiyun int idx;
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun seq_puts(seq, "Non-periodic FIFOs:\n");
191*4882a593Smuzhiyun seq_printf(seq, "RXFIFO: Size %d\n", dwc2_readl(hsotg, GRXFSIZ));
192*4882a593Smuzhiyun
193*4882a593Smuzhiyun val = dwc2_readl(hsotg, GNPTXFSIZ);
194*4882a593Smuzhiyun seq_printf(seq, "NPTXFIFO: Size %d, Start 0x%08x\n",
195*4882a593Smuzhiyun val >> FIFOSIZE_DEPTH_SHIFT,
196*4882a593Smuzhiyun val & FIFOSIZE_STARTADDR_MASK);
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun seq_puts(seq, "\nPeriodic TXFIFOs:\n");
199*4882a593Smuzhiyun
200*4882a593Smuzhiyun for (idx = 1; idx <= fifo_count; idx++) {
201*4882a593Smuzhiyun val = dwc2_readl(hsotg, DPTXFSIZN(idx));
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun seq_printf(seq, "\tDPTXFIFO%2d: Size %d, Start 0x%08x\n", idx,
204*4882a593Smuzhiyun val >> FIFOSIZE_DEPTH_SHIFT,
205*4882a593Smuzhiyun val & FIFOSIZE_STARTADDR_MASK);
206*4882a593Smuzhiyun }
207*4882a593Smuzhiyun
208*4882a593Smuzhiyun return 0;
209*4882a593Smuzhiyun }
210*4882a593Smuzhiyun DEFINE_SHOW_ATTRIBUTE(fifo);
211*4882a593Smuzhiyun
decode_direction(int is_in)212*4882a593Smuzhiyun static const char *decode_direction(int is_in)
213*4882a593Smuzhiyun {
214*4882a593Smuzhiyun return is_in ? "in" : "out";
215*4882a593Smuzhiyun }
216*4882a593Smuzhiyun
217*4882a593Smuzhiyun /**
218*4882a593Smuzhiyun * ep_show - debugfs: show the state of an endpoint.
219*4882a593Smuzhiyun * @seq: The seq_file to write data to.
220*4882a593Smuzhiyun * @v: Unused parameter.
221*4882a593Smuzhiyun *
222*4882a593Smuzhiyun * This debugfs entry shows the state of the given endpoint (one is
223*4882a593Smuzhiyun * registered for each available).
224*4882a593Smuzhiyun */
ep_show(struct seq_file * seq,void * v)225*4882a593Smuzhiyun static int ep_show(struct seq_file *seq, void *v)
226*4882a593Smuzhiyun {
227*4882a593Smuzhiyun struct dwc2_hsotg_ep *ep = seq->private;
228*4882a593Smuzhiyun struct dwc2_hsotg *hsotg = ep->parent;
229*4882a593Smuzhiyun struct dwc2_hsotg_req *req;
230*4882a593Smuzhiyun int index = ep->index;
231*4882a593Smuzhiyun int show_limit = 15;
232*4882a593Smuzhiyun unsigned long flags;
233*4882a593Smuzhiyun
234*4882a593Smuzhiyun seq_printf(seq, "Endpoint index %d, named %s, dir %s:\n",
235*4882a593Smuzhiyun ep->index, ep->ep.name, decode_direction(ep->dir_in));
236*4882a593Smuzhiyun
237*4882a593Smuzhiyun /* first show the register state */
238*4882a593Smuzhiyun
239*4882a593Smuzhiyun seq_printf(seq, "\tDIEPCTL=0x%08x, DOEPCTL=0x%08x\n",
240*4882a593Smuzhiyun dwc2_readl(hsotg, DIEPCTL(index)),
241*4882a593Smuzhiyun dwc2_readl(hsotg, DOEPCTL(index)));
242*4882a593Smuzhiyun
243*4882a593Smuzhiyun seq_printf(seq, "\tDIEPDMA=0x%08x, DOEPDMA=0x%08x\n",
244*4882a593Smuzhiyun dwc2_readl(hsotg, DIEPDMA(index)),
245*4882a593Smuzhiyun dwc2_readl(hsotg, DOEPDMA(index)));
246*4882a593Smuzhiyun
247*4882a593Smuzhiyun seq_printf(seq, "\tDIEPINT=0x%08x, DOEPINT=0x%08x\n",
248*4882a593Smuzhiyun dwc2_readl(hsotg, DIEPINT(index)),
249*4882a593Smuzhiyun dwc2_readl(hsotg, DOEPINT(index)));
250*4882a593Smuzhiyun
251*4882a593Smuzhiyun seq_printf(seq, "\tDIEPTSIZ=0x%08x, DOEPTSIZ=0x%08x\n",
252*4882a593Smuzhiyun dwc2_readl(hsotg, DIEPTSIZ(index)),
253*4882a593Smuzhiyun dwc2_readl(hsotg, DOEPTSIZ(index)));
254*4882a593Smuzhiyun
255*4882a593Smuzhiyun seq_puts(seq, "\n");
256*4882a593Smuzhiyun seq_printf(seq, "mps %d\n", ep->ep.maxpacket);
257*4882a593Smuzhiyun seq_printf(seq, "total_data=%ld\n", ep->total_data);
258*4882a593Smuzhiyun
259*4882a593Smuzhiyun seq_printf(seq, "request list (%p,%p):\n",
260*4882a593Smuzhiyun ep->queue.next, ep->queue.prev);
261*4882a593Smuzhiyun
262*4882a593Smuzhiyun spin_lock_irqsave(&hsotg->lock, flags);
263*4882a593Smuzhiyun
264*4882a593Smuzhiyun list_for_each_entry(req, &ep->queue, queue) {
265*4882a593Smuzhiyun if (--show_limit < 0) {
266*4882a593Smuzhiyun seq_puts(seq, "not showing more requests...\n");
267*4882a593Smuzhiyun break;
268*4882a593Smuzhiyun }
269*4882a593Smuzhiyun
270*4882a593Smuzhiyun seq_printf(seq, "%c req %p: %d bytes @%p, ",
271*4882a593Smuzhiyun req == ep->req ? '*' : ' ',
272*4882a593Smuzhiyun req, req->req.length, req->req.buf);
273*4882a593Smuzhiyun seq_printf(seq, "%d done, res %d\n",
274*4882a593Smuzhiyun req->req.actual, req->req.status);
275*4882a593Smuzhiyun }
276*4882a593Smuzhiyun
277*4882a593Smuzhiyun spin_unlock_irqrestore(&hsotg->lock, flags);
278*4882a593Smuzhiyun
279*4882a593Smuzhiyun return 0;
280*4882a593Smuzhiyun }
281*4882a593Smuzhiyun DEFINE_SHOW_ATTRIBUTE(ep);
282*4882a593Smuzhiyun
283*4882a593Smuzhiyun /**
284*4882a593Smuzhiyun * dwc2_hsotg_create_debug - create debugfs directory and files
285*4882a593Smuzhiyun * @hsotg: The driver state
286*4882a593Smuzhiyun *
287*4882a593Smuzhiyun * Create the debugfs files to allow the user to get information
288*4882a593Smuzhiyun * about the state of the system. The directory name is created
289*4882a593Smuzhiyun * with the same name as the device itself, in case we end up
290*4882a593Smuzhiyun * with multiple blocks in future systems.
291*4882a593Smuzhiyun */
dwc2_hsotg_create_debug(struct dwc2_hsotg * hsotg)292*4882a593Smuzhiyun static void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg)
293*4882a593Smuzhiyun {
294*4882a593Smuzhiyun struct dentry *root;
295*4882a593Smuzhiyun unsigned int epidx;
296*4882a593Smuzhiyun
297*4882a593Smuzhiyun root = hsotg->debug_root;
298*4882a593Smuzhiyun
299*4882a593Smuzhiyun /* create general state file */
300*4882a593Smuzhiyun debugfs_create_file("state", 0444, root, hsotg, &state_fops);
301*4882a593Smuzhiyun debugfs_create_file("testmode", 0644, root, hsotg, &testmode_fops);
302*4882a593Smuzhiyun debugfs_create_file("fifo", 0444, root, hsotg, &fifo_fops);
303*4882a593Smuzhiyun
304*4882a593Smuzhiyun /* Create one file for each out endpoint */
305*4882a593Smuzhiyun for (epidx = 0; epidx < hsotg->num_of_eps; epidx++) {
306*4882a593Smuzhiyun struct dwc2_hsotg_ep *ep;
307*4882a593Smuzhiyun
308*4882a593Smuzhiyun ep = hsotg->eps_out[epidx];
309*4882a593Smuzhiyun if (ep)
310*4882a593Smuzhiyun debugfs_create_file(ep->name, 0444, root, ep, &ep_fops);
311*4882a593Smuzhiyun }
312*4882a593Smuzhiyun /* Create one file for each in endpoint. EP0 is handled with out eps */
313*4882a593Smuzhiyun for (epidx = 1; epidx < hsotg->num_of_eps; epidx++) {
314*4882a593Smuzhiyun struct dwc2_hsotg_ep *ep;
315*4882a593Smuzhiyun
316*4882a593Smuzhiyun ep = hsotg->eps_in[epidx];
317*4882a593Smuzhiyun if (ep)
318*4882a593Smuzhiyun debugfs_create_file(ep->name, 0444, root, ep, &ep_fops);
319*4882a593Smuzhiyun }
320*4882a593Smuzhiyun }
321*4882a593Smuzhiyun #else
dwc2_hsotg_create_debug(struct dwc2_hsotg * hsotg)322*4882a593Smuzhiyun static inline void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg) {}
323*4882a593Smuzhiyun #endif
324*4882a593Smuzhiyun
325*4882a593Smuzhiyun /* dwc2_hsotg_delete_debug is removed as cleanup in done in dwc2_debugfs_exit */
326*4882a593Smuzhiyun
327*4882a593Smuzhiyun #define dump_register(nm) \
328*4882a593Smuzhiyun { \
329*4882a593Smuzhiyun .name = #nm, \
330*4882a593Smuzhiyun .offset = nm, \
331*4882a593Smuzhiyun }
332*4882a593Smuzhiyun
333*4882a593Smuzhiyun static const struct debugfs_reg32 dwc2_regs[] = {
334*4882a593Smuzhiyun /*
335*4882a593Smuzhiyun * Accessing registers like this can trigger mode mismatch interrupt.
336*4882a593Smuzhiyun * However, according to dwc2 databook, the register access, in this
337*4882a593Smuzhiyun * case, is completed on the processor bus but is ignored by the core
338*4882a593Smuzhiyun * and does not affect its operation.
339*4882a593Smuzhiyun */
340*4882a593Smuzhiyun dump_register(GOTGCTL),
341*4882a593Smuzhiyun dump_register(GOTGINT),
342*4882a593Smuzhiyun dump_register(GAHBCFG),
343*4882a593Smuzhiyun dump_register(GUSBCFG),
344*4882a593Smuzhiyun dump_register(GRSTCTL),
345*4882a593Smuzhiyun dump_register(GINTSTS),
346*4882a593Smuzhiyun dump_register(GINTMSK),
347*4882a593Smuzhiyun dump_register(GRXSTSR),
348*4882a593Smuzhiyun /* Omit GRXSTSP */
349*4882a593Smuzhiyun dump_register(GRXFSIZ),
350*4882a593Smuzhiyun dump_register(GNPTXFSIZ),
351*4882a593Smuzhiyun dump_register(GNPTXSTS),
352*4882a593Smuzhiyun dump_register(GI2CCTL),
353*4882a593Smuzhiyun dump_register(GPVNDCTL),
354*4882a593Smuzhiyun dump_register(GGPIO),
355*4882a593Smuzhiyun dump_register(GUID),
356*4882a593Smuzhiyun dump_register(GSNPSID),
357*4882a593Smuzhiyun dump_register(GHWCFG1),
358*4882a593Smuzhiyun dump_register(GHWCFG2),
359*4882a593Smuzhiyun dump_register(GHWCFG3),
360*4882a593Smuzhiyun dump_register(GHWCFG4),
361*4882a593Smuzhiyun dump_register(GLPMCFG),
362*4882a593Smuzhiyun dump_register(GPWRDN),
363*4882a593Smuzhiyun dump_register(GDFIFOCFG),
364*4882a593Smuzhiyun dump_register(ADPCTL),
365*4882a593Smuzhiyun dump_register(HPTXFSIZ),
366*4882a593Smuzhiyun dump_register(DPTXFSIZN(1)),
367*4882a593Smuzhiyun dump_register(DPTXFSIZN(2)),
368*4882a593Smuzhiyun dump_register(DPTXFSIZN(3)),
369*4882a593Smuzhiyun dump_register(DPTXFSIZN(4)),
370*4882a593Smuzhiyun dump_register(DPTXFSIZN(5)),
371*4882a593Smuzhiyun dump_register(DPTXFSIZN(6)),
372*4882a593Smuzhiyun dump_register(DPTXFSIZN(7)),
373*4882a593Smuzhiyun dump_register(DPTXFSIZN(8)),
374*4882a593Smuzhiyun dump_register(DPTXFSIZN(9)),
375*4882a593Smuzhiyun dump_register(DPTXFSIZN(10)),
376*4882a593Smuzhiyun dump_register(DPTXFSIZN(11)),
377*4882a593Smuzhiyun dump_register(DPTXFSIZN(12)),
378*4882a593Smuzhiyun dump_register(DPTXFSIZN(13)),
379*4882a593Smuzhiyun dump_register(DPTXFSIZN(14)),
380*4882a593Smuzhiyun dump_register(DPTXFSIZN(15)),
381*4882a593Smuzhiyun dump_register(DCFG),
382*4882a593Smuzhiyun dump_register(DCTL),
383*4882a593Smuzhiyun dump_register(DSTS),
384*4882a593Smuzhiyun dump_register(DIEPMSK),
385*4882a593Smuzhiyun dump_register(DOEPMSK),
386*4882a593Smuzhiyun dump_register(DAINT),
387*4882a593Smuzhiyun dump_register(DAINTMSK),
388*4882a593Smuzhiyun dump_register(DTKNQR1),
389*4882a593Smuzhiyun dump_register(DTKNQR2),
390*4882a593Smuzhiyun dump_register(DTKNQR3),
391*4882a593Smuzhiyun dump_register(DTKNQR4),
392*4882a593Smuzhiyun dump_register(DVBUSDIS),
393*4882a593Smuzhiyun dump_register(DVBUSPULSE),
394*4882a593Smuzhiyun dump_register(DIEPCTL(0)),
395*4882a593Smuzhiyun dump_register(DIEPCTL(1)),
396*4882a593Smuzhiyun dump_register(DIEPCTL(2)),
397*4882a593Smuzhiyun dump_register(DIEPCTL(3)),
398*4882a593Smuzhiyun dump_register(DIEPCTL(4)),
399*4882a593Smuzhiyun dump_register(DIEPCTL(5)),
400*4882a593Smuzhiyun dump_register(DIEPCTL(6)),
401*4882a593Smuzhiyun dump_register(DIEPCTL(7)),
402*4882a593Smuzhiyun dump_register(DIEPCTL(8)),
403*4882a593Smuzhiyun dump_register(DIEPCTL(9)),
404*4882a593Smuzhiyun dump_register(DIEPCTL(10)),
405*4882a593Smuzhiyun dump_register(DIEPCTL(11)),
406*4882a593Smuzhiyun dump_register(DIEPCTL(12)),
407*4882a593Smuzhiyun dump_register(DIEPCTL(13)),
408*4882a593Smuzhiyun dump_register(DIEPCTL(14)),
409*4882a593Smuzhiyun dump_register(DIEPCTL(15)),
410*4882a593Smuzhiyun dump_register(DOEPCTL(0)),
411*4882a593Smuzhiyun dump_register(DOEPCTL(1)),
412*4882a593Smuzhiyun dump_register(DOEPCTL(2)),
413*4882a593Smuzhiyun dump_register(DOEPCTL(3)),
414*4882a593Smuzhiyun dump_register(DOEPCTL(4)),
415*4882a593Smuzhiyun dump_register(DOEPCTL(5)),
416*4882a593Smuzhiyun dump_register(DOEPCTL(6)),
417*4882a593Smuzhiyun dump_register(DOEPCTL(7)),
418*4882a593Smuzhiyun dump_register(DOEPCTL(8)),
419*4882a593Smuzhiyun dump_register(DOEPCTL(9)),
420*4882a593Smuzhiyun dump_register(DOEPCTL(10)),
421*4882a593Smuzhiyun dump_register(DOEPCTL(11)),
422*4882a593Smuzhiyun dump_register(DOEPCTL(12)),
423*4882a593Smuzhiyun dump_register(DOEPCTL(13)),
424*4882a593Smuzhiyun dump_register(DOEPCTL(14)),
425*4882a593Smuzhiyun dump_register(DOEPCTL(15)),
426*4882a593Smuzhiyun dump_register(DIEPINT(0)),
427*4882a593Smuzhiyun dump_register(DIEPINT(1)),
428*4882a593Smuzhiyun dump_register(DIEPINT(2)),
429*4882a593Smuzhiyun dump_register(DIEPINT(3)),
430*4882a593Smuzhiyun dump_register(DIEPINT(4)),
431*4882a593Smuzhiyun dump_register(DIEPINT(5)),
432*4882a593Smuzhiyun dump_register(DIEPINT(6)),
433*4882a593Smuzhiyun dump_register(DIEPINT(7)),
434*4882a593Smuzhiyun dump_register(DIEPINT(8)),
435*4882a593Smuzhiyun dump_register(DIEPINT(9)),
436*4882a593Smuzhiyun dump_register(DIEPINT(10)),
437*4882a593Smuzhiyun dump_register(DIEPINT(11)),
438*4882a593Smuzhiyun dump_register(DIEPINT(12)),
439*4882a593Smuzhiyun dump_register(DIEPINT(13)),
440*4882a593Smuzhiyun dump_register(DIEPINT(14)),
441*4882a593Smuzhiyun dump_register(DIEPINT(15)),
442*4882a593Smuzhiyun dump_register(DOEPINT(0)),
443*4882a593Smuzhiyun dump_register(DOEPINT(1)),
444*4882a593Smuzhiyun dump_register(DOEPINT(2)),
445*4882a593Smuzhiyun dump_register(DOEPINT(3)),
446*4882a593Smuzhiyun dump_register(DOEPINT(4)),
447*4882a593Smuzhiyun dump_register(DOEPINT(5)),
448*4882a593Smuzhiyun dump_register(DOEPINT(6)),
449*4882a593Smuzhiyun dump_register(DOEPINT(7)),
450*4882a593Smuzhiyun dump_register(DOEPINT(8)),
451*4882a593Smuzhiyun dump_register(DOEPINT(9)),
452*4882a593Smuzhiyun dump_register(DOEPINT(10)),
453*4882a593Smuzhiyun dump_register(DOEPINT(11)),
454*4882a593Smuzhiyun dump_register(DOEPINT(12)),
455*4882a593Smuzhiyun dump_register(DOEPINT(13)),
456*4882a593Smuzhiyun dump_register(DOEPINT(14)),
457*4882a593Smuzhiyun dump_register(DOEPINT(15)),
458*4882a593Smuzhiyun dump_register(DIEPTSIZ(0)),
459*4882a593Smuzhiyun dump_register(DIEPTSIZ(1)),
460*4882a593Smuzhiyun dump_register(DIEPTSIZ(2)),
461*4882a593Smuzhiyun dump_register(DIEPTSIZ(3)),
462*4882a593Smuzhiyun dump_register(DIEPTSIZ(4)),
463*4882a593Smuzhiyun dump_register(DIEPTSIZ(5)),
464*4882a593Smuzhiyun dump_register(DIEPTSIZ(6)),
465*4882a593Smuzhiyun dump_register(DIEPTSIZ(7)),
466*4882a593Smuzhiyun dump_register(DIEPTSIZ(8)),
467*4882a593Smuzhiyun dump_register(DIEPTSIZ(9)),
468*4882a593Smuzhiyun dump_register(DIEPTSIZ(10)),
469*4882a593Smuzhiyun dump_register(DIEPTSIZ(11)),
470*4882a593Smuzhiyun dump_register(DIEPTSIZ(12)),
471*4882a593Smuzhiyun dump_register(DIEPTSIZ(13)),
472*4882a593Smuzhiyun dump_register(DIEPTSIZ(14)),
473*4882a593Smuzhiyun dump_register(DIEPTSIZ(15)),
474*4882a593Smuzhiyun dump_register(DOEPTSIZ(0)),
475*4882a593Smuzhiyun dump_register(DOEPTSIZ(1)),
476*4882a593Smuzhiyun dump_register(DOEPTSIZ(2)),
477*4882a593Smuzhiyun dump_register(DOEPTSIZ(3)),
478*4882a593Smuzhiyun dump_register(DOEPTSIZ(4)),
479*4882a593Smuzhiyun dump_register(DOEPTSIZ(5)),
480*4882a593Smuzhiyun dump_register(DOEPTSIZ(6)),
481*4882a593Smuzhiyun dump_register(DOEPTSIZ(7)),
482*4882a593Smuzhiyun dump_register(DOEPTSIZ(8)),
483*4882a593Smuzhiyun dump_register(DOEPTSIZ(9)),
484*4882a593Smuzhiyun dump_register(DOEPTSIZ(10)),
485*4882a593Smuzhiyun dump_register(DOEPTSIZ(11)),
486*4882a593Smuzhiyun dump_register(DOEPTSIZ(12)),
487*4882a593Smuzhiyun dump_register(DOEPTSIZ(13)),
488*4882a593Smuzhiyun dump_register(DOEPTSIZ(14)),
489*4882a593Smuzhiyun dump_register(DOEPTSIZ(15)),
490*4882a593Smuzhiyun dump_register(DIEPDMA(0)),
491*4882a593Smuzhiyun dump_register(DIEPDMA(1)),
492*4882a593Smuzhiyun dump_register(DIEPDMA(2)),
493*4882a593Smuzhiyun dump_register(DIEPDMA(3)),
494*4882a593Smuzhiyun dump_register(DIEPDMA(4)),
495*4882a593Smuzhiyun dump_register(DIEPDMA(5)),
496*4882a593Smuzhiyun dump_register(DIEPDMA(6)),
497*4882a593Smuzhiyun dump_register(DIEPDMA(7)),
498*4882a593Smuzhiyun dump_register(DIEPDMA(8)),
499*4882a593Smuzhiyun dump_register(DIEPDMA(9)),
500*4882a593Smuzhiyun dump_register(DIEPDMA(10)),
501*4882a593Smuzhiyun dump_register(DIEPDMA(11)),
502*4882a593Smuzhiyun dump_register(DIEPDMA(12)),
503*4882a593Smuzhiyun dump_register(DIEPDMA(13)),
504*4882a593Smuzhiyun dump_register(DIEPDMA(14)),
505*4882a593Smuzhiyun dump_register(DIEPDMA(15)),
506*4882a593Smuzhiyun dump_register(DOEPDMA(0)),
507*4882a593Smuzhiyun dump_register(DOEPDMA(1)),
508*4882a593Smuzhiyun dump_register(DOEPDMA(2)),
509*4882a593Smuzhiyun dump_register(DOEPDMA(3)),
510*4882a593Smuzhiyun dump_register(DOEPDMA(4)),
511*4882a593Smuzhiyun dump_register(DOEPDMA(5)),
512*4882a593Smuzhiyun dump_register(DOEPDMA(6)),
513*4882a593Smuzhiyun dump_register(DOEPDMA(7)),
514*4882a593Smuzhiyun dump_register(DOEPDMA(8)),
515*4882a593Smuzhiyun dump_register(DOEPDMA(9)),
516*4882a593Smuzhiyun dump_register(DOEPDMA(10)),
517*4882a593Smuzhiyun dump_register(DOEPDMA(11)),
518*4882a593Smuzhiyun dump_register(DOEPDMA(12)),
519*4882a593Smuzhiyun dump_register(DOEPDMA(13)),
520*4882a593Smuzhiyun dump_register(DOEPDMA(14)),
521*4882a593Smuzhiyun dump_register(DOEPDMA(15)),
522*4882a593Smuzhiyun dump_register(DTXFSTS(0)),
523*4882a593Smuzhiyun dump_register(DTXFSTS(1)),
524*4882a593Smuzhiyun dump_register(DTXFSTS(2)),
525*4882a593Smuzhiyun dump_register(DTXFSTS(3)),
526*4882a593Smuzhiyun dump_register(DTXFSTS(4)),
527*4882a593Smuzhiyun dump_register(DTXFSTS(5)),
528*4882a593Smuzhiyun dump_register(DTXFSTS(6)),
529*4882a593Smuzhiyun dump_register(DTXFSTS(7)),
530*4882a593Smuzhiyun dump_register(DTXFSTS(8)),
531*4882a593Smuzhiyun dump_register(DTXFSTS(9)),
532*4882a593Smuzhiyun dump_register(DTXFSTS(10)),
533*4882a593Smuzhiyun dump_register(DTXFSTS(11)),
534*4882a593Smuzhiyun dump_register(DTXFSTS(12)),
535*4882a593Smuzhiyun dump_register(DTXFSTS(13)),
536*4882a593Smuzhiyun dump_register(DTXFSTS(14)),
537*4882a593Smuzhiyun dump_register(DTXFSTS(15)),
538*4882a593Smuzhiyun dump_register(PCGCTL),
539*4882a593Smuzhiyun dump_register(HCFG),
540*4882a593Smuzhiyun dump_register(HFIR),
541*4882a593Smuzhiyun dump_register(HFNUM),
542*4882a593Smuzhiyun dump_register(HPTXSTS),
543*4882a593Smuzhiyun dump_register(HAINT),
544*4882a593Smuzhiyun dump_register(HAINTMSK),
545*4882a593Smuzhiyun dump_register(HFLBADDR),
546*4882a593Smuzhiyun dump_register(HPRT0),
547*4882a593Smuzhiyun dump_register(HCCHAR(0)),
548*4882a593Smuzhiyun dump_register(HCCHAR(1)),
549*4882a593Smuzhiyun dump_register(HCCHAR(2)),
550*4882a593Smuzhiyun dump_register(HCCHAR(3)),
551*4882a593Smuzhiyun dump_register(HCCHAR(4)),
552*4882a593Smuzhiyun dump_register(HCCHAR(5)),
553*4882a593Smuzhiyun dump_register(HCCHAR(6)),
554*4882a593Smuzhiyun dump_register(HCCHAR(7)),
555*4882a593Smuzhiyun dump_register(HCCHAR(8)),
556*4882a593Smuzhiyun dump_register(HCCHAR(9)),
557*4882a593Smuzhiyun dump_register(HCCHAR(10)),
558*4882a593Smuzhiyun dump_register(HCCHAR(11)),
559*4882a593Smuzhiyun dump_register(HCCHAR(12)),
560*4882a593Smuzhiyun dump_register(HCCHAR(13)),
561*4882a593Smuzhiyun dump_register(HCCHAR(14)),
562*4882a593Smuzhiyun dump_register(HCCHAR(15)),
563*4882a593Smuzhiyun dump_register(HCSPLT(0)),
564*4882a593Smuzhiyun dump_register(HCSPLT(1)),
565*4882a593Smuzhiyun dump_register(HCSPLT(2)),
566*4882a593Smuzhiyun dump_register(HCSPLT(3)),
567*4882a593Smuzhiyun dump_register(HCSPLT(4)),
568*4882a593Smuzhiyun dump_register(HCSPLT(5)),
569*4882a593Smuzhiyun dump_register(HCSPLT(6)),
570*4882a593Smuzhiyun dump_register(HCSPLT(7)),
571*4882a593Smuzhiyun dump_register(HCSPLT(8)),
572*4882a593Smuzhiyun dump_register(HCSPLT(9)),
573*4882a593Smuzhiyun dump_register(HCSPLT(10)),
574*4882a593Smuzhiyun dump_register(HCSPLT(11)),
575*4882a593Smuzhiyun dump_register(HCSPLT(12)),
576*4882a593Smuzhiyun dump_register(HCSPLT(13)),
577*4882a593Smuzhiyun dump_register(HCSPLT(14)),
578*4882a593Smuzhiyun dump_register(HCSPLT(15)),
579*4882a593Smuzhiyun dump_register(HCINT(0)),
580*4882a593Smuzhiyun dump_register(HCINT(1)),
581*4882a593Smuzhiyun dump_register(HCINT(2)),
582*4882a593Smuzhiyun dump_register(HCINT(3)),
583*4882a593Smuzhiyun dump_register(HCINT(4)),
584*4882a593Smuzhiyun dump_register(HCINT(5)),
585*4882a593Smuzhiyun dump_register(HCINT(6)),
586*4882a593Smuzhiyun dump_register(HCINT(7)),
587*4882a593Smuzhiyun dump_register(HCINT(8)),
588*4882a593Smuzhiyun dump_register(HCINT(9)),
589*4882a593Smuzhiyun dump_register(HCINT(10)),
590*4882a593Smuzhiyun dump_register(HCINT(11)),
591*4882a593Smuzhiyun dump_register(HCINT(12)),
592*4882a593Smuzhiyun dump_register(HCINT(13)),
593*4882a593Smuzhiyun dump_register(HCINT(14)),
594*4882a593Smuzhiyun dump_register(HCINT(15)),
595*4882a593Smuzhiyun dump_register(HCINTMSK(0)),
596*4882a593Smuzhiyun dump_register(HCINTMSK(1)),
597*4882a593Smuzhiyun dump_register(HCINTMSK(2)),
598*4882a593Smuzhiyun dump_register(HCINTMSK(3)),
599*4882a593Smuzhiyun dump_register(HCINTMSK(4)),
600*4882a593Smuzhiyun dump_register(HCINTMSK(5)),
601*4882a593Smuzhiyun dump_register(HCINTMSK(6)),
602*4882a593Smuzhiyun dump_register(HCINTMSK(7)),
603*4882a593Smuzhiyun dump_register(HCINTMSK(8)),
604*4882a593Smuzhiyun dump_register(HCINTMSK(9)),
605*4882a593Smuzhiyun dump_register(HCINTMSK(10)),
606*4882a593Smuzhiyun dump_register(HCINTMSK(11)),
607*4882a593Smuzhiyun dump_register(HCINTMSK(12)),
608*4882a593Smuzhiyun dump_register(HCINTMSK(13)),
609*4882a593Smuzhiyun dump_register(HCINTMSK(14)),
610*4882a593Smuzhiyun dump_register(HCINTMSK(15)),
611*4882a593Smuzhiyun dump_register(HCTSIZ(0)),
612*4882a593Smuzhiyun dump_register(HCTSIZ(1)),
613*4882a593Smuzhiyun dump_register(HCTSIZ(2)),
614*4882a593Smuzhiyun dump_register(HCTSIZ(3)),
615*4882a593Smuzhiyun dump_register(HCTSIZ(4)),
616*4882a593Smuzhiyun dump_register(HCTSIZ(5)),
617*4882a593Smuzhiyun dump_register(HCTSIZ(6)),
618*4882a593Smuzhiyun dump_register(HCTSIZ(7)),
619*4882a593Smuzhiyun dump_register(HCTSIZ(8)),
620*4882a593Smuzhiyun dump_register(HCTSIZ(9)),
621*4882a593Smuzhiyun dump_register(HCTSIZ(10)),
622*4882a593Smuzhiyun dump_register(HCTSIZ(11)),
623*4882a593Smuzhiyun dump_register(HCTSIZ(12)),
624*4882a593Smuzhiyun dump_register(HCTSIZ(13)),
625*4882a593Smuzhiyun dump_register(HCTSIZ(14)),
626*4882a593Smuzhiyun dump_register(HCTSIZ(15)),
627*4882a593Smuzhiyun dump_register(HCDMA(0)),
628*4882a593Smuzhiyun dump_register(HCDMA(1)),
629*4882a593Smuzhiyun dump_register(HCDMA(2)),
630*4882a593Smuzhiyun dump_register(HCDMA(3)),
631*4882a593Smuzhiyun dump_register(HCDMA(4)),
632*4882a593Smuzhiyun dump_register(HCDMA(5)),
633*4882a593Smuzhiyun dump_register(HCDMA(6)),
634*4882a593Smuzhiyun dump_register(HCDMA(7)),
635*4882a593Smuzhiyun dump_register(HCDMA(8)),
636*4882a593Smuzhiyun dump_register(HCDMA(9)),
637*4882a593Smuzhiyun dump_register(HCDMA(10)),
638*4882a593Smuzhiyun dump_register(HCDMA(11)),
639*4882a593Smuzhiyun dump_register(HCDMA(12)),
640*4882a593Smuzhiyun dump_register(HCDMA(13)),
641*4882a593Smuzhiyun dump_register(HCDMA(14)),
642*4882a593Smuzhiyun dump_register(HCDMA(15)),
643*4882a593Smuzhiyun dump_register(HCDMAB(0)),
644*4882a593Smuzhiyun dump_register(HCDMAB(1)),
645*4882a593Smuzhiyun dump_register(HCDMAB(2)),
646*4882a593Smuzhiyun dump_register(HCDMAB(3)),
647*4882a593Smuzhiyun dump_register(HCDMAB(4)),
648*4882a593Smuzhiyun dump_register(HCDMAB(5)),
649*4882a593Smuzhiyun dump_register(HCDMAB(6)),
650*4882a593Smuzhiyun dump_register(HCDMAB(7)),
651*4882a593Smuzhiyun dump_register(HCDMAB(8)),
652*4882a593Smuzhiyun dump_register(HCDMAB(9)),
653*4882a593Smuzhiyun dump_register(HCDMAB(10)),
654*4882a593Smuzhiyun dump_register(HCDMAB(11)),
655*4882a593Smuzhiyun dump_register(HCDMAB(12)),
656*4882a593Smuzhiyun dump_register(HCDMAB(13)),
657*4882a593Smuzhiyun dump_register(HCDMAB(14)),
658*4882a593Smuzhiyun dump_register(HCDMAB(15)),
659*4882a593Smuzhiyun };
660*4882a593Smuzhiyun
661*4882a593Smuzhiyun #define print_param(_seq, _ptr, _param) \
662*4882a593Smuzhiyun seq_printf((_seq), "%-30s: %d\n", #_param, (_ptr)->_param)
663*4882a593Smuzhiyun
664*4882a593Smuzhiyun #define print_param_hex(_seq, _ptr, _param) \
665*4882a593Smuzhiyun seq_printf((_seq), "%-30s: 0x%x\n", #_param, (_ptr)->_param)
666*4882a593Smuzhiyun
params_show(struct seq_file * seq,void * v)667*4882a593Smuzhiyun static int params_show(struct seq_file *seq, void *v)
668*4882a593Smuzhiyun {
669*4882a593Smuzhiyun struct dwc2_hsotg *hsotg = seq->private;
670*4882a593Smuzhiyun struct dwc2_core_params *p = &hsotg->params;
671*4882a593Smuzhiyun int i;
672*4882a593Smuzhiyun
673*4882a593Smuzhiyun print_param(seq, p, otg_cap);
674*4882a593Smuzhiyun print_param(seq, p, dma_desc_enable);
675*4882a593Smuzhiyun print_param(seq, p, dma_desc_fs_enable);
676*4882a593Smuzhiyun print_param(seq, p, speed);
677*4882a593Smuzhiyun print_param(seq, p, enable_dynamic_fifo);
678*4882a593Smuzhiyun print_param(seq, p, en_multiple_tx_fifo);
679*4882a593Smuzhiyun print_param(seq, p, host_rx_fifo_size);
680*4882a593Smuzhiyun print_param(seq, p, host_nperio_tx_fifo_size);
681*4882a593Smuzhiyun print_param(seq, p, host_perio_tx_fifo_size);
682*4882a593Smuzhiyun print_param(seq, p, max_transfer_size);
683*4882a593Smuzhiyun print_param(seq, p, max_packet_count);
684*4882a593Smuzhiyun print_param(seq, p, host_channels);
685*4882a593Smuzhiyun print_param(seq, p, phy_type);
686*4882a593Smuzhiyun print_param(seq, p, phy_utmi_width);
687*4882a593Smuzhiyun print_param(seq, p, phy_ulpi_ddr);
688*4882a593Smuzhiyun print_param(seq, p, phy_ulpi_ext_vbus);
689*4882a593Smuzhiyun print_param(seq, p, i2c_enable);
690*4882a593Smuzhiyun print_param(seq, p, ipg_isoc_en);
691*4882a593Smuzhiyun print_param(seq, p, ulpi_fs_ls);
692*4882a593Smuzhiyun print_param(seq, p, host_support_fs_ls_low_power);
693*4882a593Smuzhiyun print_param(seq, p, host_ls_low_power_phy_clk);
694*4882a593Smuzhiyun print_param(seq, p, ts_dline);
695*4882a593Smuzhiyun print_param(seq, p, reload_ctl);
696*4882a593Smuzhiyun print_param_hex(seq, p, ahbcfg);
697*4882a593Smuzhiyun print_param(seq, p, uframe_sched);
698*4882a593Smuzhiyun print_param(seq, p, external_id_pin_ctl);
699*4882a593Smuzhiyun print_param(seq, p, power_down);
700*4882a593Smuzhiyun print_param(seq, p, lpm);
701*4882a593Smuzhiyun print_param(seq, p, lpm_clock_gating);
702*4882a593Smuzhiyun print_param(seq, p, besl);
703*4882a593Smuzhiyun print_param(seq, p, hird_threshold_en);
704*4882a593Smuzhiyun print_param(seq, p, hird_threshold);
705*4882a593Smuzhiyun print_param(seq, p, service_interval);
706*4882a593Smuzhiyun print_param(seq, p, host_dma);
707*4882a593Smuzhiyun print_param(seq, p, g_dma);
708*4882a593Smuzhiyun print_param(seq, p, g_dma_desc);
709*4882a593Smuzhiyun print_param(seq, p, g_rx_fifo_size);
710*4882a593Smuzhiyun print_param(seq, p, g_np_tx_fifo_size);
711*4882a593Smuzhiyun
712*4882a593Smuzhiyun for (i = 0; i < MAX_EPS_CHANNELS; i++) {
713*4882a593Smuzhiyun char str[32];
714*4882a593Smuzhiyun
715*4882a593Smuzhiyun snprintf(str, 32, "g_tx_fifo_size[%d]", i);
716*4882a593Smuzhiyun seq_printf(seq, "%-30s: %d\n", str, p->g_tx_fifo_size[i]);
717*4882a593Smuzhiyun }
718*4882a593Smuzhiyun
719*4882a593Smuzhiyun return 0;
720*4882a593Smuzhiyun }
721*4882a593Smuzhiyun DEFINE_SHOW_ATTRIBUTE(params);
722*4882a593Smuzhiyun
hw_params_show(struct seq_file * seq,void * v)723*4882a593Smuzhiyun static int hw_params_show(struct seq_file *seq, void *v)
724*4882a593Smuzhiyun {
725*4882a593Smuzhiyun struct dwc2_hsotg *hsotg = seq->private;
726*4882a593Smuzhiyun struct dwc2_hw_params *hw = &hsotg->hw_params;
727*4882a593Smuzhiyun
728*4882a593Smuzhiyun print_param(seq, hw, op_mode);
729*4882a593Smuzhiyun print_param(seq, hw, arch);
730*4882a593Smuzhiyun print_param(seq, hw, dma_desc_enable);
731*4882a593Smuzhiyun print_param(seq, hw, enable_dynamic_fifo);
732*4882a593Smuzhiyun print_param(seq, hw, en_multiple_tx_fifo);
733*4882a593Smuzhiyun print_param(seq, hw, rx_fifo_size);
734*4882a593Smuzhiyun print_param(seq, hw, host_nperio_tx_fifo_size);
735*4882a593Smuzhiyun print_param(seq, hw, dev_nperio_tx_fifo_size);
736*4882a593Smuzhiyun print_param(seq, hw, host_perio_tx_fifo_size);
737*4882a593Smuzhiyun print_param(seq, hw, nperio_tx_q_depth);
738*4882a593Smuzhiyun print_param(seq, hw, host_perio_tx_q_depth);
739*4882a593Smuzhiyun print_param(seq, hw, dev_token_q_depth);
740*4882a593Smuzhiyun print_param(seq, hw, max_transfer_size);
741*4882a593Smuzhiyun print_param(seq, hw, max_packet_count);
742*4882a593Smuzhiyun print_param(seq, hw, host_channels);
743*4882a593Smuzhiyun print_param(seq, hw, hs_phy_type);
744*4882a593Smuzhiyun print_param(seq, hw, fs_phy_type);
745*4882a593Smuzhiyun print_param(seq, hw, i2c_enable);
746*4882a593Smuzhiyun print_param(seq, hw, num_dev_ep);
747*4882a593Smuzhiyun print_param(seq, hw, num_dev_perio_in_ep);
748*4882a593Smuzhiyun print_param(seq, hw, total_fifo_size);
749*4882a593Smuzhiyun print_param(seq, hw, power_optimized);
750*4882a593Smuzhiyun print_param(seq, hw, utmi_phy_data_width);
751*4882a593Smuzhiyun print_param_hex(seq, hw, snpsid);
752*4882a593Smuzhiyun print_param_hex(seq, hw, dev_ep_dirs);
753*4882a593Smuzhiyun
754*4882a593Smuzhiyun return 0;
755*4882a593Smuzhiyun }
756*4882a593Smuzhiyun DEFINE_SHOW_ATTRIBUTE(hw_params);
757*4882a593Smuzhiyun
dr_mode_show(struct seq_file * seq,void * v)758*4882a593Smuzhiyun static int dr_mode_show(struct seq_file *seq, void *v)
759*4882a593Smuzhiyun {
760*4882a593Smuzhiyun struct dwc2_hsotg *hsotg = seq->private;
761*4882a593Smuzhiyun const char *dr_mode = "";
762*4882a593Smuzhiyun
763*4882a593Smuzhiyun device_property_read_string(hsotg->dev, "dr_mode", &dr_mode);
764*4882a593Smuzhiyun seq_printf(seq, "%s\n", dr_mode);
765*4882a593Smuzhiyun return 0;
766*4882a593Smuzhiyun }
767*4882a593Smuzhiyun DEFINE_SHOW_ATTRIBUTE(dr_mode);
768*4882a593Smuzhiyun
dwc2_debugfs_init(struct dwc2_hsotg * hsotg)769*4882a593Smuzhiyun int dwc2_debugfs_init(struct dwc2_hsotg *hsotg)
770*4882a593Smuzhiyun {
771*4882a593Smuzhiyun int ret;
772*4882a593Smuzhiyun struct dentry *root;
773*4882a593Smuzhiyun
774*4882a593Smuzhiyun root = debugfs_create_dir(dev_name(hsotg->dev), usb_debug_root);
775*4882a593Smuzhiyun hsotg->debug_root = root;
776*4882a593Smuzhiyun
777*4882a593Smuzhiyun debugfs_create_file("params", 0444, root, hsotg, ¶ms_fops);
778*4882a593Smuzhiyun debugfs_create_file("hw_params", 0444, root, hsotg, &hw_params_fops);
779*4882a593Smuzhiyun debugfs_create_file("dr_mode", 0444, root, hsotg, &dr_mode_fops);
780*4882a593Smuzhiyun
781*4882a593Smuzhiyun /* Add gadget debugfs nodes */
782*4882a593Smuzhiyun dwc2_hsotg_create_debug(hsotg);
783*4882a593Smuzhiyun
784*4882a593Smuzhiyun hsotg->regset = devm_kzalloc(hsotg->dev, sizeof(*hsotg->regset),
785*4882a593Smuzhiyun GFP_KERNEL);
786*4882a593Smuzhiyun if (!hsotg->regset) {
787*4882a593Smuzhiyun ret = -ENOMEM;
788*4882a593Smuzhiyun goto err;
789*4882a593Smuzhiyun }
790*4882a593Smuzhiyun
791*4882a593Smuzhiyun hsotg->regset->regs = dwc2_regs;
792*4882a593Smuzhiyun hsotg->regset->nregs = ARRAY_SIZE(dwc2_regs);
793*4882a593Smuzhiyun hsotg->regset->base = hsotg->regs;
794*4882a593Smuzhiyun
795*4882a593Smuzhiyun debugfs_create_regset32("regdump", 0444, root, hsotg->regset);
796*4882a593Smuzhiyun
797*4882a593Smuzhiyun return 0;
798*4882a593Smuzhiyun err:
799*4882a593Smuzhiyun debugfs_remove_recursive(hsotg->debug_root);
800*4882a593Smuzhiyun return ret;
801*4882a593Smuzhiyun }
802*4882a593Smuzhiyun
dwc2_debugfs_exit(struct dwc2_hsotg * hsotg)803*4882a593Smuzhiyun void dwc2_debugfs_exit(struct dwc2_hsotg *hsotg)
804*4882a593Smuzhiyun {
805*4882a593Smuzhiyun debugfs_remove_recursive(hsotg->debug_root);
806*4882a593Smuzhiyun hsotg->debug_root = NULL;
807*4882a593Smuzhiyun }
808