History log of /linux-master/drivers/usb/musb/musb_debugfs.c
Revision Date Author Comments
# 6658a62e 22-Sep-2023 Xingxing Luo <xingxing.luo@unisoc.com>

usb: musb: Modify the "HWVers" register address

musb HWVers rgister address is not 0x69, if we operate the
wrong address 0x69, it will cause a kernel crash, because
there is no register corresponding to this address in the
additional control register of musb. In fact, HWVers has
been defined in musb_register.h, and the name is
"MUSB_HWVERS", so We need to use this macro instead of 0x69.

Fixes: c2365ce5d5a0 ("usb: musb: replace hard coded registers with defines")
Cc: stable@vger.kernel.org
Signed-off-by: Xingxing Luo <xingxing.luo@unisoc.com>
Link: https://lore.kernel.org/r/20230922075929.31074-1-xingxing.luo@unisoc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 21acc656 26-Oct-2022 Paul Cercueil <paul@crapouillou.net>

usb: musb: Add and use inline functions musb_{get,set}_state

Instead of manipulating musb->xceiv->otg->state directly, use the newly
introduced musb_get_state() and musb_set_state() inline functions.

Later, these inline functions will be modified to get rid of the
musb->xceiv dependency, which prevents the musb code from using the
generic PHY subsystem.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20221026182657.146630-2-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e4befc12 24-May-2020 Dinghao Liu <dinghao.liu@zju.edu.cn>

usb: musb: Fix runtime PM imbalance on error

When copy_from_user() returns an error code, there
is a runtime PM usage counter imbalance.

Fix this by moving copy_from_user() to the beginning
of this function.

Fixes: 7b6c1b4c0e1e ("usb: musb: fix runtime PM in debugfs")

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Cc: stable@vger.kernel.org
Signed-off-by: Bin Liu <b-liu@ti.com>
Link: https://lore.kernel.org/r/20200525025049.3400-7-b-liu@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d4836b69 19-Nov-2019 Chunfeng Yun <chunfeng.yun@mediatek.com>

usb: musb: create debugfs directory under usb root

Now the USB gadget subsystem can use the USB debugfs root directory,
so move musb's directory from the root of the debugfs filesystem into
the root of usb

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1574232183-5760-1-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8a1ef171 29-May-2018 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: musb: clean up debugfs file and directory creation

When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.

Because of this, lots of init functions do not need to have return
values, so this cleans up a lot of unused error handling code that never
could have triggered in the past.

Cc: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a9762b70 09-Mar-2018 Arnd Bergmann <arnd@arndb.de>

usb: musb: remove blackfin port

The blackfin architecture is getting removed, so we can clean up
all the special cases in the musb driver.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Aaron Wu <aaron.wu@analog.com>
Acked-by: Bin Liu <b-liu@ti.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
[arnd: adding in fixups from Aaron and Stephen]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>


# efb85c4d 14-Feb-2018 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

USB: musb: Re-use DEFINE_SHOW_ATTRIBUTE() macro

...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 21b650c2 06-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: musb: Remove redundant license text

Now that the SPDX tag is in all USB files, that identifies the license
in a specific and legally-defined manner. So the extra GPL text wording
can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text. And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Acked-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5fd54ace 03-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: add SPDX identifiers to all remaining files in drivers/usb/

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/usb/ and include/linux/usb* files with the correct
SPDX license identifier based on the license text in the file itself.
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7eebe4ec 01-Feb-2017 Pali Rohár <pali@kernel.org>

usb: musb: debugfs: allow forcing host mode together with speed in testmode

Based on the musb ug, force_host bit is allowed to be set along with
force_hs or force_fs bit.

It could help to implement forced host mode via testmode on Nokia N900.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7b6c1b4c 10-Jan-2017 Bin Liu <b-liu@ti.com>

usb: musb: fix runtime PM in debugfs

MUSB driver now has runtime PM support, but the debugfs driver misses
the PM _get/_put() calls, which could cause MUSB register access
failure.

Cc: stable@vger.kernel.org # 4.9+
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7c0f6ba6 24-Dec-2016 Linus Torvalds <torvalds@linux-foundation.org>

Replace <asm/uaccess.h> with <linux/uaccess.h> globally

This was entirely automated, using the script by Al:

PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>'
sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \
$(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h)

to do the replacement at the end of the merge window.

Requested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# ffc1d299 24-Mar-2015 Bin Liu <b-liu@ti.com>

usb: musb: add softconnect for host mode

Add a debugfs interface - softconnect - for host mode to
connect/disconnect the devices without physically remove the
them.

This adds the capability to re-enumerate the devices which are
permanently mounted on the board with the MUSB controller
together.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 205845ef 24-Mar-2015 Bin Liu <b-liu@ti.com>

usb: musb: only set test mode once

The MUSB test mode register can only be set once, otherwise the result
is undefined.

This prevents the debugfs testmode entry to set the register more than
once which causes test failure.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# fe198e34 14-Jan-2015 Markus Pargmann <mpa@pengutronix.de>

usb: musb: debugfs: improve copy_from_user() argument

While the code is correct and functions well, it's still
a bit misleading to add the reference operator in from of
the buf argument.

