162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * debugfs.c - Designware USB2 DRD controller debugfs
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2015 Intel Corporation
662306a36Sopenharmony_ci * Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/spinlock.h>
1062306a36Sopenharmony_ci#include <linux/debugfs.h>
1162306a36Sopenharmony_ci#include <linux/seq_file.h>
1262306a36Sopenharmony_ci#include <linux/uaccess.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include "core.h"
1562306a36Sopenharmony_ci#include "debug.h"
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \
1862306a36Sopenharmony_ci	IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci/**
2162306a36Sopenharmony_ci * testmode_write() - change usb test mode state.
2262306a36Sopenharmony_ci * @file: The  file to write to.
2362306a36Sopenharmony_ci * @ubuf: The buffer where user wrote.
2462306a36Sopenharmony_ci * @count: The ubuf size.
2562306a36Sopenharmony_ci * @ppos: Unused parameter.
2662306a36Sopenharmony_ci */
2762306a36Sopenharmony_cistatic ssize_t testmode_write(struct file *file, const char __user *ubuf, size_t
2862306a36Sopenharmony_ci		count, loff_t *ppos)
2962306a36Sopenharmony_ci{
3062306a36Sopenharmony_ci	struct seq_file		*s = file->private_data;
3162306a36Sopenharmony_ci	struct dwc2_hsotg	*hsotg = s->private;
3262306a36Sopenharmony_ci	unsigned long		flags;
3362306a36Sopenharmony_ci	u32			testmode = 0;
3462306a36Sopenharmony_ci	char			buf[32];
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci	if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
3762306a36Sopenharmony_ci		return -EFAULT;
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci	if (!strncmp(buf, "test_j", 6))
4062306a36Sopenharmony_ci		testmode = USB_TEST_J;
4162306a36Sopenharmony_ci	else if (!strncmp(buf, "test_k", 6))
4262306a36Sopenharmony_ci		testmode = USB_TEST_K;
4362306a36Sopenharmony_ci	else if (!strncmp(buf, "test_se0_nak", 12))
4462306a36Sopenharmony_ci		testmode = USB_TEST_SE0_NAK;
4562306a36Sopenharmony_ci	else if (!strncmp(buf, "test_packet", 11))
4662306a36Sopenharmony_ci		testmode = USB_TEST_PACKET;
4762306a36Sopenharmony_ci	else if (!strncmp(buf, "test_force_enable", 17))
4862306a36Sopenharmony_ci		testmode = USB_TEST_FORCE_ENABLE;
4962306a36Sopenharmony_ci	else
5062306a36Sopenharmony_ci		testmode = 0;
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci	spin_lock_irqsave(&hsotg->lock, flags);
5362306a36Sopenharmony_ci	dwc2_hsotg_set_test_mode(hsotg, testmode);
5462306a36Sopenharmony_ci	spin_unlock_irqrestore(&hsotg->lock, flags);
5562306a36Sopenharmony_ci	return count;
5662306a36Sopenharmony_ci}
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci/**
5962306a36Sopenharmony_ci * testmode_show() - debugfs: show usb test mode state
6062306a36Sopenharmony_ci * @s: The seq file to write to.
6162306a36Sopenharmony_ci * @unused: Unused parameter.
6262306a36Sopenharmony_ci *
6362306a36Sopenharmony_ci * This debugfs entry shows which usb test mode is currently enabled.
6462306a36Sopenharmony_ci */
6562306a36Sopenharmony_cistatic int testmode_show(struct seq_file *s, void *unused)
6662306a36Sopenharmony_ci{
6762306a36Sopenharmony_ci	struct dwc2_hsotg *hsotg = s->private;
6862306a36Sopenharmony_ci	unsigned long flags;
6962306a36Sopenharmony_ci	int dctl;
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci	spin_lock_irqsave(&hsotg->lock, flags);
7262306a36Sopenharmony_ci	dctl = dwc2_readl(hsotg, DCTL);
7362306a36Sopenharmony_ci	dctl &= DCTL_TSTCTL_MASK;
7462306a36Sopenharmony_ci	dctl >>= DCTL_TSTCTL_SHIFT;
7562306a36Sopenharmony_ci	spin_unlock_irqrestore(&hsotg->lock, flags);
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci	switch (dctl) {
7862306a36Sopenharmony_ci	case 0:
7962306a36Sopenharmony_ci		seq_puts(s, "no test\n");
8062306a36Sopenharmony_ci		break;
8162306a36Sopenharmony_ci	case USB_TEST_J:
8262306a36Sopenharmony_ci		seq_puts(s, "test_j\n");
8362306a36Sopenharmony_ci		break;
8462306a36Sopenharmony_ci	case USB_TEST_K:
8562306a36Sopenharmony_ci		seq_puts(s, "test_k\n");
8662306a36Sopenharmony_ci		break;
8762306a36Sopenharmony_ci	case USB_TEST_SE0_NAK:
8862306a36Sopenharmony_ci		seq_puts(s, "test_se0_nak\n");
8962306a36Sopenharmony_ci		break;
9062306a36Sopenharmony_ci	case USB_TEST_PACKET:
9162306a36Sopenharmony_ci		seq_puts(s, "test_packet\n");
9262306a36Sopenharmony_ci		break;
9362306a36Sopenharmony_ci	case USB_TEST_FORCE_ENABLE:
9462306a36Sopenharmony_ci		seq_puts(s, "test_force_enable\n");
9562306a36Sopenharmony_ci		break;
9662306a36Sopenharmony_ci	default:
9762306a36Sopenharmony_ci		seq_printf(s, "UNKNOWN %d\n", dctl);
9862306a36Sopenharmony_ci	}
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci	return 0;
10162306a36Sopenharmony_ci}
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_cistatic int testmode_open(struct inode *inode, struct file *file)
10462306a36Sopenharmony_ci{
10562306a36Sopenharmony_ci	return single_open(file, testmode_show, inode->i_private);
10662306a36Sopenharmony_ci}
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_cistatic const struct file_operations testmode_fops = {
10962306a36Sopenharmony_ci	.owner		= THIS_MODULE,
11062306a36Sopenharmony_ci	.open		= testmode_open,
11162306a36Sopenharmony_ci	.write		= testmode_write,
11262306a36Sopenharmony_ci	.read		= seq_read,
11362306a36Sopenharmony_ci	.llseek		= seq_lseek,
11462306a36Sopenharmony_ci	.release	= single_release,
11562306a36Sopenharmony_ci};
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci/**
11862306a36Sopenharmony_ci * state_show - debugfs: show overall driver and device state.
11962306a36Sopenharmony_ci * @seq: The seq file to write to.
12062306a36Sopenharmony_ci * @v: Unused parameter.
12162306a36Sopenharmony_ci *
12262306a36Sopenharmony_ci * This debugfs entry shows the overall state of the hardware and
12362306a36Sopenharmony_ci * some general information about each of the endpoints available
12462306a36Sopenharmony_ci * to the system.
12562306a36Sopenharmony_ci */
12662306a36Sopenharmony_cistatic int state_show(struct seq_file *seq, void *v)
12762306a36Sopenharmony_ci{
12862306a36Sopenharmony_ci	struct dwc2_hsotg *hsotg = seq->private;
12962306a36Sopenharmony_ci	int idx;
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci	seq_printf(seq, "DCFG=0x%08x, DCTL=0x%08x, DSTS=0x%08x\n",
13262306a36Sopenharmony_ci		   dwc2_readl(hsotg, DCFG),
13362306a36Sopenharmony_ci		 dwc2_readl(hsotg, DCTL),
13462306a36Sopenharmony_ci		 dwc2_readl(hsotg, DSTS));
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci	seq_printf(seq, "DIEPMSK=0x%08x, DOEPMASK=0x%08x\n",
13762306a36Sopenharmony_ci		   dwc2_readl(hsotg, DIEPMSK), dwc2_readl(hsotg, DOEPMSK));
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci	seq_printf(seq, "GINTMSK=0x%08x, GINTSTS=0x%08x\n",
14062306a36Sopenharmony_ci		   dwc2_readl(hsotg, GINTMSK),
14162306a36Sopenharmony_ci		   dwc2_readl(hsotg, GINTSTS));
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci	seq_printf(seq, "DAINTMSK=0x%08x, DAINT=0x%08x\n",
14462306a36Sopenharmony_ci		   dwc2_readl(hsotg, DAINTMSK),
14562306a36Sopenharmony_ci		   dwc2_readl(hsotg, DAINT));
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci	seq_printf(seq, "GNPTXSTS=0x%08x, GRXSTSR=%08x\n",
14862306a36Sopenharmony_ci		   dwc2_readl(hsotg, GNPTXSTS),
14962306a36Sopenharmony_ci		   dwc2_readl(hsotg, GRXSTSR));
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci	seq_puts(seq, "\nEndpoint status:\n");
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci	for (idx = 0; idx < hsotg->num_of_eps; idx++) {
15462306a36Sopenharmony_ci		u32 in, out;
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci		in = dwc2_readl(hsotg, DIEPCTL(idx));
15762306a36Sopenharmony_ci		out = dwc2_readl(hsotg, DOEPCTL(idx));
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci		seq_printf(seq, "ep%d: DIEPCTL=0x%08x, DOEPCTL=0x%08x",
16062306a36Sopenharmony_ci			   idx, in, out);
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci		in = dwc2_readl(hsotg, DIEPTSIZ(idx));
16362306a36Sopenharmony_ci		out = dwc2_readl(hsotg, DOEPTSIZ(idx));
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci		seq_printf(seq, ", DIEPTSIZ=0x%08x, DOEPTSIZ=0x%08x",
16662306a36Sopenharmony_ci			   in, out);
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci		seq_puts(seq, "\n");
16962306a36Sopenharmony_ci	}
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci	return 0;
17262306a36Sopenharmony_ci}
17362306a36Sopenharmony_ciDEFINE_SHOW_ATTRIBUTE(state);
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci/**
17662306a36Sopenharmony_ci * fifo_show - debugfs: show the fifo information
17762306a36Sopenharmony_ci * @seq: The seq_file to write data to.
17862306a36Sopenharmony_ci * @v: Unused parameter.
17962306a36Sopenharmony_ci *
18062306a36Sopenharmony_ci * Show the FIFO information for the overall fifo and all the
18162306a36Sopenharmony_ci * periodic transmission FIFOs.
18262306a36Sopenharmony_ci */
18362306a36Sopenharmony_cistatic int fifo_show(struct seq_file *seq, void *v)
18462306a36Sopenharmony_ci{
18562306a36Sopenharmony_ci	struct dwc2_hsotg *hsotg = seq->private;
18662306a36Sopenharmony_ci	int fifo_count = dwc2_hsotg_tx_fifo_count(hsotg);
18762306a36Sopenharmony_ci	u32 val;
18862306a36Sopenharmony_ci	int idx;
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci	seq_puts(seq, "Non-periodic FIFOs:\n");
19162306a36Sopenharmony_ci	seq_printf(seq, "RXFIFO: Size %d\n", dwc2_readl(hsotg, GRXFSIZ));
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci	val = dwc2_readl(hsotg, GNPTXFSIZ);
19462306a36Sopenharmony_ci	seq_printf(seq, "NPTXFIFO: Size %d, Start 0x%08x\n",
19562306a36Sopenharmony_ci		   val >> FIFOSIZE_DEPTH_SHIFT,
19662306a36Sopenharmony_ci		   val & FIFOSIZE_STARTADDR_MASK);
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci	seq_puts(seq, "\nPeriodic TXFIFOs:\n");
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci	for (idx = 1; idx <= fifo_count; idx++) {
20162306a36Sopenharmony_ci		val = dwc2_readl(hsotg, DPTXFSIZN(idx));
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ci		seq_printf(seq, "\tDPTXFIFO%2d: Size %d, Start 0x%08x\n", idx,
20462306a36Sopenharmony_ci			   val >> FIFOSIZE_DEPTH_SHIFT,
20562306a36Sopenharmony_ci			   val & FIFOSIZE_STARTADDR_MASK);
20662306a36Sopenharmony_ci	}
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci	return 0;
20962306a36Sopenharmony_ci}
21062306a36Sopenharmony_ciDEFINE_SHOW_ATTRIBUTE(fifo);
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_cistatic const char *decode_direction(int is_in)
21362306a36Sopenharmony_ci{
21462306a36Sopenharmony_ci	return is_in ? "in" : "out";
21562306a36Sopenharmony_ci}
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci/**
21862306a36Sopenharmony_ci * ep_show - debugfs: show the state of an endpoint.
21962306a36Sopenharmony_ci * @seq: The seq_file to write data to.
22062306a36Sopenharmony_ci * @v: Unused parameter.
22162306a36Sopenharmony_ci *
22262306a36Sopenharmony_ci * This debugfs entry shows the state of the given endpoint (one is
22362306a36Sopenharmony_ci * registered for each available).
22462306a36Sopenharmony_ci */
22562306a36Sopenharmony_cistatic int ep_show(struct seq_file *seq, void *v)
22662306a36Sopenharmony_ci{
22762306a36Sopenharmony_ci	struct dwc2_hsotg_ep *ep = seq->private;
22862306a36Sopenharmony_ci	struct dwc2_hsotg *hsotg = ep->parent;
22962306a36Sopenharmony_ci	struct dwc2_hsotg_req *req;
23062306a36Sopenharmony_ci	int index = ep->index;
23162306a36Sopenharmony_ci	int show_limit = 15;
23262306a36Sopenharmony_ci	unsigned long flags;
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci	seq_printf(seq, "Endpoint index %d, named %s,  dir %s:\n",
23562306a36Sopenharmony_ci		   ep->index, ep->ep.name, decode_direction(ep->dir_in));
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ci	/* first show the register state */
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci	seq_printf(seq, "\tDIEPCTL=0x%08x, DOEPCTL=0x%08x\n",
24062306a36Sopenharmony_ci		   dwc2_readl(hsotg, DIEPCTL(index)),
24162306a36Sopenharmony_ci		   dwc2_readl(hsotg, DOEPCTL(index)));
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ci	seq_printf(seq, "\tDIEPDMA=0x%08x, DOEPDMA=0x%08x\n",
24462306a36Sopenharmony_ci		   dwc2_readl(hsotg, DIEPDMA(index)),
24562306a36Sopenharmony_ci		   dwc2_readl(hsotg, DOEPDMA(index)));
24662306a36Sopenharmony_ci
24762306a36Sopenharmony_ci	seq_printf(seq, "\tDIEPINT=0x%08x, DOEPINT=0x%08x\n",
24862306a36Sopenharmony_ci		   dwc2_readl(hsotg, DIEPINT(index)),
24962306a36Sopenharmony_ci		   dwc2_readl(hsotg, DOEPINT(index)));
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci	seq_printf(seq, "\tDIEPTSIZ=0x%08x, DOEPTSIZ=0x%08x\n",
25262306a36Sopenharmony_ci		   dwc2_readl(hsotg, DIEPTSIZ(index)),
25362306a36Sopenharmony_ci		   dwc2_readl(hsotg, DOEPTSIZ(index)));
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ci	seq_puts(seq, "\n");
25662306a36Sopenharmony_ci	seq_printf(seq, "mps %d\n", ep->ep.maxpacket);
25762306a36Sopenharmony_ci	seq_printf(seq, "total_data=%ld\n", ep->total_data);
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_ci	seq_printf(seq, "request list (%p,%p):\n",
26062306a36Sopenharmony_ci		   ep->queue.next, ep->queue.prev);
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_ci	spin_lock_irqsave(&hsotg->lock, flags);
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci	list_for_each_entry(req, &ep->queue, queue) {
26562306a36Sopenharmony_ci		if (--show_limit < 0) {
26662306a36Sopenharmony_ci			seq_puts(seq, "not showing more requests...\n");
26762306a36Sopenharmony_ci			break;
26862306a36Sopenharmony_ci		}
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_ci		seq_printf(seq, "%c req %p: %d bytes @%p, ",
27162306a36Sopenharmony_ci			   req == ep->req ? '*' : ' ',
27262306a36Sopenharmony_ci			   req, req->req.length, req->req.buf);
27362306a36Sopenharmony_ci		seq_printf(seq, "%d done, res %d\n",
27462306a36Sopenharmony_ci			   req->req.actual, req->req.status);
27562306a36Sopenharmony_ci	}
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci	spin_unlock_irqrestore(&hsotg->lock, flags);
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ci	return 0;
28062306a36Sopenharmony_ci}
28162306a36Sopenharmony_ciDEFINE_SHOW_ATTRIBUTE(ep);
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ci/**
28462306a36Sopenharmony_ci * dwc2_hsotg_create_debug - create debugfs directory and files
28562306a36Sopenharmony_ci * @hsotg: The driver state
28662306a36Sopenharmony_ci *
28762306a36Sopenharmony_ci * Create the debugfs files to allow the user to get information
28862306a36Sopenharmony_ci * about the state of the system. The directory name is created
28962306a36Sopenharmony_ci * with the same name as the device itself, in case we end up
29062306a36Sopenharmony_ci * with multiple blocks in future systems.
29162306a36Sopenharmony_ci */
29262306a36Sopenharmony_cistatic void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg)
29362306a36Sopenharmony_ci{
29462306a36Sopenharmony_ci	struct dentry *root;
29562306a36Sopenharmony_ci	unsigned int epidx;
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci	root = hsotg->debug_root;
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci	/* create general state file */
30062306a36Sopenharmony_ci	debugfs_create_file("state", 0444, root, hsotg, &state_fops);
30162306a36Sopenharmony_ci	debugfs_create_file("testmode", 0644, root, hsotg, &testmode_fops);
30262306a36Sopenharmony_ci	debugfs_create_file("fifo", 0444, root, hsotg, &fifo_fops);
30362306a36Sopenharmony_ci
30462306a36Sopenharmony_ci	/* Create one file for each out endpoint */
30562306a36Sopenharmony_ci	for (epidx = 0; epidx < hsotg->num_of_eps; epidx++) {
30662306a36Sopenharmony_ci		struct dwc2_hsotg_ep *ep;
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci		ep = hsotg->eps_out[epidx];
30962306a36Sopenharmony_ci		if (ep)
31062306a36Sopenharmony_ci			debugfs_create_file(ep->name, 0444, root, ep, &ep_fops);
31162306a36Sopenharmony_ci	}
31262306a36Sopenharmony_ci	/* Create one file for each in endpoint. EP0 is handled with out eps */
31362306a36Sopenharmony_ci	for (epidx = 1; epidx < hsotg->num_of_eps; epidx++) {
31462306a36Sopenharmony_ci		struct dwc2_hsotg_ep *ep;
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ci		ep = hsotg->eps_in[epidx];
31762306a36Sopenharmony_ci		if (ep)
31862306a36Sopenharmony_ci			debugfs_create_file(ep->name, 0444, root, ep, &ep_fops);
31962306a36Sopenharmony_ci	}
32062306a36Sopenharmony_ci}
32162306a36Sopenharmony_ci#else
32262306a36Sopenharmony_cistatic inline void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg) {}
32362306a36Sopenharmony_ci#endif
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_ci/* dwc2_hsotg_delete_debug is removed as cleanup in done in dwc2_debugfs_exit */
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci#define dump_register(nm)	\
32862306a36Sopenharmony_ci{				\
32962306a36Sopenharmony_ci	.name	= #nm,		\
33062306a36Sopenharmony_ci	.offset	= nm,		\
33162306a36Sopenharmony_ci}
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_cistatic const struct debugfs_reg32 dwc2_regs[] = {
33462306a36Sopenharmony_ci	/*
33562306a36Sopenharmony_ci	 * Accessing registers like this can trigger mode mismatch interrupt.
33662306a36Sopenharmony_ci	 * However, according to dwc2 databook, the register access, in this
33762306a36Sopenharmony_ci	 * case, is completed on the processor bus but is ignored by the core
33862306a36Sopenharmony_ci	 * and does not affect its operation.
33962306a36Sopenharmony_ci	 */
34062306a36Sopenharmony_ci	dump_register(GOTGCTL),
34162306a36Sopenharmony_ci	dump_register(GOTGINT),
34262306a36Sopenharmony_ci	dump_register(GAHBCFG),
34362306a36Sopenharmony_ci	dump_register(GUSBCFG),
34462306a36Sopenharmony_ci	dump_register(GRSTCTL),
34562306a36Sopenharmony_ci	dump_register(GINTSTS),
34662306a36Sopenharmony_ci	dump_register(GINTMSK),
34762306a36Sopenharmony_ci	dump_register(GRXSTSR),
34862306a36Sopenharmony_ci	/* Omit GRXSTSP */
34962306a36Sopenharmony_ci	dump_register(GRXFSIZ),
35062306a36Sopenharmony_ci	dump_register(GNPTXFSIZ),
35162306a36Sopenharmony_ci	dump_register(GNPTXSTS),
35262306a36Sopenharmony_ci	dump_register(GI2CCTL),
35362306a36Sopenharmony_ci	dump_register(GPVNDCTL),
35462306a36Sopenharmony_ci	dump_register(GGPIO),
35562306a36Sopenharmony_ci	dump_register(GUID),
35662306a36Sopenharmony_ci	dump_register(GSNPSID),
35762306a36Sopenharmony_ci	dump_register(GHWCFG1),
35862306a36Sopenharmony_ci	dump_register(GHWCFG2),
35962306a36Sopenharmony_ci	dump_register(GHWCFG3),
36062306a36Sopenharmony_ci	dump_register(GHWCFG4),
36162306a36Sopenharmony_ci	dump_register(GLPMCFG),
36262306a36Sopenharmony_ci	dump_register(GPWRDN),
36362306a36Sopenharmony_ci	dump_register(GDFIFOCFG),
36462306a36Sopenharmony_ci	dump_register(ADPCTL),
36562306a36Sopenharmony_ci	dump_register(HPTXFSIZ),
36662306a36Sopenharmony_ci	dump_register(DPTXFSIZN(1)),
36762306a36Sopenharmony_ci	dump_register(DPTXFSIZN(2)),
36862306a36Sopenharmony_ci	dump_register(DPTXFSIZN(3)),
36962306a36Sopenharmony_ci	dump_register(DPTXFSIZN(4)),
37062306a36Sopenharmony_ci	dump_register(DPTXFSIZN(5)),
37162306a36Sopenharmony_ci	dump_register(DPTXFSIZN(6)),
37262306a36Sopenharmony_ci	dump_register(DPTXFSIZN(7)),
37362306a36Sopenharmony_ci	dump_register(DPTXFSIZN(8)),
37462306a36Sopenharmony_ci	dump_register(DPTXFSIZN(9)),
37562306a36Sopenharmony_ci	dump_register(DPTXFSIZN(10)),
37662306a36Sopenharmony_ci	dump_register(DPTXFSIZN(11)),
37762306a36Sopenharmony_ci	dump_register(DPTXFSIZN(12)),
37862306a36Sopenharmony_ci	dump_register(DPTXFSIZN(13)),
37962306a36Sopenharmony_ci	dump_register(DPTXFSIZN(14)),
38062306a36Sopenharmony_ci	dump_register(DPTXFSIZN(15)),
38162306a36Sopenharmony_ci	dump_register(DCFG),
38262306a36Sopenharmony_ci	dump_register(DCTL),
38362306a36Sopenharmony_ci	dump_register(DSTS),
38462306a36Sopenharmony_ci	dump_register(DIEPMSK),
38562306a36Sopenharmony_ci	dump_register(DOEPMSK),
38662306a36Sopenharmony_ci	dump_register(DAINT),
38762306a36Sopenharmony_ci	dump_register(DAINTMSK),
38862306a36Sopenharmony_ci	dump_register(DTKNQR1),
38962306a36Sopenharmony_ci	dump_register(DTKNQR2),
39062306a36Sopenharmony_ci	dump_register(DTKNQR3),
39162306a36Sopenharmony_ci	dump_register(DTKNQR4),
39262306a36Sopenharmony_ci	dump_register(DVBUSDIS),
39362306a36Sopenharmony_ci	dump_register(DVBUSPULSE),
39462306a36Sopenharmony_ci	dump_register(DIEPCTL(0)),
39562306a36Sopenharmony_ci	dump_register(DIEPCTL(1)),
39662306a36Sopenharmony_ci	dump_register(DIEPCTL(2)),
39762306a36Sopenharmony_ci	dump_register(DIEPCTL(3)),
39862306a36Sopenharmony_ci	dump_register(DIEPCTL(4)),
39962306a36Sopenharmony_ci	dump_register(DIEPCTL(5)),
40062306a36Sopenharmony_ci	dump_register(DIEPCTL(6)),
40162306a36Sopenharmony_ci	dump_register(DIEPCTL(7)),
40262306a36Sopenharmony_ci	dump_register(DIEPCTL(8)),
40362306a36Sopenharmony_ci	dump_register(DIEPCTL(9)),
40462306a36Sopenharmony_ci	dump_register(DIEPCTL(10)),
40562306a36Sopenharmony_ci	dump_register(DIEPCTL(11)),
40662306a36Sopenharmony_ci	dump_register(DIEPCTL(12)),
40762306a36Sopenharmony_ci	dump_register(DIEPCTL(13)),
40862306a36Sopenharmony_ci	dump_register(DIEPCTL(14)),
40962306a36Sopenharmony_ci	dump_register(DIEPCTL(15)),
41062306a36Sopenharmony_ci	dump_register(DOEPCTL(0)),
41162306a36Sopenharmony_ci	dump_register(DOEPCTL(1)),
41262306a36Sopenharmony_ci	dump_register(DOEPCTL(2)),
41362306a36Sopenharmony_ci	dump_register(DOEPCTL(3)),
41462306a36Sopenharmony_ci	dump_register(DOEPCTL(4)),
41562306a36Sopenharmony_ci	dump_register(DOEPCTL(5)),
41662306a36Sopenharmony_ci	dump_register(DOEPCTL(6)),
41762306a36Sopenharmony_ci	dump_register(DOEPCTL(7)),
41862306a36Sopenharmony_ci	dump_register(DOEPCTL(8)),
41962306a36Sopenharmony_ci	dump_register(DOEPCTL(9)),
42062306a36Sopenharmony_ci	dump_register(DOEPCTL(10)),
42162306a36Sopenharmony_ci	dump_register(DOEPCTL(11)),
42262306a36Sopenharmony_ci	dump_register(DOEPCTL(12)),
42362306a36Sopenharmony_ci	dump_register(DOEPCTL(13)),
42462306a36Sopenharmony_ci	dump_register(DOEPCTL(14)),
42562306a36Sopenharmony_ci	dump_register(DOEPCTL(15)),
42662306a36Sopenharmony_ci	dump_register(DIEPINT(0)),
42762306a36Sopenharmony_ci	dump_register(DIEPINT(1)),
42862306a36Sopenharmony_ci	dump_register(DIEPINT(2)),
42962306a36Sopenharmony_ci	dump_register(DIEPINT(3)),
43062306a36Sopenharmony_ci	dump_register(DIEPINT(4)),
43162306a36Sopenharmony_ci	dump_register(DIEPINT(5)),
43262306a36Sopenharmony_ci	dump_register(DIEPINT(6)),
43362306a36Sopenharmony_ci	dump_register(DIEPINT(7)),
43462306a36Sopenharmony_ci	dump_register(DIEPINT(8)),
43562306a36Sopenharmony_ci	dump_register(DIEPINT(9)),
43662306a36Sopenharmony_ci	dump_register(DIEPINT(10)),
43762306a36Sopenharmony_ci	dump_register(DIEPINT(11)),
43862306a36Sopenharmony_ci	dump_register(DIEPINT(12)),
43962306a36Sopenharmony_ci	dump_register(DIEPINT(13)),
44062306a36Sopenharmony_ci	dump_register(DIEPINT(14)),
44162306a36Sopenharmony_ci	dump_register(DIEPINT(15)),
44262306a36Sopenharmony_ci	dump_register(DOEPINT(0)),
44362306a36Sopenharmony_ci	dump_register(DOEPINT(1)),
44462306a36Sopenharmony_ci	dump_register(DOEPINT(2)),
44562306a36Sopenharmony_ci	dump_register(DOEPINT(3)),
44662306a36Sopenharmony_ci	dump_register(DOEPINT(4)),
44762306a36Sopenharmony_ci	dump_register(DOEPINT(5)),
44862306a36Sopenharmony_ci	dump_register(DOEPINT(6)),
44962306a36Sopenharmony_ci	dump_register(DOEPINT(7)),
45062306a36Sopenharmony_ci	dump_register(DOEPINT(8)),
45162306a36Sopenharmony_ci	dump_register(DOEPINT(9)),
45262306a36Sopenharmony_ci	dump_register(DOEPINT(10)),
45362306a36Sopenharmony_ci	dump_register(DOEPINT(11)),
45462306a36Sopenharmony_ci	dump_register(DOEPINT(12)),
45562306a36Sopenharmony_ci	dump_register(DOEPINT(13)),
45662306a36Sopenharmony_ci	dump_register(DOEPINT(14)),
45762306a36Sopenharmony_ci	dump_register(DOEPINT(15)),
45862306a36Sopenharmony_ci	dump_register(DIEPTSIZ(0)),
45962306a36Sopenharmony_ci	dump_register(DIEPTSIZ(1)),
46062306a36Sopenharmony_ci	dump_register(DIEPTSIZ(2)),
46162306a36Sopenharmony_ci	dump_register(DIEPTSIZ(3)),
46262306a36Sopenharmony_ci	dump_register(DIEPTSIZ(4)),
46362306a36Sopenharmony_ci	dump_register(DIEPTSIZ(5)),
46462306a36Sopenharmony_ci	dump_register(DIEPTSIZ(6)),
46562306a36Sopenharmony_ci	dump_register(DIEPTSIZ(7)),
46662306a36Sopenharmony_ci	dump_register(DIEPTSIZ(8)),
46762306a36Sopenharmony_ci	dump_register(DIEPTSIZ(9)),
46862306a36Sopenharmony_ci	dump_register(DIEPTSIZ(10)),
46962306a36Sopenharmony_ci	dump_register(DIEPTSIZ(11)),
47062306a36Sopenharmony_ci	dump_register(DIEPTSIZ(12)),
47162306a36Sopenharmony_ci	dump_register(DIEPTSIZ(13)),
47262306a36Sopenharmony_ci	dump_register(DIEPTSIZ(14)),
47362306a36Sopenharmony_ci	dump_register(DIEPTSIZ(15)),
47462306a36Sopenharmony_ci	dump_register(DOEPTSIZ(0)),
47562306a36Sopenharmony_ci	dump_register(DOEPTSIZ(1)),
47662306a36Sopenharmony_ci	dump_register(DOEPTSIZ(2)),
47762306a36Sopenharmony_ci	dump_register(DOEPTSIZ(3)),
47862306a36Sopenharmony_ci	dump_register(DOEPTSIZ(4)),
47962306a36Sopenharmony_ci	dump_register(DOEPTSIZ(5)),
48062306a36Sopenharmony_ci	dump_register(DOEPTSIZ(6)),
48162306a36Sopenharmony_ci	dump_register(DOEPTSIZ(7)),
48262306a36Sopenharmony_ci	dump_register(DOEPTSIZ(8)),
48362306a36Sopenharmony_ci	dump_register(DOEPTSIZ(9)),
48462306a36Sopenharmony_ci	dump_register(DOEPTSIZ(10)),
48562306a36Sopenharmony_ci	dump_register(DOEPTSIZ(11)),
48662306a36Sopenharmony_ci	dump_register(DOEPTSIZ(12)),
48762306a36Sopenharmony_ci	dump_register(DOEPTSIZ(13)),
48862306a36Sopenharmony_ci	dump_register(DOEPTSIZ(14)),
48962306a36Sopenharmony_ci	dump_register(DOEPTSIZ(15)),
49062306a36Sopenharmony_ci	dump_register(DIEPDMA(0)),
49162306a36Sopenharmony_ci	dump_register(DIEPDMA(1)),
49262306a36Sopenharmony_ci	dump_register(DIEPDMA(2)),
49362306a36Sopenharmony_ci	dump_register(DIEPDMA(3)),
49462306a36Sopenharmony_ci	dump_register(DIEPDMA(4)),
49562306a36Sopenharmony_ci	dump_register(DIEPDMA(5)),
49662306a36Sopenharmony_ci	dump_register(DIEPDMA(6)),
49762306a36Sopenharmony_ci	dump_register(DIEPDMA(7)),
49862306a36Sopenharmony_ci	dump_register(DIEPDMA(8)),
49962306a36Sopenharmony_ci	dump_register(DIEPDMA(9)),
50062306a36Sopenharmony_ci	dump_register(DIEPDMA(10)),
50162306a36Sopenharmony_ci	dump_register(DIEPDMA(11)),
50262306a36Sopenharmony_ci	dump_register(DIEPDMA(12)),
50362306a36Sopenharmony_ci	dump_register(DIEPDMA(13)),
50462306a36Sopenharmony_ci	dump_register(DIEPDMA(14)),
50562306a36Sopenharmony_ci	dump_register(DIEPDMA(15)),
50662306a36Sopenharmony_ci	dump_register(DOEPDMA(0)),
50762306a36Sopenharmony_ci	dump_register(DOEPDMA(1)),
50862306a36Sopenharmony_ci	dump_register(DOEPDMA(2)),
50962306a36Sopenharmony_ci	dump_register(DOEPDMA(3)),
51062306a36Sopenharmony_ci	dump_register(DOEPDMA(4)),
51162306a36Sopenharmony_ci	dump_register(DOEPDMA(5)),
51262306a36Sopenharmony_ci	dump_register(DOEPDMA(6)),
51362306a36Sopenharmony_ci	dump_register(DOEPDMA(7)),
51462306a36Sopenharmony_ci	dump_register(DOEPDMA(8)),
51562306a36Sopenharmony_ci	dump_register(DOEPDMA(9)),
51662306a36Sopenharmony_ci	dump_register(DOEPDMA(10)),
51762306a36Sopenharmony_ci	dump_register(DOEPDMA(11)),
51862306a36Sopenharmony_ci	dump_register(DOEPDMA(12)),
51962306a36Sopenharmony_ci	dump_register(DOEPDMA(13)),
52062306a36Sopenharmony_ci	dump_register(DOEPDMA(14)),
52162306a36Sopenharmony_ci	dump_register(DOEPDMA(15)),
52262306a36Sopenharmony_ci	dump_register(DTXFSTS(0)),
52362306a36Sopenharmony_ci	dump_register(DTXFSTS(1)),
52462306a36Sopenharmony_ci	dump_register(DTXFSTS(2)),
52562306a36Sopenharmony_ci	dump_register(DTXFSTS(3)),
52662306a36Sopenharmony_ci	dump_register(DTXFSTS(4)),
52762306a36Sopenharmony_ci	dump_register(DTXFSTS(5)),
52862306a36Sopenharmony_ci	dump_register(DTXFSTS(6)),
52962306a36Sopenharmony_ci	dump_register(DTXFSTS(7)),
53062306a36Sopenharmony_ci	dump_register(DTXFSTS(8)),
53162306a36Sopenharmony_ci	dump_register(DTXFSTS(9)),
53262306a36Sopenharmony_ci	dump_register(DTXFSTS(10)),
53362306a36Sopenharmony_ci	dump_register(DTXFSTS(11)),
53462306a36Sopenharmony_ci	dump_register(DTXFSTS(12)),
53562306a36Sopenharmony_ci	dump_register(DTXFSTS(13)),
53662306a36Sopenharmony_ci	dump_register(DTXFSTS(14)),
53762306a36Sopenharmony_ci	dump_register(DTXFSTS(15)),
53862306a36Sopenharmony_ci	dump_register(PCGCTL),
53962306a36Sopenharmony_ci	dump_register(HCFG),
54062306a36Sopenharmony_ci	dump_register(HFIR),
54162306a36Sopenharmony_ci	dump_register(HFNUM),
54262306a36Sopenharmony_ci	dump_register(HPTXSTS),
54362306a36Sopenharmony_ci	dump_register(HAINT),
54462306a36Sopenharmony_ci	dump_register(HAINTMSK),
54562306a36Sopenharmony_ci	dump_register(HFLBADDR),
54662306a36Sopenharmony_ci	dump_register(HPRT0),
54762306a36Sopenharmony_ci	dump_register(HCCHAR(0)),
54862306a36Sopenharmony_ci	dump_register(HCCHAR(1)),
54962306a36Sopenharmony_ci	dump_register(HCCHAR(2)),
55062306a36Sopenharmony_ci	dump_register(HCCHAR(3)),
55162306a36Sopenharmony_ci	dump_register(HCCHAR(4)),
55262306a36Sopenharmony_ci	dump_register(HCCHAR(5)),
55362306a36Sopenharmony_ci	dump_register(HCCHAR(6)),
55462306a36Sopenharmony_ci	dump_register(HCCHAR(7)),
55562306a36Sopenharmony_ci	dump_register(HCCHAR(8)),
55662306a36Sopenharmony_ci	dump_register(HCCHAR(9)),
55762306a36Sopenharmony_ci	dump_register(HCCHAR(10)),
55862306a36Sopenharmony_ci	dump_register(HCCHAR(11)),
55962306a36Sopenharmony_ci	dump_register(HCCHAR(12)),
56062306a36Sopenharmony_ci	dump_register(HCCHAR(13)),
56162306a36Sopenharmony_ci	dump_register(HCCHAR(14)),
56262306a36Sopenharmony_ci	dump_register(HCCHAR(15)),
56362306a36Sopenharmony_ci	dump_register(HCSPLT(0)),
56462306a36Sopenharmony_ci	dump_register(HCSPLT(1)),
56562306a36Sopenharmony_ci	dump_register(HCSPLT(2)),
56662306a36Sopenharmony_ci	dump_register(HCSPLT(3)),
56762306a36Sopenharmony_ci	dump_register(HCSPLT(4)),
56862306a36Sopenharmony_ci	dump_register(HCSPLT(5)),
56962306a36Sopenharmony_ci	dump_register(HCSPLT(6)),
57062306a36Sopenharmony_ci	dump_register(HCSPLT(7)),
57162306a36Sopenharmony_ci	dump_register(HCSPLT(8)),
57262306a36Sopenharmony_ci	dump_register(HCSPLT(9)),
57362306a36Sopenharmony_ci	dump_register(HCSPLT(10)),
57462306a36Sopenharmony_ci	dump_register(HCSPLT(11)),
57562306a36Sopenharmony_ci	dump_register(HCSPLT(12)),
57662306a36Sopenharmony_ci	dump_register(HCSPLT(13)),
57762306a36Sopenharmony_ci	dump_register(HCSPLT(14)),
57862306a36Sopenharmony_ci	dump_register(HCSPLT(15)),
57962306a36Sopenharmony_ci	dump_register(HCINT(0)),
58062306a36Sopenharmony_ci	dump_register(HCINT(1)),
58162306a36Sopenharmony_ci	dump_register(HCINT(2)),
58262306a36Sopenharmony_ci	dump_register(HCINT(3)),
58362306a36Sopenharmony_ci	dump_register(HCINT(4)),
58462306a36Sopenharmony_ci	dump_register(HCINT(5)),
58562306a36Sopenharmony_ci	dump_register(HCINT(6)),
58662306a36Sopenharmony_ci	dump_register(HCINT(7)),
58762306a36Sopenharmony_ci	dump_register(HCINT(8)),
58862306a36Sopenharmony_ci	dump_register(HCINT(9)),
58962306a36Sopenharmony_ci	dump_register(HCINT(10)),
59062306a36Sopenharmony_ci	dump_register(HCINT(11)),
59162306a36Sopenharmony_ci	dump_register(HCINT(12)),
59262306a36Sopenharmony_ci	dump_register(HCINT(13)),
59362306a36Sopenharmony_ci	dump_register(HCINT(14)),
59462306a36Sopenharmony_ci	dump_register(HCINT(15)),
59562306a36Sopenharmony_ci	dump_register(HCINTMSK(0)),
59662306a36Sopenharmony_ci	dump_register(HCINTMSK(1)),
59762306a36Sopenharmony_ci	dump_register(HCINTMSK(2)),
59862306a36Sopenharmony_ci	dump_register(HCINTMSK(3)),
59962306a36Sopenharmony_ci	dump_register(HCINTMSK(4)),
60062306a36Sopenharmony_ci	dump_register(HCINTMSK(5)),
60162306a36Sopenharmony_ci	dump_register(HCINTMSK(6)),
60262306a36Sopenharmony_ci	dump_register(HCINTMSK(7)),
60362306a36Sopenharmony_ci	dump_register(HCINTMSK(8)),
60462306a36Sopenharmony_ci	dump_register(HCINTMSK(9)),
60562306a36Sopenharmony_ci	dump_register(HCINTMSK(10)),
60662306a36Sopenharmony_ci	dump_register(HCINTMSK(11)),
60762306a36Sopenharmony_ci	dump_register(HCINTMSK(12)),
60862306a36Sopenharmony_ci	dump_register(HCINTMSK(13)),
60962306a36Sopenharmony_ci	dump_register(HCINTMSK(14)),
61062306a36Sopenharmony_ci	dump_register(HCINTMSK(15)),
61162306a36Sopenharmony_ci	dump_register(HCTSIZ(0)),
61262306a36Sopenharmony_ci	dump_register(HCTSIZ(1)),
61362306a36Sopenharmony_ci	dump_register(HCTSIZ(2)),
61462306a36Sopenharmony_ci	dump_register(HCTSIZ(3)),
61562306a36Sopenharmony_ci	dump_register(HCTSIZ(4)),
61662306a36Sopenharmony_ci	dump_register(HCTSIZ(5)),
61762306a36Sopenharmony_ci	dump_register(HCTSIZ(6)),
61862306a36Sopenharmony_ci	dump_register(HCTSIZ(7)),
61962306a36Sopenharmony_ci	dump_register(HCTSIZ(8)),
62062306a36Sopenharmony_ci	dump_register(HCTSIZ(9)),
62162306a36Sopenharmony_ci	dump_register(HCTSIZ(10)),
62262306a36Sopenharmony_ci	dump_register(HCTSIZ(11)),
62362306a36Sopenharmony_ci	dump_register(HCTSIZ(12)),
62462306a36Sopenharmony_ci	dump_register(HCTSIZ(13)),
62562306a36Sopenharmony_ci	dump_register(HCTSIZ(14)),
62662306a36Sopenharmony_ci	dump_register(HCTSIZ(15)),
62762306a36Sopenharmony_ci	dump_register(HCDMA(0)),
62862306a36Sopenharmony_ci	dump_register(HCDMA(1)),
62962306a36Sopenharmony_ci	dump_register(HCDMA(2)),
63062306a36Sopenharmony_ci	dump_register(HCDMA(3)),
63162306a36Sopenharmony_ci	dump_register(HCDMA(4)),
63262306a36Sopenharmony_ci	dump_register(HCDMA(5)),
63362306a36Sopenharmony_ci	dump_register(HCDMA(6)),
63462306a36Sopenharmony_ci	dump_register(HCDMA(7)),
63562306a36Sopenharmony_ci	dump_register(HCDMA(8)),
63662306a36Sopenharmony_ci	dump_register(HCDMA(9)),
63762306a36Sopenharmony_ci	dump_register(HCDMA(10)),
63862306a36Sopenharmony_ci	dump_register(HCDMA(11)),
63962306a36Sopenharmony_ci	dump_register(HCDMA(12)),
64062306a36Sopenharmony_ci	dump_register(HCDMA(13)),
64162306a36Sopenharmony_ci	dump_register(HCDMA(14)),
64262306a36Sopenharmony_ci	dump_register(HCDMA(15)),
64362306a36Sopenharmony_ci	dump_register(HCDMAB(0)),
64462306a36Sopenharmony_ci	dump_register(HCDMAB(1)),
64562306a36Sopenharmony_ci	dump_register(HCDMAB(2)),
64662306a36Sopenharmony_ci	dump_register(HCDMAB(3)),
64762306a36Sopenharmony_ci	dump_register(HCDMAB(4)),
64862306a36Sopenharmony_ci	dump_register(HCDMAB(5)),
64962306a36Sopenharmony_ci	dump_register(HCDMAB(6)),
65062306a36Sopenharmony_ci	dump_register(HCDMAB(7)),
65162306a36Sopenharmony_ci	dump_register(HCDMAB(8)),
65262306a36Sopenharmony_ci	dump_register(HCDMAB(9)),
65362306a36Sopenharmony_ci	dump_register(HCDMAB(10)),
65462306a36Sopenharmony_ci	dump_register(HCDMAB(11)),
65562306a36Sopenharmony_ci	dump_register(HCDMAB(12)),
65662306a36Sopenharmony_ci	dump_register(HCDMAB(13)),
65762306a36Sopenharmony_ci	dump_register(HCDMAB(14)),
65862306a36Sopenharmony_ci	dump_register(HCDMAB(15)),
65962306a36Sopenharmony_ci};
66062306a36Sopenharmony_ci
66162306a36Sopenharmony_ci#define print_param(_seq, _ptr, _param) \
66262306a36Sopenharmony_ciseq_printf((_seq), "%-30s: %d\n", #_param, (_ptr)->_param)
66362306a36Sopenharmony_ci
66462306a36Sopenharmony_ci#define print_param_hex(_seq, _ptr, _param) \
66562306a36Sopenharmony_ciseq_printf((_seq), "%-30s: 0x%x\n", #_param, (_ptr)->_param)
66662306a36Sopenharmony_ci
66762306a36Sopenharmony_cistatic int params_show(struct seq_file *seq, void *v)
66862306a36Sopenharmony_ci{
66962306a36Sopenharmony_ci	struct dwc2_hsotg *hsotg = seq->private;
67062306a36Sopenharmony_ci	struct dwc2_core_params *p = &hsotg->params;
67162306a36Sopenharmony_ci	int i;
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_ci	print_param(seq, p, otg_caps.hnp_support);
67462306a36Sopenharmony_ci	print_param(seq, p, otg_caps.srp_support);
67562306a36Sopenharmony_ci	print_param(seq, p, otg_caps.otg_rev);
67662306a36Sopenharmony_ci	print_param(seq, p, dma_desc_enable);
67762306a36Sopenharmony_ci	print_param(seq, p, dma_desc_fs_enable);
67862306a36Sopenharmony_ci	print_param(seq, p, speed);
67962306a36Sopenharmony_ci	print_param(seq, p, enable_dynamic_fifo);
68062306a36Sopenharmony_ci	print_param(seq, p, en_multiple_tx_fifo);
68162306a36Sopenharmony_ci	print_param(seq, p, host_rx_fifo_size);
68262306a36Sopenharmony_ci	print_param(seq, p, host_nperio_tx_fifo_size);
68362306a36Sopenharmony_ci	print_param(seq, p, host_perio_tx_fifo_size);
68462306a36Sopenharmony_ci	print_param(seq, p, max_transfer_size);
68562306a36Sopenharmony_ci	print_param(seq, p, max_packet_count);
68662306a36Sopenharmony_ci	print_param(seq, p, host_channels);
68762306a36Sopenharmony_ci	print_param(seq, p, phy_type);
68862306a36Sopenharmony_ci	print_param(seq, p, phy_utmi_width);
68962306a36Sopenharmony_ci	print_param(seq, p, phy_ulpi_ddr);
69062306a36Sopenharmony_ci	print_param(seq, p, phy_ulpi_ext_vbus);
69162306a36Sopenharmony_ci	print_param(seq, p, i2c_enable);
69262306a36Sopenharmony_ci	print_param(seq, p, ipg_isoc_en);
69362306a36Sopenharmony_ci	print_param(seq, p, ulpi_fs_ls);
69462306a36Sopenharmony_ci	print_param(seq, p, host_support_fs_ls_low_power);
69562306a36Sopenharmony_ci	print_param(seq, p, host_ls_low_power_phy_clk);
69662306a36Sopenharmony_ci	print_param(seq, p, activate_stm_fs_transceiver);
69762306a36Sopenharmony_ci	print_param(seq, p, activate_stm_id_vb_detection);
69862306a36Sopenharmony_ci	print_param(seq, p, ts_dline);
69962306a36Sopenharmony_ci	print_param(seq, p, reload_ctl);
70062306a36Sopenharmony_ci	print_param_hex(seq, p, ahbcfg);
70162306a36Sopenharmony_ci	print_param(seq, p, uframe_sched);
70262306a36Sopenharmony_ci	print_param(seq, p, external_id_pin_ctl);
70362306a36Sopenharmony_ci	print_param(seq, p, power_down);
70462306a36Sopenharmony_ci	print_param(seq, p, lpm);
70562306a36Sopenharmony_ci	print_param(seq, p, lpm_clock_gating);
70662306a36Sopenharmony_ci	print_param(seq, p, besl);
70762306a36Sopenharmony_ci	print_param(seq, p, hird_threshold_en);
70862306a36Sopenharmony_ci	print_param(seq, p, hird_threshold);
70962306a36Sopenharmony_ci	print_param(seq, p, service_interval);
71062306a36Sopenharmony_ci	print_param(seq, p, host_dma);
71162306a36Sopenharmony_ci	print_param(seq, p, g_dma);
71262306a36Sopenharmony_ci	print_param(seq, p, g_dma_desc);
71362306a36Sopenharmony_ci	print_param(seq, p, g_rx_fifo_size);
71462306a36Sopenharmony_ci	print_param(seq, p, g_np_tx_fifo_size);
71562306a36Sopenharmony_ci
71662306a36Sopenharmony_ci	for (i = 0; i < MAX_EPS_CHANNELS; i++) {
71762306a36Sopenharmony_ci		char str[32];
71862306a36Sopenharmony_ci
71962306a36Sopenharmony_ci		snprintf(str, 32, "g_tx_fifo_size[%d]", i);
72062306a36Sopenharmony_ci		seq_printf(seq, "%-30s: %d\n", str, p->g_tx_fifo_size[i]);
72162306a36Sopenharmony_ci	}
72262306a36Sopenharmony_ci
72362306a36Sopenharmony_ci	return 0;
72462306a36Sopenharmony_ci}
72562306a36Sopenharmony_ciDEFINE_SHOW_ATTRIBUTE(params);
72662306a36Sopenharmony_ci
72762306a36Sopenharmony_cistatic int hw_params_show(struct seq_file *seq, void *v)
72862306a36Sopenharmony_ci{
72962306a36Sopenharmony_ci	struct dwc2_hsotg *hsotg = seq->private;
73062306a36Sopenharmony_ci	struct dwc2_hw_params *hw = &hsotg->hw_params;
73162306a36Sopenharmony_ci
73262306a36Sopenharmony_ci	print_param(seq, hw, op_mode);
73362306a36Sopenharmony_ci	print_param(seq, hw, arch);
73462306a36Sopenharmony_ci	print_param(seq, hw, dma_desc_enable);
73562306a36Sopenharmony_ci	print_param(seq, hw, enable_dynamic_fifo);
73662306a36Sopenharmony_ci	print_param(seq, hw, en_multiple_tx_fifo);
73762306a36Sopenharmony_ci	print_param(seq, hw, rx_fifo_size);
73862306a36Sopenharmony_ci	print_param(seq, hw, host_nperio_tx_fifo_size);
73962306a36Sopenharmony_ci	print_param(seq, hw, dev_nperio_tx_fifo_size);
74062306a36Sopenharmony_ci	print_param(seq, hw, host_perio_tx_fifo_size);
74162306a36Sopenharmony_ci	print_param(seq, hw, nperio_tx_q_depth);
74262306a36Sopenharmony_ci	print_param(seq, hw, host_perio_tx_q_depth);
74362306a36Sopenharmony_ci	print_param(seq, hw, dev_token_q_depth);
74462306a36Sopenharmony_ci	print_param(seq, hw, max_transfer_size);
74562306a36Sopenharmony_ci	print_param(seq, hw, max_packet_count);
74662306a36Sopenharmony_ci	print_param(seq, hw, host_channels);
74762306a36Sopenharmony_ci	print_param(seq, hw, hs_phy_type);
74862306a36Sopenharmony_ci	print_param(seq, hw, fs_phy_type);
74962306a36Sopenharmony_ci	print_param(seq, hw, i2c_enable);
75062306a36Sopenharmony_ci	print_param(seq, hw, num_dev_ep);
75162306a36Sopenharmony_ci	print_param(seq, hw, num_dev_perio_in_ep);
75262306a36Sopenharmony_ci	print_param(seq, hw, total_fifo_size);
75362306a36Sopenharmony_ci	print_param(seq, hw, power_optimized);
75462306a36Sopenharmony_ci	print_param(seq, hw, utmi_phy_data_width);
75562306a36Sopenharmony_ci	print_param_hex(seq, hw, snpsid);
75662306a36Sopenharmony_ci	print_param_hex(seq, hw, dev_ep_dirs);
75762306a36Sopenharmony_ci
75862306a36Sopenharmony_ci	return 0;
75962306a36Sopenharmony_ci}
76062306a36Sopenharmony_ciDEFINE_SHOW_ATTRIBUTE(hw_params);
76162306a36Sopenharmony_ci
76262306a36Sopenharmony_cistatic int dr_mode_show(struct seq_file *seq, void *v)
76362306a36Sopenharmony_ci{
76462306a36Sopenharmony_ci	struct dwc2_hsotg *hsotg = seq->private;
76562306a36Sopenharmony_ci	const char *dr_mode = "";
76662306a36Sopenharmony_ci
76762306a36Sopenharmony_ci	device_property_read_string(hsotg->dev, "dr_mode", &dr_mode);
76862306a36Sopenharmony_ci	seq_printf(seq, "%s\n", dr_mode);
76962306a36Sopenharmony_ci	return 0;
77062306a36Sopenharmony_ci}
77162306a36Sopenharmony_ciDEFINE_SHOW_ATTRIBUTE(dr_mode);
77262306a36Sopenharmony_ci
77362306a36Sopenharmony_ciint dwc2_debugfs_init(struct dwc2_hsotg *hsotg)
77462306a36Sopenharmony_ci{
77562306a36Sopenharmony_ci	int			ret;
77662306a36Sopenharmony_ci	struct dentry		*root;
77762306a36Sopenharmony_ci
77862306a36Sopenharmony_ci	root = debugfs_create_dir(dev_name(hsotg->dev), usb_debug_root);
77962306a36Sopenharmony_ci	hsotg->debug_root = root;
78062306a36Sopenharmony_ci
78162306a36Sopenharmony_ci	debugfs_create_file("params", 0444, root, hsotg, &params_fops);
78262306a36Sopenharmony_ci	debugfs_create_file("hw_params", 0444, root, hsotg, &hw_params_fops);
78362306a36Sopenharmony_ci	debugfs_create_file("dr_mode", 0444, root, hsotg, &dr_mode_fops);
78462306a36Sopenharmony_ci
78562306a36Sopenharmony_ci	/* Add gadget debugfs nodes */
78662306a36Sopenharmony_ci	dwc2_hsotg_create_debug(hsotg);
78762306a36Sopenharmony_ci
78862306a36Sopenharmony_ci	hsotg->regset = devm_kzalloc(hsotg->dev, sizeof(*hsotg->regset),
78962306a36Sopenharmony_ci								GFP_KERNEL);
79062306a36Sopenharmony_ci	if (!hsotg->regset) {
79162306a36Sopenharmony_ci		ret = -ENOMEM;
79262306a36Sopenharmony_ci		goto err;
79362306a36Sopenharmony_ci	}
79462306a36Sopenharmony_ci
79562306a36Sopenharmony_ci	hsotg->regset->regs = dwc2_regs;
79662306a36Sopenharmony_ci	hsotg->regset->nregs = ARRAY_SIZE(dwc2_regs);
79762306a36Sopenharmony_ci	hsotg->regset->base = hsotg->regs;
79862306a36Sopenharmony_ci
79962306a36Sopenharmony_ci	debugfs_create_regset32("regdump", 0444, root, hsotg->regset);
80062306a36Sopenharmony_ci
80162306a36Sopenharmony_ci	return 0;
80262306a36Sopenharmony_cierr:
80362306a36Sopenharmony_ci	debugfs_remove_recursive(hsotg->debug_root);
80462306a36Sopenharmony_ci	return ret;
80562306a36Sopenharmony_ci}
80662306a36Sopenharmony_ci
80762306a36Sopenharmony_civoid dwc2_debugfs_exit(struct dwc2_hsotg *hsotg)
80862306a36Sopenharmony_ci{
80962306a36Sopenharmony_ci	debugfs_remove_recursive(hsotg->debug_root);
81062306a36Sopenharmony_ci	hsotg->debug_root = NULL;
81162306a36Sopenharmony_ci}
812