[U-Boot] [PATCH V3] usb: xhci: Add Renesas R-Car xHCI driver

Marek Vasut marek.vasut at gmail.com
Sun Oct 15 15:17:15 UTC 2017


On 10/15/2017 05:11 PM, Bin Meng wrote:
> Hi Marek,
> 
> On Sun, Oct 15, 2017 at 9:01 PM, Marek Vasut <marek.vasut at gmail.com> wrote:
>> Add firmware V3, firmware loader and XHCI glue for the Renesas R-Car
>> Gen3 SoCs XHCI controller. Thus far only the R-Car Gen3 R8A7795 ES2.0+
>> and R8A7796 are supported.
>>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
>> Cc: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
>> Cc: Bin Meng <bmeng.cn at gmail.com>
>> ---
>> V2: Drop GD access
>>     Add xhci_deregister
>> V3: Use BIT() macro instead of ad-hoc mask
>> ---
>>  Licenses/r8a779x_usb3.txt                    |  26 ++
>>  drivers/usb/host/Kconfig                     |   8 +
>>  drivers/usb/host/Makefile                    |   1 +
>>  drivers/usb/host/xhci-rcar-r8a779x_usb3_v3.h | 643 +++++++++++++++++++++++++++
>>  drivers/usb/host/xhci-rcar.c                 | 159 +++++++
>>  5 files changed, 837 insertions(+)
>>  create mode 100644 Licenses/r8a779x_usb3.txt
>>  create mode 100644 drivers/usb/host/xhci-rcar-r8a779x_usb3_v3.h
>>  create mode 100644 drivers/usb/host/xhci-rcar.c
>>
>> diff --git a/Licenses/r8a779x_usb3.txt b/Licenses/r8a779x_usb3.txt
>> new file mode 100644
>> index 0000000000..e2afcc9e81
>> --- /dev/null
>> +++ b/Licenses/r8a779x_usb3.txt
>> @@ -0,0 +1,26 @@
>> +Copyright (c) 2014, Renesas Electronics Corporation
>> +All rights reserved.
>> +
>> +Redistribution and use in binary form, without modification, are permitted
>> +provided that the following conditions are met:
>> +
>> +1. Redistribution in binary form must reproduce the above copyright notice,
>> +   this list of conditions and the following disclaimer in the documentation
>> +   and/or other materials provided with the distribution.
>> +2. The name of Renesas Electronics Corporation may not be used to endorse or
>> +   promote products derived from this software without specific prior written
>> +   permission.
>> +3. Reverse engineering, decompilation, or disassembly of this software is
>> +   not permitted.
>> +
>> +THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS ELECTRONICS CORPORATION DISCLAIMS
>> +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
>> +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND
>> +NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL RENESAS ELECTRONICS
>> +CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
>> +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
>> +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
>> +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
>> +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
>> +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
>> +POSSIBILITY OF SUCH DAMAGE.
>> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
>> index f5f19ed775..cad9af6977 100644
>> --- a/drivers/usb/host/Kconfig
>> +++ b/drivers/usb/host/Kconfig
>> @@ -47,6 +47,14 @@ config USB_XHCI_ROCKCHIP
>>         help
>>           Enables support for the on-chip xHCI controller on Rockchip SoCs.
>>
>> +config USB_XHCI_RCAR
>> +       bool "Renesas RCar USB 3.0 support"
>> +       default y
>> +       depends on ARCH_RMOBILE
>> +       help
>> +         Choose this option to add support for USB 3.0 driver on Renesas
>> +         RCar Gen3 SoCs.
>> +
>>  config USB_XHCI_STI
>>         bool "Support for STMicroelectronics STiH407 family on-chip xHCI USB controller"
>>         depends on ARCH_STI
>> diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
>> index 83903fcf99..79df888fce 100644
>> --- a/drivers/usb/host/Makefile
>> +++ b/drivers/usb/host/Makefile
>> @@ -59,6 +59,7 @@ obj-$(CONFIG_USB_XHCI_FSL) += xhci-fsl.o
>>  obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o
>>  obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
>>  obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
>> +obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o
>>  obj-$(CONFIG_USB_XHCI_STI) += dwc3-sti-glue.o
>>
>>  # designware
>> diff --git a/drivers/usb/host/xhci-rcar-r8a779x_usb3_v3.h b/drivers/usb/host/xhci-rcar-r8a779x_usb3_v3.h
>> new file mode 100644
>> index 0000000000..f0f48a3354
>> --- /dev/null
>> +++ b/drivers/usb/host/xhci-rcar-r8a779x_usb3_v3.h
>> @@ -0,0 +1,643 @@
>> +/*
>> + * Renesas RCar xHCI controller firmware version 3
>> + *
>> + * Copyright (c) 2014, Renesas Electronics Corporation
>> + * All rights reserved.
>> + *
>> + * Redistribution and use in binary form, without modification, are permitted
>> + * provided that the following conditions are met:
>> + *
>> + * 1. Redistribution in binary form must reproduce the above copyright notice,
>> + *    this list of conditions and the following disclaimer in the documentation
>> + *    and/or other materials provided with the distribution.
>> + * 2. The name of Renesas Electronics Corporation may not be used to endorse or
>> + *    promote products derived from this software without specific prior written
>> + *    permission.
>> + * 3. Reverse engineering, decompilation, or disassembly of this software is
>> + *    not permitted.
>> + *
>> + * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS ELECTRONICS CORPORATION DISCLAIMS
>> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
>> + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND
>> + * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL RENESAS ELECTRONICS
>> + * CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
>> + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
>> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
>> + * POSSIBILITY OF SUCH DAMAGE.
>> + *
>> + * This file is generated from the firmware blob r8a779x_usb3_v3.dlmem
>> + * with associated license file LICENCE.r8a779x_usb3, both taken from
>> + * linux-firmware.git [1] as of:
>> + *
>> + *     commit 7c3dfc0bb21bf717dc19a6b677a866aef8b70c35
>> + *     Author: Yoshihiro Shimoda
>> + *     Date:   Wed Aug 10 19:56:39 2016 +0900
>> + *
>> + *         usb: host: xhci-rcar: update firmware for R-Car H3 and M3-W
>> + *
>> + * To generate the content of the array below, use ie. the following command:
>> + * $ hexdump -v -e '/4 "0x%08x, "' r8a779x_usb3_v3.dlmem | \
>> + *     sed "s@\(.\{47\}\) @\1\n at g"
>> + *
>> + * [1] git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git
>> + */
>> +
>> +#ifndef __FIRMWARE_R8A779X_USB3_V3__
>> +#define __FIRMWARE_R8A779X_USB3_V3__
>> +
>> +static const u32 firmware_r8a779x_usb3_v3[] = {
> 
> Did you investigate the way to include this firmware image file
> directly via binman?

Yes, but binman is not what you want to use -- I discussed this with
Simon and binman is for assembling the final image and attaching blobs
to it. I need to access the firmware from within U-Boot.

> +Tom, Simon,
> 
> What's the preferred way to handle such case in U-Boot? I believe
> binman was created for this, but so far binman is only used in sunxi
> and x86.

I am pushing Altera to implement a proper firmware loader by factoring
out parts of the "splash" command . The "splash" command can be made
into generic firmware loader quite easily, so that's what I'd like to
switch to later on.

> But I am fine either way:
> Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
> 
> Regards,
> Bin
> 


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list