Lines Matching +full:enable +full:- +full:manual +full:- +full:drd
1 // SPDX-License-Identifier: GPL-2.0
3 * mtu3_debugfs.c - debugfs interface
81 struct mtu3 *mtu = sf->private; in mtu3_link_state_show()
82 void __iomem *mbase = mtu->mac_base; in mtu3_link_state_show()
93 struct mtu3 *mtu = sf->private; in mtu3_ep_used_show()
99 spin_lock_irqsave(&mtu->lock, flags); in mtu3_ep_used_show()
101 for (i = 0; i < mtu->num_eps; i++) { in mtu3_ep_used_show()
102 mep = mtu->in_eps + i; in mtu3_ep_used_show()
103 if (mep->flags & MTU3_EP_ENABLED) { in mtu3_ep_used_show()
104 seq_printf(sf, "%s - type: %s\n", mep->name, usb_ep_type_string(mep->type)); in mtu3_ep_used_show()
108 mep = mtu->out_eps + i; in mtu3_ep_used_show()
109 if (mep->flags & MTU3_EP_ENABLED) { in mtu3_ep_used_show()
110 seq_printf(sf, "%s - type: %s\n", mep->name, usb_ep_type_string(mep->type)); in mtu3_ep_used_show()
116 spin_unlock_irqrestore(&mtu->lock, flags); in mtu3_ep_used_show()
131 mregs = devm_kzalloc(mtu->dev, sizeof(*mregs), GFP_KERNEL); in mtu3_debugfs_regset()
135 sprintf(mregs->name, "%s", name); in mtu3_debugfs_regset()
136 regset = &mregs->regset; in mtu3_debugfs_regset()
137 regset->regs = regs; in mtu3_debugfs_regset()
138 regset->nregs = nregs; in mtu3_debugfs_regset()
139 regset->base = base; in mtu3_debugfs_regset()
141 debugfs_create_regset32(mregs->name, 0444, parent, regset); in mtu3_debugfs_regset()
148 int epnum = mep->epnum; in mtu3_debugfs_ep_regset()
149 int in = mep->is_in; in mtu3_debugfs_ep_regset()
151 regs = devm_kcalloc(mtu->dev, 7, sizeof(*regs), GFP_KERNEL); in mtu3_debugfs_ep_regset()
170 mtu3_debugfs_regset(mtu, mtu->mac_base, regs, 7, "ep-regs", parent); in mtu3_debugfs_ep_regset()
175 struct mtu3_ep *mep = sf->private; in mtu3_ep_info_show()
176 struct mtu3 *mtu = mep->mtu; in mtu3_ep_info_show()
179 spin_lock_irqsave(&mtu->lock, flags); in mtu3_ep_info_show()
180 seq_printf(sf, "ep - type:%s, maxp:%d, slot:%d, flags:%x\n", in mtu3_ep_info_show()
181 usb_ep_type_string(mep->type), mep->maxp, mep->slot, mep->flags); in mtu3_ep_info_show()
182 spin_unlock_irqrestore(&mtu->lock, flags); in mtu3_ep_info_show()
189 struct mtu3_ep *mep = sf->private; in mtu3_fifo_show()
190 struct mtu3 *mtu = mep->mtu; in mtu3_fifo_show()
193 spin_lock_irqsave(&mtu->lock, flags); in mtu3_fifo_show()
194 seq_printf(sf, "fifo - seg_size:%d, addr:%d, size:%d\n", in mtu3_fifo_show()
195 mep->fifo_seg_size, mep->fifo_addr, mep->fifo_size); in mtu3_fifo_show()
196 spin_unlock_irqrestore(&mtu->lock, flags); in mtu3_fifo_show()
203 struct mtu3_ep *mep = sf->private; in mtu3_qmu_ring_show()
204 struct mtu3 *mtu = mep->mtu; in mtu3_qmu_ring_show()
208 ring = &mep->gpd_ring; in mtu3_qmu_ring_show()
209 spin_lock_irqsave(&mtu->lock, flags); in mtu3_qmu_ring_show()
211 "qmu-ring - dma:%pad, start:%p, end:%p, enq:%p, dep:%p\n", in mtu3_qmu_ring_show()
212 &ring->dma, ring->start, ring->end, in mtu3_qmu_ring_show()
213 ring->enqueue, ring->dequeue); in mtu3_qmu_ring_show()
214 spin_unlock_irqrestore(&mtu->lock, flags); in mtu3_qmu_ring_show()
221 struct mtu3_ep *mep = sf->private; in mtu3_qmu_gpd_show()
222 struct mtu3 *mtu = mep->mtu; in mtu3_qmu_gpd_show()
229 spin_lock_irqsave(&mtu->lock, flags); in mtu3_qmu_gpd_show()
230 ring = &mep->gpd_ring; in mtu3_qmu_gpd_show()
231 gpd = ring->start; in mtu3_qmu_gpd_show()
232 if (!gpd || !(mep->flags & MTU3_EP_ENABLED)) { in mtu3_qmu_gpd_show()
238 dma = ring->dma + i * sizeof(*gpd); in mtu3_qmu_gpd_show()
239 seq_printf(sf, "gpd.%03d -> %pad, %p: %08x %08x %08x %08x\n", in mtu3_qmu_gpd_show()
240 i, &dma, gpd, gpd->dw0_info, gpd->next_gpd, in mtu3_qmu_gpd_show()
241 gpd->buffer, gpd->dw3_info); in mtu3_qmu_gpd_show()
245 spin_unlock_irqrestore(&mtu->lock, flags); in mtu3_qmu_gpd_show()
251 {"ep-info", mtu3_ep_info_show, },
253 {"qmu-ring", mtu3_qmu_ring_show, },
254 {"qmu-gpd", mtu3_qmu_gpd_show, },
259 const char *file_name = file_dentry(file)->d_iname; in mtu3_ep_open()
266 if (strcmp(f_map->name, file_name) == 0) in mtu3_ep_open()
270 return single_open(file, f_map->show, inode->i_private); in mtu3_ep_open()
281 dump_prb_reg("enable", U3D_SSUSB_PRB_CTRL0),
282 dump_prb_reg("byte-sell", U3D_SSUSB_PRB_CTRL1),
283 dump_prb_reg("byte-selh", U3D_SSUSB_PRB_CTRL2),
284 dump_prb_reg("module-sel", U3D_SSUSB_PRB_CTRL3),
285 dump_prb_reg("sw-out", U3D_SSUSB_PRB_CTRL4),
291 const char *file_name = file_dentry(sf->file)->d_iname; in mtu3_probe_show()
292 struct mtu3 *mtu = sf->private; in mtu3_probe_show()
299 if (strcmp(regs->name, file_name) == 0) in mtu3_probe_show()
303 seq_printf(sf, "0x%04x - 0x%08x\n", (u32)regs->offset, in mtu3_probe_show()
304 mtu3_readl(mtu->ippc_base, (u32)regs->offset)); in mtu3_probe_show()
311 return single_open(file, mtu3_probe_show, inode->i_private); in mtu3_probe_open()
317 const char *file_name = file_dentry(file)->d_iname; in mtu3_probe_write()
318 struct seq_file *sf = file->private_data; in mtu3_probe_write()
319 struct mtu3 *mtu = sf->private; in mtu3_probe_write()
325 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) in mtu3_probe_write()
326 return -EFAULT; in mtu3_probe_write()
329 return -EINVAL; in mtu3_probe_write()
334 if (strcmp(regs->name, file_name) == 0) in mtu3_probe_write()
337 mtu3_writel(mtu->ippc_base, (u32)regs->offset, val); in mtu3_probe_write()
352 struct ssusb_mtk *ssusb = mtu->ssusb; in mtu3_debugfs_create_prb_files()
357 dir_prb = debugfs_create_dir("probe", ssusb->dbgfs_root); in mtu3_debugfs_create_prb_files()
361 debugfs_create_file(regs->name, 0644, dir_prb, in mtu3_debugfs_create_prb_files()
365 mtu3_debugfs_regset(mtu, mtu->ippc_base, mtu3_prb_regs, in mtu3_debugfs_create_prb_files()
376 dir_ep = debugfs_create_dir(mep->name, parent); in mtu3_debugfs_create_ep_dir()
377 mtu3_debugfs_ep_regset(mep->mtu, mep, dir_ep); in mtu3_debugfs_create_ep_dir()
382 debugfs_create_file(files->name, 0444, dir_ep, in mtu3_debugfs_create_ep_dir()
389 struct ssusb_mtk *ssusb = mtu->ssusb; in mtu3_debugfs_create_ep_dirs()
393 dir_eps = debugfs_create_dir("eps", ssusb->dbgfs_root); in mtu3_debugfs_create_ep_dirs()
395 for (i = 1; i < mtu->num_eps; i++) { in mtu3_debugfs_create_ep_dirs()
396 mtu3_debugfs_create_ep_dir(mtu->in_eps + i, dir_eps); in mtu3_debugfs_create_ep_dirs()
397 mtu3_debugfs_create_ep_dir(mtu->out_eps + i, dir_eps); in mtu3_debugfs_create_ep_dirs()
403 struct mtu3 *mtu = ssusb->u3d; in ssusb_dev_debugfs_init()
406 dir_regs = debugfs_create_dir("regs", ssusb->dbgfs_root); in ssusb_dev_debugfs_init()
408 mtu3_debugfs_regset(mtu, mtu->ippc_base, in ssusb_dev_debugfs_init()
410 "reg-ippc", dir_regs); in ssusb_dev_debugfs_init()
412 mtu3_debugfs_regset(mtu, mtu->mac_base, in ssusb_dev_debugfs_init()
414 "reg-dev", dir_regs); in ssusb_dev_debugfs_init()
416 mtu3_debugfs_regset(mtu, mtu->mac_base, in ssusb_dev_debugfs_init()
418 "reg-csr", dir_regs); in ssusb_dev_debugfs_init()
424 debugfs_create_file("link-state", 0444, ssusb->dbgfs_root, in ssusb_dev_debugfs_init()
426 debugfs_create_file("ep-used", 0444, ssusb->dbgfs_root, in ssusb_dev_debugfs_init()
432 struct ssusb_mtk *ssusb = sf->private; in ssusb_mode_show()
434 seq_printf(sf, "current mode: %s(%s drd)\n(echo device/host)\n", in ssusb_mode_show()
435 ssusb->is_host ? "host" : "device", in ssusb_mode_show()
436 ssusb->otg_switch.manual_drd_enabled ? "manual" : "auto"); in ssusb_mode_show()
443 return single_open(file, ssusb_mode_show, inode->i_private); in ssusb_mode_open()
449 struct seq_file *sf = file->private_data; in ssusb_mode_write()
450 struct ssusb_mtk *ssusb = sf->private; in ssusb_mode_write()
453 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) in ssusb_mode_write()
454 return -EFAULT; in ssusb_mode_write()
456 if (!strncmp(buf, "host", 4) && !ssusb->is_host) { in ssusb_mode_write()
458 } else if (!strncmp(buf, "device", 6) && ssusb->is_host) { in ssusb_mode_write()
461 dev_err(ssusb->dev, "wrong or duplicated setting\n"); in ssusb_mode_write()
462 return -EINVAL; in ssusb_mode_write()
478 struct ssusb_mtk *ssusb = sf->private; in ssusb_vbus_show()
479 struct otg_switch_mtk *otg_sx = &ssusb->otg_switch; in ssusb_vbus_show()
482 regulator_is_enabled(otg_sx->vbus) ? "on" : "off"); in ssusb_vbus_show()
489 return single_open(file, ssusb_vbus_show, inode->i_private); in ssusb_vbus_open()
495 struct seq_file *sf = file->private_data; in ssusb_vbus_write()
496 struct ssusb_mtk *ssusb = sf->private; in ssusb_vbus_write()
497 struct otg_switch_mtk *otg_sx = &ssusb->otg_switch; in ssusb_vbus_write()
499 bool enable; in ssusb_vbus_write() local
501 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) in ssusb_vbus_write()
502 return -EFAULT; in ssusb_vbus_write()
504 if (kstrtobool(buf, &enable)) { in ssusb_vbus_write()
505 dev_err(ssusb->dev, "wrong setting\n"); in ssusb_vbus_write()
506 return -EINVAL; in ssusb_vbus_write()
509 ssusb_set_vbus(otg_sx, enable); in ssusb_vbus_write()
524 struct dentry *root = ssusb->dbgfs_root; in ssusb_dr_debugfs_init()
532 ssusb->dbgfs_root = in ssusb_debugfs_create_root()
533 debugfs_create_dir(dev_name(ssusb->dev), usb_debug_root); in ssusb_debugfs_create_root()
538 debugfs_remove_recursive(ssusb->dbgfs_root); in ssusb_debugfs_remove_root()
539 ssusb->dbgfs_root = NULL; in ssusb_debugfs_remove_root()