Re: [PATCH v3 12/13] usb: chipidea: debug: add debug file for controller registers dump.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 27, 2014 at 07:38:30AM +0800, Li Jun wrote:
> This patch adds below registers dump for debug:
> - USBINTR
> - USBSTS
> - USBMODE
> - USBCMD
> - PORTSC
> - OTGSC
> 
> Signed-off-by: Li Jun <b47624@xxxxxxxxxxxxx>
> ---
>  drivers/usb/chipidea/debug.c |   48 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c
> index 06be301..bcc7b8a 100644
> --- a/drivers/usb/chipidea/debug.c
> +++ b/drivers/usb/chipidea/debug.c
> @@ -331,6 +331,48 @@ static const struct file_operations ci_role_fops = {
>  	.release	= single_release,
>  };
>  
> +int ci_registers_show(struct seq_file *s, void *unused)
> +{
> +	struct ci_hdrc *ci = s->private;
> +	u32 tmp_reg;
> +
> +	if (!ci)
> +		return 0;
> +
> +	/* ------ Registers ----- */
> +	tmp_reg = hw_read_intr_enable(ci);
> +	seq_printf(s, "USBINTR reg: %08x\n", tmp_reg);
> +
> +	tmp_reg = hw_read_intr_status(ci);
> +	seq_printf(s, "USBSTS reg: %08x\n", tmp_reg);
> +
> +	tmp_reg = hw_read(ci, OP_USBMODE, ~0);
> +	seq_printf(s, "USBMODE reg: %08x\n", tmp_reg);
> +
> +	tmp_reg = hw_read(ci, OP_USBCMD, ~0);
> +	seq_printf(s, "USBCMD reg: %08x\n", tmp_reg);
> +
> +	tmp_reg = hw_read(ci, OP_PORTSC, ~0);
> +	seq_printf(s, "PORTSC reg: %08x\n", tmp_reg);
> +
> +	tmp_reg = hw_read(ci, OP_OTGSC, ~0);
> +	seq_printf(s, "OTGSC reg: %08x\n", tmp_reg);
> +

So chipidea controller doesn't have otgsc register, please consider
this situation.

> +	return 0;
> +}
> +
> +static int ci_registers_open(struct inode *inode, struct file *file)
> +{
> +	return single_open(file, ci_registers_show, inode->i_private);
> +}
> +
> +static const struct file_operations ci_registers_fops = {
> +	.open			= ci_registers_open,
> +	.read			= seq_read,
> +	.llseek			= seq_lseek,
> +	.release		= single_release,
> +};
> +
>  /**
>   * dbg_create_files: initializes the attribute interface
>   * @ci: device
> @@ -374,6 +416,12 @@ int dbg_create_files(struct ci_hdrc *ci)
>  
>  	dent = debugfs_create_file("role", S_IRUGO | S_IWUSR, ci->debugfs, ci,
>  				   &ci_role_fops);
> +	if (!dent)
> +		goto err;
> +
> +	dent = debugfs_create_file("registers", S_IRUGO, ci->debugfs, ci,
> +				&ci_registers_fops);
> +
>  	if (dent)
>  		return 0;
>  err:
> -- 
> 1.7.9.5
> 
> 

This patch is not related to this otg fsm patchset, please send it
separately.

-- 

Best Regards,
Peter Chen

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux