History log of /linux-master/drivers/usb/renesas_usbhs/common.c
Revision Date Author Comments
# 484468fb 18-Jul-2023 Rob Herring <robh@kernel.org>

usb: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Acked-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230718143027.1064731-1-robh@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 456a91ce 17-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

usb: renesas_usbhs: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart from
emitting a warning) and this typically results in resource leaks. To improve
here there is a quest to make the remove callback return void. In the first
step of this quest all drivers are converted to .remove_new() which already
returns void. Eventually after all drivers are converted, .remove_new() is
renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/20230517230239.187727-89-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 94d1957f 11-Mar-2023 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

usb: renesas_usbhs: drop of_match_ptr for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr does not have any sense (this also allows ACPI
matching via PRP0001, even though it might not be relevant here).

drivers/usb/renesas_usbhs/common.c:535:34: error: ‘usbhs_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230311173624.263189-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 22ae6415 19-Dec-2021 Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

usb: renesas_usbhs: Use platform_get_irq() to get the interrupt

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Drop irqflags member from struct usbhs_priv as this driver is used by
two non DT users sh7757lcr and ecovec24 which do not pass
IORESOURCE_IRQ_SHAREABLE as part of their pdata. Along this drop the
IRQF_SHARED flag handling in the code.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20211220010411.12075-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3b31ec18 17-Dec-2019 Linus Walleij <linus.walleij@linaro.org>

usb: renesas_usbhs: Switch to GPIO descriptor

The Renesas USBHS driver includes a bit of surplus headers
and uses the old GPIO API so let's switch it to use the
GPIO descriptor.

I noticed that the enable_gpio inside renesas_usbhs_driver_param
isn't really referenced anywhere, and it is also the wrong
type (u32) so let's just delete it and use a local variable
instead.

Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
Cc: Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20191217141241.57639-1-linus.walleij@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2457b2c1 15-Oct-2019 Ben Dooks (Codethink) <ben.dooks@codethink.co.uk>

usb: renesas_usbhs: fix __le16 warnings

Fix the warnings generated by casting to/from __le16 without
using the correct functions.

Fixes the following sparse warnings:

drivers/usb/renesas_usbhs/common.c:165:25: warning: incorrect type in assignment (different base types)
drivers/usb/renesas_usbhs/common.c:165:25: expected restricted __le16 [usertype] wValue
drivers/usb/renesas_usbhs/common.c:165:25: got unsigned short
drivers/usb/renesas_usbhs/common.c:166:25: warning: incorrect type in assignment (different base types)
drivers/usb/renesas_usbhs/common.c:166:25: expected restricted __le16 [usertype] wIndex
drivers/usb/renesas_usbhs/common.c:166:25: got unsigned short
drivers/usb/renesas_usbhs/common.c:167:25: warning: incorrect type in assignment (different base types)
drivers/usb/renesas_usbhs/common.c:167:25: expected restricted __le16 [usertype] wLength
drivers/usb/renesas_usbhs/common.c:167:25: got unsigned short
drivers/usb/renesas_usbhs/common.c:173:39: warning: incorrect type in argument 3 (different base types)
drivers/usb/renesas_usbhs/common.c:173:39: expected unsigned short [usertype] data
drivers/usb/renesas_usbhs/common.c:173:39: got restricted __le16 [usertype] wValue
drivers/usb/renesas_usbhs/common.c:174:39: warning: incorrect type in argument 3 (different base types)
drivers/usb/renesas_usbhs/common.c:174:39: expected unsigned short [usertype] data
drivers/usb/renesas_usbhs/common.c:174:39: got restricted __le16 [usertype] wIndex
drivers/usb/renesas_usbhs/common.c:175:39: warning: incorrect type in argument 3 (different base types)
drivers/usb/renesas_usbhs/common.c:175:39: expected unsigned short [usertype] data

Note. I belive this to be correct, and should be a no-op on arm.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 836283dd 04-Sep-2019 YueHaibing <yuehaibing@huawei.com>

usb: renesas_usbhs: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 46f62f88 15-Oct-2019 Ben Dooks (Codethink) <ben.dooks@codethink.co.uk>

usb: renesas_usbhs: fix __le16 warnings

Fix the warnings generated by casting to/from __le16 without
using the correct functions.

Fixes the following sparse warnings:

drivers/usb/renesas_usbhs/common.c:165:25: warning: incorrect type in assignment (different base types)
drivers/usb/renesas_usbhs/common.c:165:25: expected restricted __le16 [usertype] wValue
drivers/usb/renesas_usbhs/common.c:165:25: got unsigned short
drivers/usb/renesas_usbhs/common.c:166:25: warning: incorrect type in assignment (different base types)
drivers/usb/renesas_usbhs/common.c:166:25: expected restricted __le16 [usertype] wIndex
drivers/usb/renesas_usbhs/common.c:166:25: got unsigned short
drivers/usb/renesas_usbhs/common.c:167:25: warning: incorrect type in assignment (different base types)
drivers/usb/renesas_usbhs/common.c:167:25: expected restricted __le16 [usertype] wLength
drivers/usb/renesas_usbhs/common.c:167:25: got unsigned short
drivers/usb/renesas_usbhs/common.c:173:39: warning: incorrect type in argument 3 (different base types)
drivers/usb/renesas_usbhs/common.c:173:39: expected unsigned short [usertype] data
drivers/usb/renesas_usbhs/common.c:173:39: got restricted __le16 [usertype] wValue
drivers/usb/renesas_usbhs/common.c:174:39: warning: incorrect type in argument 3 (different base types)
drivers/usb/renesas_usbhs/common.c:174:39: expected unsigned short [usertype] data
drivers/usb/renesas_usbhs/common.c:174:39: got restricted __le16 [usertype] wIndex
drivers/usb/renesas_usbhs/common.c:175:39: warning: incorrect type in argument 3 (different base types)
drivers/usb/renesas_usbhs/common.c:175:39: expected unsigned short [usertype] data

Note. I belive this to be correct, and should be a no-op on arm.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20191015155044.11858-1-ben.dooks@codethink.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d706a95b 04-Sep-2019 YueHaibing <yuehaibing@huawei.com>

usb: renesas_usbhs: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190904085045.24204-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 426d3ff2 24-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Use struct platform_callback pointer