This patch simply removes that operator in order to make
use of buf slightly better to the eyes.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# e87c3f80 27-Nov-2014 Rasmus Villemoes <linux@rasmusvillemoes.dk>

usb: musb: Fix a few off-by-one lengths

!strncmp(buf, "force host", 9) is true if and only if buf starts with
"force hos". This was obviously not what was intended. The same error
exists for "force full-speed", "force high-speed" and "test
packet". Using strstarts avoids the error-prone hardcoding of the
prefix length.

For consistency, also change the other occurences of the !strncmp
idiom.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 449a7e99 26-Nov-2014 Felipe Balbi <balbi@ti.com>

usb: musb: debugfs: cope with blackfin's oddities

Blackfin's MUSB implementation lacks a bunch of
registers which they end up not defining a macro
for. In order to avoid build breaks, let's ifdef
out some of the registers from our regdump debugfs
utility so that we don't try to use those on
Blackfin builds.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# c2365ce5 10-Nov-2014 Roman Byshko <rbyshko@gmail.com>

usb: musb: replace hard coded registers with defines

musb registers can be dumped using the file regdump
which is created in debugfs. Up to now hard coded
register addresses are used for that. Different glue
layers however have different register addresses. The
patch addresses this issue by substituting bare register
addresses with defines.

Signed-off-by: Roman Byshko <rbyshko@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 41ac7b3a 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

usb: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Peter Korsgaard <jacmet@sunsite.dk>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Cc: Li Yang <leoli@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Geoff Levand <geoff@infradead.org>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Olav Kongas <ok@artecdesign.ee>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8d2421e6 31-Aug-2012 Ajay Kumar Gupta <ajay.gupta@ti.com>

usb: musb: kill global and static for multi instance

Moved global variable "musb_debugfs_root" and static variable
"old_state" to 'struct musb' to help support multi instance of
musb controller as present on AM335x platform.

Also removed the global variable "orig_dma_mask" and filled the
dev->dma_mask with parent device's dma_mask.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Santhapuri, Damodar <damodar.santhapuri@ti.com>
Signed-off-by: Ravi Babu <ravibabu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 6c2abcdd 31-Jan-2012 Felipe Balbi <balbi@ti.com>

usb: musb: debugfs: fix error check

debugfs will return NULL on failure, so
we must check for !ptr instead of IS_ERR(ptr).

Signed-off-by: Felipe Balbi <balbi@ti.com>


# e9e8c85e 25-Jan-2012 Felipe Balbi <balbi@ti.com>

usb: musb: make modules behave better

There's really no point in doing all that
initcall trickery when we can safely let
udev handle module probing for us.

Remove all of that trickery, by moving everybody
to module_init() and making proper use of
platform_device_register() rather than
platform_device_probe().

Tested-by: Rajashekhara, Sudhakar <sudhakar.raj@ti.com>
Tested-by: Tasslehoff Kjappfot <tasskjapp@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 7d5b49a2 14-Oct-2011 Felipe Balbi <balbi@ti.com>

usb: musb: headers cleanup

Remove a few unnecessary headers from a
few files.

Signed-off-by: Felipe Balbi <balbi@ti.com>


# 57c89707 29-Aug-2011 Nicolas Pitre <nico@fluxnic.net>

musb_debugfs.c: remove unneeded includes on ARM

Nothing actually requires that <mach/hardware.h>, <mach/memory.h> nor
<asm/mach-types.h> be included here.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Acked-by: Felipe Balbi <balbi@ti.com>


# 57cc7215 09-Jan-2011 Alexey Dobriyan <adobriyan@gmail.com>

headers: kobject.h redux

Remove kobject.h from files which don't need it, notably,
sched.h and fs.h.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 024cfa59 06-Sep-2010 Mathias Nyman <mathias.nyman@nokia.com>

usb: musb_debugfs: don't use the struct file private_data field with seq_files

seq_files use the private_data field of a file struct for storing a seq_file structure,
data should be stored in seq_file's own private field (e.g. file->private_data->private)
Otherwise seq_release() will free the private data when the file is closed.

Signed-off-by: Mathias Nyman <mathias.nyman@nokia.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 0936fb5e 08-Jul-2010 Anand Gadiyar <gadiyar@ti.com>

USB: musb: use correct register widths in register dumps

DMA_ADDR and DMA_COUNT are 32-bit registers, not 16-bit.

Marking them as 16-bit in the table causes only the lower
16-bits to be dumped and this is misleading.

Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Acked-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# c4d80b7d 19-May-2010 Tejun Heo <tj@kernel.org>

usb: musb: update gfp/slab.h includes

Implicit slab.h inclusion via percpu.h is about to go away. Make sure
gfp.h or slab.h is included as necessary.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# b0f9da7e 25-Mar-2010 Felipe Balbi <felipe.balbi@nokia.com>

usb: musb: debugfs: musb_exit_debugfs() can be called on probe

when we fail to probe(), we can call musb_exit_debugfs().
Allow that by removing section annotations.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 7f7f9e2a 12-Mar-2010 Felipe Balbi <felipe.balbi@nokia.com>

usb: musb: add debugfs support

for now only a simple register dump entry (which can
be rather useful on debugging) and a way to start
test modes.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>