Now the driver fixes the issue of the commit 482982062f1b ("usb:
gadget: renesas_usbhs: bugfix: don't modify platform data") by
using usbhs_mod_info.get_vbus, this patches uses the pointer
instead of copied value to avoid redundancy. Note that struct
renesas_usbhs_driver_param has to use copied value because
the driver has to set some members (e.g. buswait_bwait).

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 76eff170 24-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Use renesas_usbhs_platform_info on of_device_id.data

In device tree environment, the previous code allocates
renesas_usbhs_platform_info by using devm_kzalloc() and then copies
usbhs_of_data to the allocated memory. This reason is some values
(e.g. .platform_callback.get_vbus) are overwritten by the driver,
but the of_device_id.data is "const". Now the driver doesn't have
such a code, so this patch uses renesas_usbhs_platform_info on
of_device_id.data.

Note that the previous code set the pdev->dev.platform_data pointer
even if device tree environment, but the value is not used. So,
this patch also remove such a code.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# be0a42a7 24-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Add a common function for the .get_id

All platform related codes (rcar[23].c and rza{2}.c) has its own
.get_id function as "USBHS_GADGET". So, we can use a common
function for it.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b3103d0b 24-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: move device tree properties parsing

In the future, each struct renesas_usbhs_driver_param is stored on
the each platform related source code (e.g. rcar3.c) to remove
usbhs_parse_dt(). So, this patch moves device tree properties
parsing to usbhs_probe().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f08acaf0 24-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Add struct device * declaration in usbhs_probe()

Since this can remove over 80 charactors in a line, this patch adds
struct device * declaration in usbhs_probe().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 98e86506 24-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Add has_new_pipe_configs flag

In the future, each struct renesas_usbhs_driver_param is stored on
the each platform related source code (e.g. rcar3.c). So, to simplify
the source code, this patch adds a new flag has_new_pipe_configs.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 31e795c6 24-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Use dev_of_node macro instead of open coded

This patch uses the dev_of_node macro instead of open coded
to be better.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a4027b40 24-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Remove type member from renesas_usbhs_driver_param

Now no one uses the type member so that this patch removes it.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# df9f2c27 24-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Use a specific flag instead of type for multi_clks

To remove the type of renesas_usbhs_driver_param in the future, this
patch uses a specific flag "multi_clks".

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ccc3264c 24-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Avoid to write platform_data's value

The very old commit 482982062f1b ("usb: gadget: renesas_usbhs:
bugfix: don't modify platform data") changed to use copied whole
structures values to fix the "hung-up" issue. However, we also
can fix the issue if the driver copies the get_vbus function
pointer to the driver's value.

So, this patch adds get_vbus member into struct usbhs_mod_info and
use the pointer instead of struct renesas_usbhs_platform_callback.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0966648d 24-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: remove notify_hotplug callback

The notify_hotplug callback was supported in v3.10, but the last user
(armadillo800eva) was removed by the commit 1fa59bda21c7 ("ARM: shmobile:
Remove legacy board code for Armadillo-800 EVA"). So, this patch
removes it.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 743344a9 13-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Use struct assignment instead of memcpy()

To avoid the error-proneness of calls to sizeof() in the memcpy,
this patch uses struct assignment instead of memcpy.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>---
This patch is based on Greg's linux-usb.git / usb-next branch.
Note that mod_host.c also has memcpy but we cannot use struct assignment
for it because the type of urb->setup_patcket is just "unsigned char *".

drivers/usb/renesas_usbhs/common.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e60e9823 05-Jun-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: remove controlling PWEN/EXTLP support

Controlling PWMEN/EXTLP (named as "has_otg") was supported in v3.2,
but the last user (kzm9g) was removed by the commit 30f8925a57d8ad49
("ARM: shmobile: Remove legacy board code for KZM-A9-GT"). So, this
patch remove it.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b69dce63 15-May-2019 Chris Brandt <chris.brandt@renesas.com>

usb: renesas_usbhs: Add support for RZ/A2

The RZ/A2 is similar to the R-Car Gen3 with some small differences.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2195e3af 15-May-2019 Chris Brandt <chris.brandt@renesas.com>

usb: renesas_usbhs: add support for CNEN bit

For some SoC, CNEN must be set for USB Device mode operation.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 97a79684 15-May-2019 Chris Brandt <chris.brandt@renesas.com>

usb: renesas_usbhs: move flags to param

Move options from 'flags' field in private structure to param structure
where other options are already being kept.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# be21a02a 12-May-2019 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Use specific struct instead of USBHS_TYPE_* enums

This patch adds a specific struct "usbhs_of_data" to add a new SoC
data easily instead of code basis in the future.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1d6e81a2 14-Dec-2018 Fabrizio Castro <fabrizio.castro@bp.renesas.com>

usb: renesas_usbhs: add support for RZ/G2E

HS-USB found in RZ/G2E (a.k.a. r8a774c0) is very similar to the
one found in R-Car E3 (a.k.a. r8a77990), as it needs to release
the PLL reset by the UGCTRL register like R-Car E3, therefore add
r8a774c0 support in a similar fashion to what was done for the
r8a77990.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# eaf3074e 11-Dec-2018 Arnd Bergmann <arnd@arndb.de>

usb: renesas_usbhs: mark PM functions as __maybe_unused

Without CONFIG_PM, we get a new build warning here:

drivers/usb/renesas_usbhs/common.c:860:12: error: 'usbhsc_resume' defined but not used [-Werror=unused-function]
static int usbhsc_resume(struct device *dev)
^~~~~~~~~~~~~
drivers/usb/renesas_usbhs/common.c:844:12: error: 'usbhsc_suspend' defined but not used [-Werror=unused-function]
static int usbhsc_suspend(struct device *dev)
^~~~~~~~~~~~~~

Fixes: d54d334e75b9 ("usb: renesas_usbhs: Use SIMPLE_DEV_PM_OPS macro")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d54d334e 20-Nov-2018 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Use SIMPLE_DEV_PM_OPS macro

This patch uses SIMPLE_DEV_PM_OPS macro instead of struct dev_pm_ops
directly.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# b01828e2 20-Nov-2018 Jarkko Nikula <jarkko.nikula@linux.intel.com>

usb: renesas_usbhs: Remove dummy runtime PM callbacks

Platform drivers don't need dummy runtime PM callbacks that just return
success in order to have runtime PM happening. This has changed since
following commits:

commit 05aa55dddb9e ("PM / Runtime: Lenient generic runtime pm callbacks")
commit 543f2503a956 ("PM / platform_bus: Allow runtime PM by default")
commit 8b313a38ecff ("PM / Platform: Use generic runtime PM callbacks directly")

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
[shimoda: revise git commit description style]
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 54e4f66b 21-Sep-2018 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: add support for R-Car E3

This patch adds support for R-Car E3. This SoC needs to release
the PLL reset by the UGCTRL register like R-Car D3. So, this patch
adds a usbhs_of_match entry for this SoC with
"USBHS_TYPE_RCAR_GEN3_WITH_PLL".

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 794f97a4 11-Sep-2018 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Add multiple clocks management

R-Car Gen3 needs to enable clocks of both host and peripheral.
Since [eo]hci-platform disables the reset(s) when the drivers are
removed, renesas_usbhs driver doesn't work correctly. To fix this
issue, this patch adds multiple clocks management on this
renesas_usbhs driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 26eef8e0 11-Sep-2018 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Add reset_control

R-Car Gen3 needs to deassert resets of both host and peripheral.
Since [eo]hci-platform is possible to assert the reset(s) when
the probing failed, renesas_usbhs driver doesn't work correctly
regardless of finished probing. To fix this issue, this patch adds
reset_control on this renesas_usbhs driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 4018aa9b 21-Sep-2018 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Revert "usb: renesas_usbhs: add extcon notifier to set mode for non-otg channel"

This reverts commit 8ada211d0383b72878582bd312b984a9eae62b30.

R-Car D3 can use OTG mode in fact. So, the commit doesn't need anymore.
In other words, like other R-Car Gen3 SoCs, R-Car D3 can change the mode
by using the phy-rcar-gen3-usb2 driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 4d2a863f 21-Sep-2018 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: add support for R-Car E3

This patch adds support for R-Car E3. This SoC needs to release
the PLL reset by the UGCTRL register like R-Car D3. So, this patch
adds a usbhs_of_match entry for this SoC with
"USBHS_TYPE_RCAR_GEN3_WITH_PLL".

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 91b20c5a 21-Sep-2018 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Revert "usb: renesas_usbhs: add extcon notifier to set mode for non-otg channel"

This reverts commit 8ada211d0383b72878582bd312b984a9eae62b30.

R-Car D3 can use OTG mode in fact. So, the commit doesn't need anymore.
In other words, like other R-Car Gen3 SoCs, R-Car D3 can change the mode
by using the phy-rcar-gen3-usb2 driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3df0e240 11-Sep-2018 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Add multiple clocks management

R-Car Gen3 needs to enable clocks of both host and peripheral.
Since [eo]hci-platform disables the reset(s) when the drivers are
removed, renesas_usbhs driver doesn't work correctly. To fix this
issue, this patch adds multiple clocks management on this
renesas_usbhs driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f181dbb4 11-Sep-2018 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Add reset_control

R-Car Gen3 needs to deassert resets of both host and peripheral.
Since [eo]hci-platform is possible to assert the reset(s) when
the probing failed, renesas_usbhs driver doesn't work correctly
regardless of finished probing. To fix this issue, this patch adds
reset_control on this renesas_usbhs driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# aec2927b 08-Jan-2018 Chris Brandt <chris.brandt@renesas.com>

usb: renesas_usbhs: Add support for RZ/A1

This patch adds the capability to support RZ/A1 SoCs.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8ada211d 12-Dec-2017 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: add extcon notifier to set mode for non-otg channel

This patch adds extcon notifier callback to set the mode of
host/peripheral by using extcon state (e.g phy-rcar-gen3-usb2) for
non-otg channel (e.g. R-Car D3).

[Fengguang Wu: fixed sparse warning]

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>

usb: renesas_usbhs: usbhs_rcar3_notifier() can be static

Fixes: 3a7cce26122e ("usb: renesas_usbhs: add extcon notifier to set mode for non-otg channel")
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 1250413a 06-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: renesas_usbhs: 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: Rob Herring <robh@kernel.org>
Cc: Simon Horman <horms+renesas@verge.net.au>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Cc: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f0f14a7a 07-Nov-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

renesas_usbhs: use renesas_usbhs_get_info()

We already have renesas_usbhs_get_info() macro.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.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>


# b61e47b4 04-Oct-2017 Geert Uytterhoeven <geert+renesas@glider.be>

usb: renesas_usbhs: Use of_device_get_match_data() helper

Use the of_device_get_match_data() helper instead of open coding.

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 0f38672c 03-Oct-2017 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: add support for R-Car D3

This patch adds support for R-Car D3. This SoC needs to release
the PLL reset by the UGCTRL register. So, since this is not the same
as other R-Car Gen3 SoCs, this patch adds a new type as
"USBHS_TYPE_RCAR_GEN3_WITH_PLL".

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# a877b8e5 03-Oct-2017 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: unify Gen2/3 pipe_config setting

This patch unifies the Gen2 and Gen3 pipe_config setting on
usbhs_parse_dt().

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 59a0879a 19-Jul-2017 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: fix usbhsc_resume() for !USBHSF_RUNTIME_PWCTRL

This patch fixes an issue that some registers may be not initialized
after resume if the USBHSF_RUNTIME_PWCTRL is not set. Otherwise,
if a cable is not connected, the driver will not enable INTENB0.VBSE
after resume. And then, the driver cannot detect the VBUS.

Fixes: ca8a282a5373 ("usb: gadget: renesas_usbhs: add suspend/resume support")
Cc: <stable@vger.kernel.org> # v3.2+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# ea07b8cf 16-Jan-2017 Chanwoo Choi <cw00.choi@samsung.com>

usb: renesas_usbhs: Replace the deprecated extcon API

This patch replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# aae819e1 24-Aug-2016 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: add a compatible string for r8a7796

This patch adds support for r8a7796 (R-Car M3-W).

Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 772ce812 08-Aug-2016 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Fix receiving data corrupt on R-Car Gen3 with dmac

Since R-Car Gen3 SoC has the USB-DMAC, this driver should set
dparam->has_usb_dmac to 1. Otherwise, behavior of this driver and
the usb-dmac driver will be mismatch, then sometimes receiving data will
be corrupt.

Fixes: de18757e272d ("usb: renesas_usbhs: add R-Car Gen3 power control")
Cc: <stable@vger.kernel.org> # v4.5+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# 0d799503 27-Jun-2016 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: show error code when probe failed

To know why the driver probing failed, this patch shows error code.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>


# de18757e 07-Jan-2016 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: add R-Car Gen3 power control

Since the usb2 phy driver for gen3 (phy-rcar-gen3-usb2) cannot access
LPSTS and UGCTRL2 registers in the HSUSB module, this driver have to
initialize the registers. So, this patch adds such handling code into
rcar3.c.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# 2f1a993a 15-Dec-2015 Simon Horman <horms+renesas@verge.net.au>

usb: renesas_usbhs: add fallback compatibility strings

Add fallback compatibility strings for R-Car Gen2 and Gen3.
This is in keeping with the fallback scheme being adopted wherever
appropriate for drivers for Renesas SoCs.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 51f141a9 17-Nov-2015 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Modify pipe configuration

The current code has info->bufnmb_last to calculate the BUFNMB bits of
PIPEBUF register. However, since the bufnmb_last is initialized in
the usbhs_pipe_init() only, this driver is possible to set unexpected
value to the register if usb_ep_{enable,disable}() are called many times.

So, this patch modifies the pipe configuration via struct
renesas_usbhs_driver_param to simplify the code. Also this patch changes:
- a double buffer configuration
- isochronous buffer size from 512 to 1024

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 5119dd1e 29-Sep-2015 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Add support for R-Car H3

This patch adds a compatible string to support for R-Car H3.

Since the HS-USB controller of R-Car H3 is almost the same specification
with R-Car Gen2 (these have 16 pipes and usb-dmac), this patch
sets the "type" of renesas_usbhs_driver_param to USBHS_TYPE_RCAR_GEN2.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f975c5cd 29-Sep-2015 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: fix build warning if 64-bit architecture

This patch fixes the following warning if 64-bit architecture environment:

./drivers/usb/renesas_usbhs/common.c:496:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
dparam->type = of_id ? (u32)of_id->data : 0;

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f5f6afa8 29-Sep-2015 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Add support for R-Car H3

This patch adds a compatible string to support for R-Car H3.

Since the HS-USB controller of R-Car H3 is almost the same specification
with R-Car Gen2 (these have 16 pipes and usb-dmac), this patch
sets the "type" of renesas_usbhs_driver_param to USBHS_TYPE_RCAR_GEN2.

Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 9ae7ce00 29-Sep-2015 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: fix build warning if 64-bit architecture

This patch fixes the following warning if 64-bit architecture environment:

./drivers/usb/renesas_usbhs/common.c:496:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
dparam->type = of_id ? (u32)of_id->data : 0;

Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 50297b79 30-Jun-2015 Chanwoo Choi <cw00.choi@samsung.com>

usb: renesas_usbhs: Replace deprecated API of extcon

This patch removes the deprecated API of extcon and then use the new extcon API
with the unique id to indicate the each external connector (USB-HOST).
- extcon_get_cable_state(*edev, char *) -> extcon_get_cable_state_(*edev, id)

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Peter Chen <peter.chen@freescale.com>
Cc: Varka Bhadram <varkab@cdac.in>
Cc: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# af6e613b 18-May-2015 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Add support for R-Car E2

This patch adds a compatible string to support for R-Car E2.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>" in patch 2
Signed-off-by: Felipe Balbi <balbi@ti.com>


# e0213bc5 18-May-2015 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Change USBHS_TYPE_R8A779x to USBHS_TYPE_RCAR_GEN2

Since the HSUSB controllers of R-Car Gen2 are the same specification
(they have 16 pipes and usb-dmac), this patch changes USBHS_TYPE_R8A7790
and USBHS_TYPE_R8A7791 to USBHS_TYPE_RCAR_GEN2.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# ab330cf3 12-Mar-2015 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: add support for USB-DMAC

Some Renesas SoCs have the USB-DMAC. It is able to terminate transfers
when a short packet is received, even if less bytes than the transfer
counter size have been received. Also, it is able to send a short
packet even if the packet size is not multiples of 8bytes.

Since the previous code has used the interruption of USBHS controller
when receiving packets even if this driver has used a dmac, a lot of
interruptions has happened. This patch will reduce such interruptions.

This patch allows to use the USB-DMAC on R-Car H2 and M2.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# d7b3968d 15-Dec-2014 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

usb: renesas_usbhs: add OTG ID signal sensing

On the Renesas R8A7791 SoC based boards there's MAX3355 USB OTG chip and mini-AB
USB connector corresponding to USB port 0 driven either by EHCI/OHCI or Renesas
USBHS gadget controller. And we'd like the host/gadget drivers to work based on
the cable type connected. An 'extcon' driver for MAX3355 has been written, so we
only need to bind to it via device tree which I'm doing in this patch.

(Perhaps, it would also make sense to use OTG HNP when the USBHS host mode is
active and a B-cable is connected but I don't have access to host-capable USBHS,
so wouldn't be able to test it.)

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 48ac1e57 04-Nov-2014 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

usb: renesas_usbhs: fix platform init error message

There is a typo ("prove" instead of "probe") in the error message printed when
the platform initialization fails. Replace that word with more fitting "init".

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 368504c0 12-Dec-2014 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

usb: renesas_usbhs: kill dead code in usbhs_probe()

usbhsc_drvcllbck_notify_hotplug() always returns 0, so it's rather pointless to
store and check its result for being < 0.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# d9a88702 03-Nov-2014 Varka Bhadram <varkab@cdac.in>

renesas_usbhs: common: remove duplicate check on resource

Sanity check on resource happening with devm_ioremap_resource().

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 04a5def3 03-Nov-2014 Takeshi Kihara <takeshi.kihara.df@renesas.com>

usb: renesas_usbhs: gadget: fix the behavior of pullup

This patch fixes an issue that this driver always enable the D+ pullup
after it detected the VBUS connection even though this usb controller
can control the D+ pullup timing by software. So, this driver should
enable the D+ pullup after a gadget driver called usb_gadget_connect().

Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 88538be3 14-Oct-2014 Peter Chen <peter.chen@freescale.com>

usb: renesas_usbhs: delete unnecessary 'out of memory' messages

The memory subsystem has already had similar message for it.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 687f16b8 29-Oct-2014 Varka Bhadram <varkabhadram@gmail.com>

usb: renesas_usbhs: common: remove duplicate check on resource

Sanity check on resource happening with devm_ioremap_resource().

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# b1cb07cd 14-Oct-2014 Peter Chen <peter.chen@freescale.com>

usb: renesas_usbhs: delete unnecessary 'out of memory' messages

The memory subsystem has already had similar message for it.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# b854100e 02-Sep-2014 Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: Add device tree support for R-Car H2 and M2

This driver supports other SoCs, but they need boards/Soc depend code.
So, this patch adds device tree support for R-Car H2 and M2 initially.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 8ecef00f 10-Jul-2014 Ulrich Hecht <ulrich.hecht@gmail.com>

usb: renesas_usbhs: add R-Car Gen. 2 init and power control

In preparation for DT conversion to reduce reliance on platform device
callbacks.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# c9a0552e 27-Aug-2013 Libo Chen <clbchenlibo.chen@huawei.com>

usb: renesas_usbhs: use platform_{get,set}_drvdata()

Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.

Signed-off-by: Libo Chen <libo.chen@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ace0a5f9 30-Jul-2013 Jingoo Han <jg1.han@samsung.com>

usb: renesas: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f0742459 30-Jul-2013 Jingoo Han <jg1.han@samsung.com>

usb: renesas: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 148e1134 21-Jan-2013 Thierry Reding <thierry.reding@avionic-design.de>

usb: Convert to devm_ioremap_resource()

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


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

usb: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit 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>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7690417d 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

usb: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p 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>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4cd2f599 16-Oct-2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: gadget: add usb_gadget_ops :: pullup support

This patch adds usbhs_sys_function_pullup() to control
D+ line for USB function, and enabled pullup support on mod_gadget.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 58efc77c 10-Sep-2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: convert to devm_xxx()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5b50d3b5 05-Aug-2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: fixup resume method for autonomy mode

If renesas_usbhs is probed as autonomy mode,
phy reset should be called after power resumed,
and manual cold-plug should be called with slight delay.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cc502bb7 03-Jun-2012 Paul Bolle <pebolle@tiscali.nl>

renesas_usbhs: cleanup quoted includes

A few quoted includes start with a superfluous "./". Clean up those
quoted includes.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 53069af3 04-Jan-2012 Shimoda, Yoshihiro <yoshihiro.shimoda.uh@renesas.com>

usb: renesas_usbhs: add IRQ resource decoding for IRQF_SHARED

In case of the SH7757, the irq number of USB module and SUDMAC
are the same. So, we have to set the IRQF_SHARED in such a case.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# dfbb7f4f 24-Nov-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: add test-mode support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 3dd49268 31-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: modify function name of usbhs_set_device_xx()

it was device configuration setting function, not only speed.
This patch modify function name usbhs_set_device_speed() -> usbhs_set_device_config()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# b4fcea2a 24-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: unified callback function

renesas_usbhs needs callback for notify hotplug.
but it were 2 methods which are almost same.
This patch unified these into one.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# f1ee56a0 23-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: add platform power control function

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# a49a88f1 23-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: tidyup the unit of detection_delay

detection_delay was assumed as msec

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 76190152 23-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: tidyup usbhs_sys_clock_ctrl() was local function

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 3244a7b4 23-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: remove usbhs_sys_usb_ctrl()

usbhs_sys_usb_ctrl() can collect into usbhs_sys_host/function_ctrl().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 2288e109 23-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: remove usbhs_sys_hispeed_ctrl()

usbhs_sys_hispeed_ctrl() can collect into usbhs_sys_host/function_ctrl().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# cc27c96c 27-Nov-2011 Axel Lin <axel.lin@gmail.com>

usb: convert drivers/usb/* to use module_platform_driver()

This patch converts the drivers in drivers/usb/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.

Cc: Felipe Balbi <balbi@ti.com>
Cc: Li Yang <leoli@freescale.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# b7a8d17d 26-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: fixup section mismatch warning

Fix up the following section mismatch warnings:

WARNING: drivers/usb/renesas_usbhs/renesas_usbhs.o(.text+0xf5d): Section
mismatch in reference from the function usbhs_mod_probe() to the function
.devinit.text:usbhs_mod_host_probe() The function usbhs_mod_probe() references
the function __devinit usbhs_mod_host_probe(). This is often because
usbhs_mod_probe lacks a __devinit annotation or the annotation of
usbhs_mod_host_probe is wrong.

WARNING: drivers/usb/renesas_usbhs/renesas_usbhs.o(.text+0xfd7): Section
mismatch in reference from the function usbhs_mod_probe() to the function
.devexit.text:usbhs_mod_host_remove() The function usbhs_mod_probe() references
a function in an exit section. Often the function usbhs_mod_host_remove() has
valid usage outside the exit section and the fix is to remove the __devexit
annotation of usbhs_mod_host_remove.

WARNING: drivers/usb/renesas_usbhs/renesas_usbhs.o(.text+0x1005): Section
mismatch in reference from the function usbhs_mod_remove() to the function
.devexit.text:usbhs_mod_host_remove() The function usbhs_mod_remove()
references a function in an exit section. Often the function
usbhs_mod_host_remove() has valid usage outside the exit section and the fix is
to remove the __devexit annotation of usbhs_mod_host_remove.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 48298206 12-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: bugfix: don't modify platform data

renesas_usbhs has default callback functions and settings.
And it tried overwrite to platform private data
if platform doesn't have them.
So, if renesas_usbhs was compiled as module,
it will be hung-up on 2nd insmod.
This patch fixup it.
Special thanks to Bastian

Reported-by: Bastian Hecht <hechtb@googlemail.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# eb05191f 10-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: add usbhs_set_device_speed() support for host

mod_host needs device speed setup function

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# a9be4a45 10-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: make sure SOF packet sending-out control

It is enabled to set SOF packet output bit when USBRST bit was set.
And USBRST bit should be set 0 when SOF packet was output.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# f427eb64 10-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: support otg pin control

some renesas_usbhs device is supporting OTG external device interface.
In that device, it is necessary to control PWEN/EXTLP on DVSTCTR.
This patch support it.
But renesas_usbhs driver doesn't have OTG support for now.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# ef8bedb9 10-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: move usbhs_usbreq_get/set_val() to common.c

usbhs_usbreq_get/set_val() functions were in pipe.c file,
but it is irrelevant to pipe.
this patch move it to common.c

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 75587f52 10-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: add usbhs_bus_get_speed()

current mod_gadget had got usb speed on
usbhsg_irq_dev_state() which is status change interrupt callback function.
And the usb speed data was included in its parameter.

But this style works for mod_gadget,
but doesn't work for mod_host which
isn't interrupted when device status was changed.

This patch add usbhs_bus_get_speed() to solve this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 258485d9 10-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: add bus control functions

this patch add DVSTCTR control function for HOST support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 11935de5 10-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: change usbhsc_bus_ctrl() to usbsc_set_buswait()

renesas_usbhs will have register DVSTCTR control function for HOST support.
This patch changes usbhsc_bus_ctrl() to usbsc_set_buswait(),
to remove DVSTCTR access from it,

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# ca8a282a 10-Oct-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: gadget: renesas_usbhs: add suspend/resume support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>


# 233f519d 07-Jul-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: fixup comment-out

This patch add/modify comment-out of renesas_usbhs.
On this process, usbhs_pkt_init was moved because it was placed under
usbhsf_null_handler which has no relationship it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# e73a9891 05-Jun-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: add DMAEngine support

USB DMA was installed on "normal DMAC" when SH7724 or older SuperH,
but the "USB-DMAC" was prepared on recent SuperH.
These 2 DMAC have a little bit different behavior.

This patch add DMAEngine code for "normal DMAC",
but it is still using PIO fifo.
The DMA fifo will be formally supported in the future.

You can enable DMA fifo by local fixup
usbhs_fifo_pio_push_handler -> usbhs_fifo_dma_push_handler
usbhs_fifo_pio_pop_handler -> usbhs_fifo_dma_pop_handler
on usbhsg_ep_enable.

This DMAEngine was tested by g_file_storage on SH7724 Ecovec board

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# d3af90a5 05-Jun-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: add usbhsf_fifo

renesas_usbhs has CFIFO/D0FIFO/D1FIFO.
But current renesas_usbhs is using CFIFO (for PIO) only for now.
The fifo selection method is needed for DMAEngine support.
This is a preparation for DMAEngine support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 97f93227 11-May-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: fixup error processing on probe/remove

The error processing order was wrong.
This patch modify it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# b002ff6e 28-Apr-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: add autonomy mode

Current renesas_usbhs was designed to save power when USB is not connected.
And it assumed platform uses callback to notify connection/disconnection
by external interrupt.

But some SuperH / platform board doesn't have such feature.

This patch adds autonomy mode which detect USB connection/disconnection
by internal interrupt.
But power will be always ON when autonomy mode is selected.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# bc57381e 28-Apr-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: use delayed_work instead of work_struct

This delay is used to overjump debounce.

And, this patch also move usbhsc_drvcllbck_notify_hotplug to global,
because it will be called from other files.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 6e267da8 28-Apr-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: add power control function

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 206dcc2c 28-Apr-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: move pdev_to_priv to global

usbhs_pdev_to_priv function will be used in other files.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# af32fe51 20-Apr-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: remove callback when module removed.

The callback function which is called from platform must be removed
if module removed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# f1407d5c 03-Apr-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

usb: renesas_usbhs: Add Renesas USBHS common code

Renesas SuperH has USBHS IP which can switch Host / Function.
This driver is designed so that Host / Function may dynamically change.
This patch add usb/renesas_usbhs and common code for SuperH USBHS.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>