diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/Kconfig | 2 | ||||
-rw-r--r-- | drivers/bootcount/Kconfig | 58 | ||||
-rw-r--r-- | drivers/bootcount/Makefile | 1 | ||||
-rw-r--r-- | drivers/bootcount/bootcount_ext.c | 62 | ||||
-rw-r--r-- | drivers/clk/rockchip/clk_rk3399.c | 8 | ||||
-rw-r--r-- | drivers/i2c/mxc_i2c.c | 25 | ||||
-rw-r--r-- | drivers/pinctrl/nxp/pinctrl-imx6.c | 7 | ||||
-rw-r--r-- | drivers/pinctrl/rockchip/pinctrl_rk3399.c | 19 | ||||
-rw-r--r-- | drivers/pwm/pwm-imx-util.c | 2 | ||||
-rw-r--r-- | drivers/rtc/Kconfig | 6 | ||||
-rw-r--r-- | drivers/rtc/Makefile | 1 | ||||
-rw-r--r-- | drivers/rtc/s35392a.c | 365 | ||||
-rw-r--r-- | drivers/usb/gadget/f_sdp.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/storage_common.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/Kconfig | 8 | ||||
-rw-r--r-- | drivers/usb/host/Makefile | 1 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 15 | ||||
-rw-r--r-- | drivers/usb/host/ehci.h | 8 | ||||
-rw-r--r-- | drivers/usb/host/r8a66597-hcd.c | 47 | ||||
-rw-r--r-- | drivers/usb/host/r8a66597.h | 21 | ||||
-rw-r--r-- | drivers/usb/host/xhci-rcar-r8a779x_usb3_v3.h | 643 | ||||
-rw-r--r-- | drivers/usb/host/xhci-rcar.c | 159 |
22 files changed, 1434 insertions, 30 deletions
diff --git a/drivers/Kconfig b/drivers/Kconfig index 613e60235d..c2e813f5ad 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -10,6 +10,8 @@ source "drivers/ata/Kconfig" source "drivers/block/Kconfig" +source "drivers/bootcount/Kconfig" + source "drivers/clk/Kconfig" source "drivers/cpu/Kconfig" diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig new file mode 100644 index 0000000000..c9d627cce2 --- /dev/null +++ b/drivers/bootcount/Kconfig @@ -0,0 +1,58 @@ +# +# Boot count configuration +# + +menu "Boot count support" + +config BOOTCOUNT + bool "Enable Boot count support" + help + Enable boot count support, which provides the ability to store the + number of times the board has booted on a number of different + persistent storage mediums. + +if BOOTCOUNT + +config BOOTCOUNT_EXT + bool "Boot counter on EXT filesystem" + help + Add support for maintaining boot count in a file on an EXT + filesystem. + +if BOOTCOUNT_EXT + +config SYS_BOOTCOUNT_EXT_INTERFACE + string "Interface on which to find boot counter EXT filesystem" + default "mmc" + depends on BOOTCOUNT_EXT + help + Set the interface to use when locating the filesystem to use for the + boot counter. + +config SYS_BOOTCOUNT_EXT_DEVPART + string "Partition of the boot counter EXT filesystem" + default "0:1" + depends on BOOTCOUNT_EXT + help + Set the partition to use when locating the filesystem to use for the + boot counter. + +config SYS_BOOTCOUNT_EXT_NAME + string "Path and filename of the EXT filesystem based boot counter" + default "/boot/failures" + depends on BOOTCOUNT_EXT + help + Set the filename and path of the file used to store the boot counter. + +config SYS_BOOTCOUNT_ADDR + hex "RAM address used for reading and writing the boot counter" + default 0x7000A000 + depends on BOOTCOUNT_EXT + help + Set the address used for reading and writing the boot counter. + +endif + +endif + +endmenu diff --git a/drivers/bootcount/Makefile b/drivers/bootcount/Makefile index ed9659ad97..45445d24bf 100644 --- a/drivers/bootcount/Makefile +++ b/drivers/bootcount/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_BOOTCOUNT_AM33XX) += bootcount_davinci.o obj-$(CONFIG_BOOTCOUNT_RAM) += bootcount_ram.o obj-$(CONFIG_BOOTCOUNT_ENV) += bootcount_env.o obj-$(CONFIG_BOOTCOUNT_I2C) += bootcount_i2c.o +obj-$(CONFIG_BOOTCOUNT_EXT) += bootcount_ext.o diff --git a/drivers/bootcount/bootcount_ext.c b/drivers/bootcount/bootcount_ext.c new file mode 100644 index 0000000000..e0dd21ba6a --- /dev/null +++ b/drivers/bootcount/bootcount_ext.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2017 General Electric Company. All rights reserved. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <bootcount.h> +#include <fs.h> +#include <mapmem.h> + +#define BC_MAGIC 0xbc + +void bootcount_store(ulong a) +{ + u8 *buf; + loff_t len; + int ret; + + if (fs_set_blk_dev(CONFIG_SYS_BOOTCOUNT_EXT_INTERFACE, + CONFIG_SYS_BOOTCOUNT_EXT_DEVPART, FS_TYPE_EXT)) { + puts("Error selecting device\n"); + return; + } + + buf = map_sysmem(CONFIG_SYS_BOOTCOUNT_ADDR, 2); + buf[0] = BC_MAGIC; + buf[1] = (a & 0xff); + unmap_sysmem(buf); + + ret = fs_write(CONFIG_SYS_BOOTCOUNT_EXT_NAME, + CONFIG_SYS_BOOTCOUNT_ADDR, 0, 2, &len); + if (ret != 0) + puts("Error storing bootcount\n"); +} + +ulong bootcount_load(void) +{ + u8 *buf; + loff_t len_read; + int ret; + + if (fs_set_blk_dev(CONFIG_SYS_BOOTCOUNT_EXT_INTERFACE, + CONFIG_SYS_BOOTCOUNT_EXT_DEVPART, FS_TYPE_EXT)) { + puts("Error selecting device\n"); + return 0; + } + + ret = fs_read(CONFIG_SYS_BOOTCOUNT_EXT_NAME, CONFIG_SYS_BOOTCOUNT_ADDR, + 0, 2, &len_read); + if (ret != 0 || len_read != 2) { + puts("Error loading bootcount\n"); + return 0; + } + + buf = map_sysmem(CONFIG_SYS_BOOTCOUNT_ADDR, 2); + if (buf[0] == BC_MAGIC) + ret = buf[1]; + + unmap_sysmem(buf); + + return ret; +} diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index e21d056efb..2e85ac7df2 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -569,11 +569,6 @@ static const struct spi_clkreg spi_clkregs[] = { .sel_shift = CLK_SPI5_PLL_SEL_SHIFT, }, }; -static inline u32 extract_bits(u32 val, unsigned width, unsigned shift) -{ - return (val >> shift) & ((1 << width) - 1); -} - static ulong rk3399_spi_get_clk(struct rk3399_cru *cru, ulong clk_id) { const struct spi_clkreg *spiclk = NULL; @@ -590,7 +585,8 @@ static ulong rk3399_spi_get_clk(struct rk3399_cru *cru, ulong clk_id) } val = readl(&cru->clksel_con[spiclk->reg]); - div = extract_bits(val, CLK_SPI_PLL_DIV_CON_WIDTH, spiclk->div_shift); + div = bitfield_extract(val, spiclk->div_shift, + CLK_SPI_PLL_DIV_CON_WIDTH); return DIV_TO_RATE(GPLL_HZ, div); } diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index abf1da2ae3..205274e947 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -317,16 +317,19 @@ static int i2c_init_transfer_(struct mxc_i2c_bus *i2c_bus, u8 chip, temp |= I2CR_MTX | I2CR_TX_NO_AK; writeb(temp, base + (I2CR << reg_shift)); - /* write slave address */ - ret = tx_byte(i2c_bus, chip << 1); - if (ret < 0) - return ret; - - while (alen--) { - ret = tx_byte(i2c_bus, (addr >> (alen * 8)) & 0xff); + if (alen >= 0) { + /* write slave address */ + ret = tx_byte(i2c_bus, chip << 1); if (ret < 0) return ret; + + while (alen--) { + ret = tx_byte(i2c_bus, (addr >> (alen * 8)) & 0xff); + if (ret < 0) + return ret; + } } + return 0; } @@ -537,9 +540,11 @@ static int bus_i2c_read(struct mxc_i2c_bus *i2c_bus, u8 chip, u32 addr, if (ret < 0) return ret; - temp = readb(base + (I2CR << reg_shift)); - temp |= I2CR_RSTA; - writeb(temp, base + (I2CR << reg_shift)); + if (alen >= 0) { + temp = readb(base + (I2CR << reg_shift)); + temp |= I2CR_RSTA; + writeb(temp, base + (I2CR << reg_shift)); + } ret = tx_byte(i2c_bus, (chip << 1) | 1); if (ret < 0) { diff --git a/drivers/pinctrl/nxp/pinctrl-imx6.c b/drivers/pinctrl/nxp/pinctrl-imx6.c index 0f767d9079..cac577b40b 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx6.c +++ b/drivers/pinctrl/nxp/pinctrl-imx6.c @@ -13,6 +13,11 @@ static struct imx_pinctrl_soc_info imx6_pinctrl_soc_info; +/* FIXME Before reloaction, BSS is overlapped with DT area */ +static struct imx_pinctrl_soc_info imx6ul_pinctrl_soc_info = { + .flags = ZERO_OFFSET_VALID, +}; + static struct imx_pinctrl_soc_info imx6_snvs_pinctrl_soc_info = { .flags = ZERO_OFFSET_VALID, }; @@ -32,7 +37,7 @@ static const struct udevice_id imx6_pinctrl_match[] = { { .compatible = "fsl,imx6sll-iomuxc-snvs", .data = (ulong)&imx6_snvs_pinctrl_soc_info }, { .compatible = "fsl,imx6sll-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info }, { .compatible = "fsl,imx6sx-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info }, - { .compatible = "fsl,imx6ul-iomuxc", .data = (ulong)&imx6_pinctrl_soc_info }, + { .compatible = "fsl,imx6ul-iomuxc", .data = (ulong)&imx6ul_pinctrl_soc_info }, { .compatible = "fsl,imx6ull-iomuxc-snvs", .data = (ulong)&imx6_snvs_pinctrl_soc_info }, { /* sentinel */ } }; diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3399.c b/drivers/pinctrl/rockchip/pinctrl_rk3399.c index cab268c7d6..19a7415522 100644 --- a/drivers/pinctrl/rockchip/pinctrl_rk3399.c +++ b/drivers/pinctrl/rockchip/pinctrl_rk3399.c @@ -70,11 +70,21 @@ static void pinctrl_rk3399_i2c_config(struct rk3399_grf_regs *grf, PMUGRF_GPIO1C0_SEL_MASK, PMUGRF_I2C0PMU_SCL << PMUGRF_GPIO1C0_SEL_SHIFT); break; + case PERIPH_ID_I2C8: + rk_clrsetreg(&pmugrf->gpio1c_iomux, + PMUGRF_GPIO1C4_SEL_MASK, + PMUGRF_I2C8PMU_SDA << PMUGRF_GPIO1C4_SEL_SHIFT); + rk_clrsetreg(&pmugrf->gpio1c_iomux, + PMUGRF_GPIO1C5_SEL_MASK, + PMUGRF_I2C8PMU_SCL << PMUGRF_GPIO1C5_SEL_SHIFT); + break; case PERIPH_ID_I2C1: case PERIPH_ID_I2C2: case PERIPH_ID_I2C3: case PERIPH_ID_I2C4: case PERIPH_ID_I2C5: + case PERIPH_ID_I2C6: + case PERIPH_ID_I2C7: default: debug("i2c id = %d iomux error!\n", i2c_id); break; @@ -301,6 +311,9 @@ static int rk3399_pinctrl_request(struct udevice *dev, int func, int flags) case PERIPH_ID_I2C3: case PERIPH_ID_I2C4: case PERIPH_ID_I2C5: + case PERIPH_ID_I2C6: + case PERIPH_ID_I2C7: + case PERIPH_ID_I2C8: pinctrl_rk3399_i2c_config(priv->grf, priv->pmugrf, func); break; case PERIPH_ID_SPI0: @@ -375,6 +388,12 @@ static int rk3399_pinctrl_get_periph_id(struct udevice *dev, return PERIPH_ID_I2C4; case 38: return PERIPH_ID_I2C5; + case 37: + return PERIPH_ID_I2C6; + case 36: + return PERIPH_ID_I2C7; + case 58: + return PERIPH_ID_I2C8; case 65: return PERIPH_ID_SDMMC1; #if CONFIG_IS_ENABLED(GMAC_ROCKCHIP) diff --git a/drivers/pwm/pwm-imx-util.c b/drivers/pwm/pwm-imx-util.c index 534dd8eece..97ac0c8fc0 100644 --- a/drivers/pwm/pwm-imx-util.c +++ b/drivers/pwm/pwm-imx-util.c @@ -23,10 +23,12 @@ struct pwm_regs *pwm_id_to_reg(int pwm_id) return (struct pwm_regs *)PWM1_BASE_ADDR; case 1: return (struct pwm_regs *)PWM2_BASE_ADDR; +#ifdef CONFIG_MX6 case 2: return (struct pwm_regs *)PWM3_BASE_ADDR; case 3: return (struct pwm_regs *)PWM4_BASE_ADDR; +#endif #ifdef CONFIG_MX6SX case 4: return (struct pwm_regs *)PWM5_BASE_ADDR; diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index d06130c7a2..2964bb2211 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -30,4 +30,10 @@ config RTC_DS1307 Support for Dallas Semiconductor (now Maxim) DS1307 and DS1338/9 and compatible Real Time Clock devices. +config RTC_S35392A + bool "Enable S35392A driver" + select BITREVERSE + help + Enable s35392a driver which provides rtc get and set function. + endmenu diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 003e31aeba..7a8f97a05f 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -49,5 +49,6 @@ obj-$(CONFIG_RTC_RS5C372A) += rs5c372.o obj-$(CONFIG_RTC_RV3029) += rv3029.o obj-$(CONFIG_RTC_RX8025) += rx8025.o obj-$(CONFIG_RTC_S3C24X0) += s3c24x0_rtc.o +obj-$(CONFIG_RTC_S35392A) += s35392a.o obj-$(CONFIG_SANDBOX) += sandbox_rtc.o obj-$(CONFIG_RTC_X1205) += x1205.o diff --git a/drivers/rtc/s35392a.c b/drivers/rtc/s35392a.c new file mode 100644 index 0000000000..9adcefc98d --- /dev/null +++ b/drivers/rtc/s35392a.c @@ -0,0 +1,365 @@ +/* + * SII Semiconductor Corporation S35392A RTC driver. + * + * Copyright (c) 2017, General Electric Company + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#include <command.h> +#include <common.h> +#include <dm.h> +#include <i2c.h> +#include <linux/bitrev.h> +#include <rtc.h> + +#define S35390A_CMD_STATUS1 0x30 +#define S35390A_CMD_STATUS2 0x31 +#define S35390A_CMD_TIME1 0x32 +#define S35390A_CMD_TIME2 0x33 +#define S35390A_CMD_INT2_REG1 0x35 + +#define S35390A_BYTE_YEAR 0 +#define S35390A_BYTE_MONTH 1 +#define S35390A_BYTE_DAY 2 +#define S35390A_BYTE_WDAY 3 +#define S35390A_BYTE_HOURS 4 +#define S35390A_BYTE_MINS 5 +#define S35390A_BYTE_SECS 6 + +/* flags for STATUS1 */ +#define S35390A_FLAG_POC 0x01 +#define S35390A_FLAG_BLD 0x02 +#define S35390A_FLAG_INT2 0x04 +#define S35390A_FLAG_24H 0x40 +#define S35390A_FLAG_RESET 0x80 + +/* + * If either BLD or POC is set, then the chip has lost power long enough for + * the time value to become invalid. + */ +#define S35390A_LOW_VOLTAGE (S35390A_FLAG_POC | S35390A_FLAG_BLD) + +/*---------------------------------------------------------------------*/ +#undef DEBUG_RTC + +#ifdef DEBUG_RTC +#define DEBUGR(fmt, args...) printf(fmt, ##args) +#else +#define DEBUGR(fmt, args...) +#endif +/*---------------------------------------------------------------------*/ + +#ifdef CONFIG_DM_RTC +#define DEV_TYPE struct udevice +#else +/* Local udevice */ +struct ludevice { + u8 chip; +}; + +#define DEV_TYPE struct ludevice +struct ludevice dev; + +#endif + +#define msleep(a) udelay(a * 1000) + +int lowvoltage; + +static int s35392a_rtc_reset(DEV_TYPE *dev); + +static int s35392a_rtc_read(DEV_TYPE *dev, u8 reg, u8 *buf, int len) +{ + int ret; + +#ifdef CONFIG_DM_RTC + /* TODO: we need to tweak the chip address to reg */ + ret = dm_i2c_read(dev, 0, buf, len); +#else + (void)dev; + ret = i2c_read(reg, 0, -1, buf, len); +#endif + + return ret; +} + +static int s35392a_rtc_write(DEV_TYPE *dev, u8 reg, u8 *buf, int len) +{ + int ret; + +#ifdef CONFIG_DM_RTC + /* TODO: we need to tweak the chip address to reg */ + ret = dm_i2c_write(dev, 0, buf, 1); +#else + (void)dev; + ret = i2c_write(reg, 0, 0, buf, len); +#endif + + return ret; +} + +static int s35392a_rtc_read8(DEV_TYPE *dev, unsigned int reg) +{ + u8 val; + int ret; + + ret = s35392a_rtc_read(dev, reg, &val, sizeof(val)); + return ret < 0 ? ret : val; +} + +static int s35392a_rtc_write8(DEV_TYPE *dev, unsigned int reg, int val) +{ + int ret; + u8 lval = val; + + ret = s35392a_rtc_write(dev, reg, &lval, sizeof(lval)); + return ret < 0 ? ret : 0; +} + +static int validate_time(const struct rtc_time *tm) +{ + if ((tm->tm_year < 2000) || (tm->tm_year > 2099)) + return -EINVAL; + + if ((tm->tm_mon < 1) || (tm->tm_mon > 12)) + return -EINVAL; + + if ((tm->tm_mday < 1) || (tm->tm_mday > 31)) + return -EINVAL; + + if ((tm->tm_wday < 0) || (tm->tm_wday > 6)) + return -EINVAL; + + if ((tm->tm_hour < 0) || (tm->tm_hour > 23)) + return -EINVAL; + + if ((tm->tm_min < 0) || (tm->tm_min > 59)) + return -EINVAL; + + if ((tm->tm_sec < 0) || (tm->tm_sec > 59)) + return -EINVAL; + + return 0; +} + +void s35392a_rtc_init(DEV_TYPE *dev) +{ + int status; + + status = s35392a_rtc_read8(dev, S35390A_CMD_STATUS1); + if (status < 0) + goto error; + + DEBUGR("init: S35390A_CMD_STATUS1: 0x%x\n", status); + + lowvoltage = status & S35390A_LOW_VOLTAGE ? 1 : 0; + + if (status & S35390A_FLAG_POC) + /* + * Do not communicate for 0.5 seconds since the power-on + * detection circuit is in operation. + */ + msleep(500); + + else if (!lowvoltage) + /* + * If both POC and BLD are unset everything is fine. + */ + return; + + if (lowvoltage) + printf("RTC low voltage detected\n"); + + if (!s35392a_rtc_reset(dev)) + return; + +error: + printf("Error RTC init.\n"); +} + +/* Get the current time from the RTC */ +static int s35392a_rtc_get(DEV_TYPE *dev, struct rtc_time *tm) +{ + u8 date[7]; + int ret, i; + + if (lowvoltage) { + DEBUGR("RTC low voltage detected\n"); + return -EINVAL; + } + + ret = s35392a_rtc_read(dev, S35390A_CMD_TIME1, date, sizeof(date)); + if (ret < 0) { + DEBUGR("Error reading date from RTC\n"); + return -EIO; + } + + /* This chip returns the bits of each byte in reverse order */ + for (i = 0; i < 7; ++i) + date[i] = bitrev8(date[i]); + + tm->tm_sec = bcd2bin(date[S35390A_BYTE_SECS]); + tm->tm_min = bcd2bin(date[S35390A_BYTE_MINS]); + tm->tm_hour = bcd2bin(date[S35390A_BYTE_HOURS] & ~S35390A_FLAG_24H); + tm->tm_wday = bcd2bin(date[S35390A_BYTE_WDAY]); + tm->tm_mday = bcd2bin(date[S35390A_BYTE_DAY]); + tm->tm_mon = bcd2bin(date[S35390A_BYTE_MONTH]); + tm->tm_year = bcd2bin(date[S35390A_BYTE_YEAR]) + 2000; + + DEBUGR("Get DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n", + tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, + tm->tm_hour, tm->tm_min, tm->tm_sec); + + return 0; +} + +/* Set the RTC */ +static int s35392a_rtc_set(DEV_TYPE *dev, const struct rtc_time *tm) +{ + int i, ret; + int status; + u8 date[7]; + + DEBUGR("Set DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n", + tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, + tm->tm_hour, tm->tm_min, tm->tm_sec); + + ret = validate_time(tm); + if (ret < 0) + return -EINVAL; + + /* We support only 24h mode */ + ret = s35392a_rtc_read8(dev, S35390A_CMD_STATUS1); + if (ret < 0) + return -EIO; + status = ret; + + ret = s35392a_rtc_write8(dev, S35390A_CMD_STATUS1, + status | S35390A_FLAG_24H); + if (ret < 0) + return -EIO; + + date[S35390A_BYTE_YEAR] = bin2bcd(tm->tm_year - 2000); + date[S35390A_BYTE_MONTH] = bin2bcd(tm->tm_mon); + date[S35390A_BYTE_DAY] = bin2bcd(tm->tm_mday); + date[S35390A_BYTE_WDAY] = bin2bcd(tm->tm_wday); + date[S35390A_BYTE_HOURS] = bin2bcd(tm->tm_hour); + date[S35390A_BYTE_MINS] = bin2bcd(tm->tm_min); + date[S35390A_BYTE_SECS] = bin2bcd(tm->tm_sec); + + /* This chip expects the bits of each byte to be in reverse order */ + for (i = 0; i < 7; ++i) + date[i] = bitrev8(date[i]); + + ret = s35392a_rtc_write(dev, S35390A_CMD_TIME1, date, sizeof(date)); + if (ret < 0) { + DEBUGR("Error writing date to RTC\n"); + return -EIO; + } + + /* Now we have time. Reset the low voltage status */ + lowvoltage = 0; + + return 0; +} + +/* Reset the RTC. */ +static int s35392a_rtc_reset(DEV_TYPE *dev) +{ + int buf; + int ret; + unsigned int initcount = 0; + + buf = S35390A_FLAG_RESET; + +initialize: + ret = s35392a_rtc_write8(dev, S35390A_CMD_STATUS1, buf); + if (ret < 0) + return -EIO; + + ret = s35392a_rtc_read8(dev, S35390A_CMD_STATUS1); + if (ret < 0) + return -EIO; + buf = ret; + + if (!lowvoltage) + lowvoltage = buf & S35390A_LOW_VOLTAGE ? 1 : 0; + + if (buf & S35390A_LOW_VOLTAGE) { + /* Try up to five times to reset the chip */ + if (initcount < 5) { + ++initcount; + goto initialize; + } else { + return -EIO; + } + } + + return 0; +} + +#ifndef CONFIG_DM_RTC + +int rtc_get(struct rtc_time *tm) +{ + return s35392a_rtc_get(&dev, tm); +} + +int rtc_set(struct rtc_time *tm) +{ + return s35392a_rtc_set(&dev, tm); +} + +void rtc_reset(void) +{ + s35392a_rtc_reset(&dev); +} + +void rtc_init(void) +{ + s35392a_rtc_init(&dev); +} + +#else + +static int s35392a_probe(struct udevice *dev) +{ + s35392a_rtc_init(dev); + return 0; +} + +static const struct rtc_ops s35392a_rtc_ops = { + .get = s35392a_rtc_get, + .set = s35392a_rtc_set, + .read8 = s35392a_rtc_read8, + .write8 = s35392a_rtc_write8, + .reset = s35392a_rtc_reset, +}; + +static const struct udevice_id s35392a_rtc_ids[] = { + { .compatible = "sii,s35392a-rtc" }, + { } +}; + +U_BOOT_DRIVER(s35392a_rtc) = { + .name = "s35392a_rtc", + .id = UCLASS_RTC, + .probe = s35392a_probe, + .of_match = s35392a_rtc_ids, + .ops = &s35392a_rtc_ops, +}; + +#endif diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index fd3da922a6..dd7b9cddb1 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -32,6 +32,7 @@ #include <spl.h> #include <image.h> #include <imximage.h> +#include <watchdog.h> #define HID_REPORT_ID_MASK 0x000000ff @@ -602,6 +603,8 @@ int sdp_init(int controller_index) puts("\rCTRL+C - Operation aborted.\n"); return 1; } + + WATCHDOG_RESET(); usb_gadget_handle_interrupts(controller_index); } @@ -712,6 +715,7 @@ void sdp_handle(int controller_index) return; } + WATCHDOG_RESET(); usb_gadget_handle_interrupts(controller_index); sdp_handle_in_ep(); diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c index b6df130a14..4d5a9a8c42 100644 --- a/drivers/usb/gadget/storage_common.c +++ b/drivers/usb/gadget/storage_common.c @@ -309,7 +309,7 @@ static struct fsg_lun *fsg_lun_from_dev(struct device *dev) #define FSG_NUM_BUFFERS 2 /* Default size of buffer length. */ -#define FSG_BUFLEN ((u32)16384) +#define FSG_BUFLEN ((u32)131072) /* Maximal number of LUNs supported in mass storage function */ #define FSG_MAX_LUNS 8 diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 5264475fa5..c79f866cf1 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/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index be3e842dcc..2582bf36eb 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -210,9 +210,6 @@ static int ehci_shutdown(struct ehci_ctrl *ctrl) uint32_t cmd, reg; int max_ports = HCS_N_PORTS(ehci_readl(&ctrl->hccr->cr_hcsparams)); - if (!ctrl || !ctrl->hcor) - return -EINVAL; - cmd = ehci_readl(&ctrl->hcor->or_usbcmd); /* If not run, directly return */ if (!(cmd & CMD_RUN)) @@ -595,8 +592,9 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, * dangerous operation, it's responsibility of the calling * code to make sure enough space is reserved. */ - invalidate_dcache_range((unsigned long)buffer, - ALIGN((unsigned long)buffer + length, ARCH_DMA_MINALIGN)); + if (buffer != NULL && length > 0) + invalidate_dcache_range((unsigned long)buffer, + ALIGN((unsigned long)buffer + length, ARCH_DMA_MINALIGN)); /* Check that the TD processing happened */ if (QT_TOKEN_GET_STATUS(token) & QT_TOKEN_STATUS_ACTIVE) @@ -1112,6 +1110,8 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) rc = ehci_hcd_init(index, init, &ctrl->hccr, &ctrl->hcor); if (rc) return rc; + if (!ctrl->hccr || !ctrl->hcor) + return -1; if (init == USB_INIT_DEVICE) goto done; @@ -1613,11 +1613,14 @@ int ehci_register(struct udevice *dev, struct ehci_hccr *hccr, { struct usb_bus_priv *priv = dev_get_uclass_priv(dev); struct ehci_ctrl *ctrl = dev_get_priv(dev); - int ret; + int ret = -1; debug("%s: dev='%s', ctrl=%p, hccr=%p, hcor=%p, init=%d\n", __func__, dev->name, ctrl, hccr, hcor, init); + if (!ctrl || !hccr || !hcor) + goto err; + priv->desc_before_addr = true; ehci_setup_ops(ctrl, ops); diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 7c39becd24..18692b732e 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h @@ -101,11 +101,11 @@ struct usb_linux_config_descriptor { } __attribute__ ((packed)); #if defined CONFIG_EHCI_DESC_BIG_ENDIAN -#define ehci_readl(x) cpu_to_be32(readl(x)) -#define ehci_writel(a, b) writel(cpu_to_be32(b), a) +#define ehci_readl(x) be32_to_cpu(__raw_readl(x)) +#define ehci_writel(a, b) __raw_writel(cpu_to_be32(b), a) #else -#define ehci_readl(x) cpu_to_le32(readl(x)) -#define ehci_writel(a, b) writel(cpu_to_le32(b), a) +#define ehci_readl(x) readl(x) +#define ehci_writel(a, b) writel(b, a) #endif #if defined CONFIG_EHCI_MMIO_BIG_ENDIAN diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 6ef51906c2..28d2bc8454 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c @@ -82,6 +82,7 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597) } } while ((tmp & USBE) != USBE); r8a66597_bclr(r8a66597, USBE, SYSCFG0); +#if !defined(CONFIG_RZA_USB) r8a66597_mdfy(r8a66597, CONFIG_R8A66597_XTAL, XTAL, SYSCFG0); i = 0; @@ -94,6 +95,20 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597) return -1; } } while ((tmp & SCKE) != SCKE); +#else + /* + * RZ/A Only: + * Bits XTAL(UCKSEL) and UPLLE in SYSCFG0 for USB0 controls both USB0 + * and USB1, so we must always set the USB0 register + */ +#if (CONFIG_R8A66597_XTAL == 1) + setbits(le16, R8A66597_BASE0, XTAL); +#endif + mdelay(1); + setbits(le16, R8A66597_BASE0, UPLLE); + mdelay(1); + r8a66597_bset(r8a66597, SUSPM, SUSPMODE0); +#endif /* CONFIG_RZA_USB */ #endif /* #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) */ return 0; @@ -101,6 +116,7 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597) static void r8a66597_clock_disable(struct r8a66597 *r8a66597) { +#if !defined(CONFIG_RZA_USB) r8a66597_bclr(r8a66597, SCKE, SYSCFG0); udelay(1); #if !defined(CONFIG_SUPERH_ON_CHIP_R8A66597) @@ -108,6 +124,15 @@ static void r8a66597_clock_disable(struct r8a66597 *r8a66597) r8a66597_bclr(r8a66597, XCKE, SYSCFG0); r8a66597_bclr(r8a66597, USBE, SYSCFG0); #endif +#else + r8a66597_bclr(r8a66597, SUSPM, SUSPMODE0); + + clrbits(le16, R8A66597_BASE0, UPLLE); + mdelay(1); + r8a66597_bclr(r8a66597, USBE, SYSCFG0); + mdelay(1); + +#endif } static void r8a66597_enable_port(struct r8a66597 *r8a66597, int port) @@ -118,7 +143,9 @@ static void r8a66597_enable_port(struct r8a66597 *r8a66597, int port) r8a66597_bset(r8a66597, val, get_syscfg_reg(port)); r8a66597_bset(r8a66597, HSE, get_syscfg_reg(port)); +#if !defined(CONFIG_RZA_USB) r8a66597_write(r8a66597, BURST | CPU_ADR_RD_WR, get_dmacfg_reg(port)); +#endif } static void r8a66597_disable_port(struct r8a66597 *r8a66597, int port) @@ -148,7 +175,9 @@ static int enable_controller(struct r8a66597 *r8a66597) if (ret < 0) return ret; +#if !defined(CONFIG_RZA_USB) r8a66597_bset(r8a66597, CONFIG_R8A66597_LDRV & LDRV, PINCFG); +#endif r8a66597_bset(r8a66597, USBE, SYSCFG0); r8a66597_bset(r8a66597, INTL, SOFCFG); @@ -266,12 +295,30 @@ static int send_setup_packet(struct r8a66597 *r8a66597, struct usb_device *dev, unsigned long setup_addr = USBREQ; u16 intsts1; int timeout = 3000; +#if defined(CONFIG_RZA_USB) + u16 dcpctr; + int timeout2 = 10000; +#endif u16 devsel = setup->request == USB_REQ_SET_ADDRESS ? 0 : dev->devnum; r8a66597_write(r8a66597, make_devsel(devsel) | (8 << dev->maxpacketsize), DCPMAXP); r8a66597_write(r8a66597, ~(SIGN | SACK), INTSTS1); +#if defined(CONFIG_RZA_USB) + dcpctr = r8a66597_read(r8a66597, DCPCTR); + if ((dcpctr & PID) == PID_BUF) { + timeout2 = 10000; + while (!(dcpctr & BSTS)) { + dcpctr = r8a66597_read(r8a66597, DCPCTR); + if (timeout2-- < 0) { + printf("DCPCTR clear timeout!\n"); + break; + } + } + } +#endif + for (i = 0; i < 4; i++) { r8a66597_write(r8a66597, le16_to_cpu(p[i]), setup_addr); setup_addr += 2; diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h index 67dc3c4588..baa16605d8 100644 --- a/drivers/usb/host/r8a66597.h +++ b/drivers/usb/host/r8a66597.h @@ -87,8 +87,10 @@ #define DEVADD8 0xE0 #define DEVADD9 0xE2 #define DEVADDA 0xE4 +#define SUSPMODE0 0x102 /* RZ/A only */ /* System Configuration Control Register */ +#if !defined(CONFIG_RZA_USB) #define XTAL 0xC000 /* b15-14: Crystal selection */ #define XTAL48 0x8000 /* 48MHz */ #define XTAL24 0x4000 /* 24MHz */ @@ -98,10 +100,17 @@ #define SCKE 0x0400 /* b10: USB clock enable */ #define PCSDIS 0x0200 /* b9: not CS wakeup */ #define LPSME 0x0100 /* b8: Low power sleep mode */ +#endif #define HSE 0x0080 /* b7: Hi-speed enable */ #define DCFM 0x0040 /* b6: Controller function select */ #define DRPD 0x0020 /* b5: D+/- pull down control */ #define DPRPU 0x0010 /* b4: D+ pull up control */ +#if defined(CONFIG_RZA_USB) +#define XTAL 0x0004 /* b2: Crystal selection */ +#define XTAL12 0x0004 /* 12MHz */ +#define XTAL48 0x0000 /* 48MHz */ +#define UPLLE 0x0002 /* b1: internal PLL control */ +#endif #define USBE 0x0001 /* b0: USB module operation enable */ /* System Configuration Status Register */ @@ -173,10 +182,15 @@ #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) #define MBW 0x0800 #else +#if !defined(CONFIG_RZA_USB) #define MBW 0x0400 /* b10: Maximum bit width for FIFO access */ +#else +#define MBW 0x0800 /* b10: Maximum bit width for FIFO access */ +#endif #endif #define MBW_8 0x0000 /* 8bit */ #define MBW_16 0x0400 /* 16bit */ +#define MBW_32 0x0800 /* 32bit */ #define BIGEND 0x0100 /* b8: Big endian mode */ #define BYTE_LITTLE 0x0000 /* little dendian */ #define BYTE_BIG 0x0100 /* big endifan */ @@ -379,6 +393,9 @@ #define USBSPD 0x00C0 #define RTPORT 0x0001 +/* Suspend Mode Register */ +#define SUSPM 0x4000 /* b14: Suspend */ + #define R8A66597_MAX_NUM_PIPE 10 #define R8A66597_BUF_BSIZE 8 #define R8A66597_MAX_DEVICE 10 @@ -419,7 +436,7 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, int len) { int i; -#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) +#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) || defined(CONFIG_RZA_USB) unsigned long fifoaddr = r8a66597->reg + offset; unsigned long count; unsigned long *p = buf; @@ -453,7 +470,7 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, { int i; unsigned long fifoaddr = r8a66597->reg + offset; -#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) +#if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) || defined(CONFIG_RZA_USB) unsigned long count; unsigned char *pb; unsigned long *p = buf; 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@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[] = { + 0xf4c455aa, 0x00d20014, 0x00000000, 0x23dc00e8, + 0x00000000, 0x1a5c2007, 0x0001ff63, 0x001eff80, + 0x0001ff23, 0x007f1a44, 0xff631a5c, 0xff800001, + 0xff2301e2, 0x1a440001, 0x0780007f, 0x06250061, + 0x00021e74, 0x40002e05, 0x40002e05, 0x8000f625, + 0xdc90062a, 0x556f0000, 0xdd14062a, 0x17040000, + 0x5573d612, 0x15ea062a, 0x57650000, 0x16c285d5, + 0x060200f0, 0x1deaffe0, 0xe4251724, 0x05d9128d, + 0x10001620, 0xe4251764, 0xd6151724, 0x1db1129f, + 0x8625ef25, 0x0088063f, 0x32010002, 0x3200007d, + 0x0392ffbe, 0x05e251e0, 0xffbe3200, 0x51e003e4, + 0x520005ba, 0xef2515f5, 0x063f8625, 0x000200ae, + 0x007d3200, 0xd6151724, 0x05b9129d, 0x0d8cffbe, + 0xd61417c4, 0xd6179e24, 0x000037d3, 0x4ad0ffbe, + 0x06405201, 0x26e6007f, 0x0f9a0631, 0x063f0000, + 0x00000e64, 0x0782007f, 0x8f250061, 0xee248019, + 0x30030000, 0x00f4063f, 0x00710002, 0x80158725, + 0x00d00626, 0x3a010002, 0x0108063f, 0x00700002, + 0x0505f01d, 0x7e3d0501, 0x7d030008, 0x80001640, + 0x150d1511, 0xf6241509, 0x0509fd00, 0x1503121f, + 0x801d7725, 0x00013723, 0x1764121e, 0x063f5c11, + 0x0002013e, 0x0642006e, 0x0780007f, 0xe8060061, + 0x0d0cffbe, 0x0001577d, 0x007f0640, 0x0d0a07be, + 0x17201624, 0x9c00062a, 0x118a03ff, 0x17210764, + 0xffec0602, 0xf6240d89, 0x35011720, 0x12820503, + 0x1505125d, 0x1724007f, 0x11461721, 0xf6241db2, + 0x55021720, 0x12c2100a, 0x3f6211c4, 0x160a172d, + 0x15030001, 0x17295724, 0x05bb51e2, 0x17250764, + 0x17251724, 0xeeee062a, 0x12c2eeee, 0x576211c4, + 0x007f172d, 0x00610780, 0xe8060086, 0x17e0ffbe, + 0x5c591724, 0x1281580a, 0xe9e00db1, 0x17240d92, + 0x129dd605, 0x172405d9, 0x129dd605, 0x500bfdd1, + 0x007f0640, 0x3bd60631, 0x063f0000, 0x00000e64, + 0x0780007f, 0x06250061, 0x00021e74, 0x40002e05, + 0x40002e05, 0x0dd00744, 0x17441201, 0xef840dd1, + 0xea610dd1, 0x0dc205e1, 0x0dd1ea63, 0x15b50df2, + 0x0046ff80, 0x1de251e0, 0x14b6ff80, 0xff800df5, + 0x0dc50116, 0x023aff80, 0xff8005b5, 0xff800360, + 0x05c514be, 0xffbe3201, 0x3f841702, 0x39fd0dd1, + 0x0622ddf2, 0xaaaa1100, 0x32013902, 0x16d8ffbe, + 0x0640d5f5, 0x0780007f, 0xffbe0061, 0x51e00398, + 0x320105ca, 0x00eeffbe, 0x1c3affbe, 0x0386ffbe, + 0x05ca51e0, 0xffbe3201, 0xff8000dc, 0xff800438, + 0x321f04a2, 0xfebcffbf, 0x036affbe, 0x05ca51e0, + 0xffbe3201, 0x172400c0, 0x1282d60d, 0xffbe15e9, + 0xf62442ce, 0x1500d600, 0xf1ff5620, 0x1501114a, + 0xd6051724, 0x05d9128d, 0xd6019e24, 0x000087d3, + 0xd6b91724, 0x08f01764, 0x032affbe, 0x05ca51e0, + 0xffbe3201, 0xef250080, 0x063f8625, 0x000202fc, + 0x007d3201, 0x030effbe, 0x05ca51e0, 0xffbe3201, + 0xff800064, 0x062604d6, 0x000224ac, 0x1de8ffbe, + 0x15f251e0, 0x02eeffbe, 0x05ca51e0, 0xffbe3201, + 0xef250044, 0x063f8625, 0x00020338, 0x007d3200, + 0x016087e0, 0xffbe3201, 0x52011578, 0x0dd05744, + 0x007f0640, 0x30e10780, 0xd6051724, 0x128dd200, + 0x172415a9, 0x1282d60d, 0x172405d1, 0x1285d605, + 0x9e240da1, 0x17d3d600, 0xffbe0000, 0xff80440a, + 0x6dd500e2, 0x481affbe, 0xd7e91724, 0x15d11284, + 0xd60d1724, 0x15911282, 0x1e26ffbe, 0xd6011724, + 0x05b91298, 0xd602bfc4, 0xd6051724, 0x05d9129b, + 0x04001640, 0xd6051764, 0xd7e91724, 0x05a91284, + 0x1724d201, 0x128dd605, 0x17240d91, 0x1282d60d, + 0xd1e005d9, 0xffbe05ba, 0xef251eda, 0x063f82b1, + 0x000203de, 0x1724007d, 0x1282d60d, 0xd1e035a9, + 0x172435ea, 0x1281d6b9, 0x178425f9, 0x11e008f3, + 0xea0125ba, 0x80001625, 0x00c4de02, 0x301d15d5, + 0xffbe0086, 0x51e0d8a6, 0x372a0de2, 0xe73b0001, + 0x063f0001, 0x00020422, 0x51e0007c, 0x87c405ca, + 0x0da5d6b8, 0x1724ea41, 0x52025c59, 0x05a91281, + 0xe9ea5201, 0x1201e5d7, 0x08f91744, 0xd60c8fc4, + 0x05dad1e0, 0x205affbe, 0x03caff80, 0x30ff0640, + 0x00610780, 0x8625ef25, 0x046a063f, 0x32010002, + 0xffbe007d, 0xffbe1572, 0x064015de, 0x0780007f, + 0x17a40061, 0x12610dd1, 0x178415ba, 0x11e0e459, + 0xffbe0df2, 0xef2542f2, 0x063f806d, 0x0002049a, + 0x9e24007d, 0x1fd3d60f, 0x07440000, 0x17240dd1, + 0x1285d605, 0x27c405e9, 0xff80d6b2, 0x45d50092, + 0x82b9ef25, 0x04c4063f, 0x007d0002, 0x05c251e0, + 0x181effbe, 0x17243da5, 0x1282e421, 0x32000dd9, + 0x13deffbe, 0x82c1ef25, 0x04e8063f, 0x007d0002, + 0x0dd00744, 0x17242da5, 0x1288e421, 0xffbe05b9, + 0x17242250, 0x1289e425, 0xffbe05b9, 0x1724224c, + 0x128ae425, 0xffbe05b9, 0xffbe24d6, 0x51e000f8, + 0x320105ca, 0xfe4effbd, 0xe4211724, 0x0dd91281, + 0x0dd117a4, 0x05da1261, 0xd60f9e24, 0x00001fd3, + 0xd60c9fc4, 0x0026ff80, 0x007f0640, 0x00610780, + 0x8625ef25, 0x0556063f, 0x32000002, 0xffbe007d, + 0xffbe1562, 0x0640166e, 0x0782007f, 0xef250061, + 0x063f8019, 0x00020574, 0x007d3003, 0x8625ef25, + 0x0582063f, 0x32000002, 0xffbe007d, 0xffbe168c, + 0x372316b4, 0xef250001, 0x063f801d, 0x0002059a, + 0xffbe007d, 0x06421724, 0x0780007f, 0x172400e1, + 0x1281e421, 0x17240d81, 0x1284e439, 0xff8005c1, + 0x45c50090, 0x82b9ef25, 0x05c8063f, 0x007d0002, + 0x05c251e0, 0x188affbe, 0xef253d95, 0x063f82d5, + 0x000205e0, 0x007d3200, 0x8311ef25, 0x05ec063f, + 0x007d0002, 0x08f717a4, 0x05ba11e0, 0x0450ff80, + 0x02bcff80, 0x08f71784, 0x25821262, 0x08f717a4, + 0x1dca11e0, 0x456cffbe, 0xffbee00a, 0xef25313e, + 0x063f82e1, 0x00020622, 0xef25007d, 0x063f82f1, + 0x0002062e, 0xffbe007d, 0xe1e0327a, 0xffbe05f2, + 0x51e04542, 0xffbe05ba, 0x06402cf4, 0x078200ff, + 0xef250061, 0x063f8019, 0x00020658, 0x007d3003, + 0x8625ef25, 0x0666063f, 0x32010002, 0x1724007d, + 0x1281ea01, 0x07c405b1, 0xffbeea00, 0xf62416da, + 0x1558d600, 0x00105640, 0x1559110a, 0x171affbe, + 0x00013723, 0x801def25, 0x0698063f, 0x007d0002, + 0x85adef25, 0x06a4063f, 0x007d0002, 0x8019ef25, + 0x06b2063f, 0x30030002, 0xffbe007d, 0x3723174e, + 0xef250001, 0x063f801d, 0x000206c6, 0x0642007d, + 0x0780007f, 0x121f0061, 0x5c00f624, 0x15091507, + 0x150d150b, 0xfd00f624, 0x15031505, 0xe900f624, + 0x15071505, 0xd600f624, 0x15061505, 0x0d911282, + 0x1764121f, 0x0000d605, 0x00000000, 0x00000000, + 0x8001ef25, 0x0714063f, 0x007d0002, 0x8015ef25, + 0x01ec0626, 0x3a020002, 0x0728063f, 0x007d0002, + 0x8021ef25, 0x0734063f, 0x007d0002, 0x007f0640, + 0x00210780, 0xfbccffbd, 0x07d01620, 0x0fb8f624, + 0x56801480, 0x5481ffff, 0x14835482, 0x001c1620, + 0x0818f624, 0x520413b0, 0x120353b1, 0x13b313b2, + 0x5bb45a01, 0x5c8153b5, 0x00c85620, 0x5e205482, + 0x5c830190, 0x00645e20, 0x54855c84, 0x04870486, + 0x00fa5620, 0x5e205488, 0x5c89012c, 0x5e20548a, + 0x5c8b0014, 0x03c05620, 0x5205548c, 0x539b539a, + 0x639c6206, 0x6b9d6a09, 0x539f5b9e, 0x63a153a0, + 0x5ba25a0a, 0x00105e20, 0x5a025ba3, 0x5ba55ba4, + 0x13a713a6, 0x5ba913a8, 0x13ab5baa, 0x13ad13ac, + 0x5baf53ae, 0x003f0640, 0x00610780, 0xe000f624, + 0x96201544, 0x9e24f0ff, 0x1152fb75, 0x03001682, + 0xafd31545, 0xffbe0000, 0x27c41806, 0xef25d6b2, + 0x063f834d, 0x00020812, 0xffbe007d, 0x064018a0, + 0x0782007f, 0xef250061, 0x063f8019, 0x0002082c, + 0x007d3003, 0x08f317a4, 0x1d8a1261, 0xd6051724, + 0x15c9129c, 0x08001640, 0xd6051764, 0x00001200, + 0x00000000, 0x00000000, 0x12671241, 0x1724fd96, + 0x129cd605, 0x074405b1, 0xffbe08f3, 0x51e02500, + 0xffbe1dc2, 0x37232554, 0xef250001, 0x063f801d, + 0x0002087e, 0x1724007d, 0x5640d605, 0x114a0300, + 0xffbe15c2, 0x17241a1e, 0x1282fd05, 0x17240de1, + 0x1285d605, 0x0d95fd91, 0x00013723, 0x801def25, + 0x08b0063f, 0x007d0002, 0x007f0642, 0x00610782, + 0x8019ef25, 0x08c6063f, 0x30030002, 0xffbe007d, + 0x51e02650, 0xffbe05da, 0xffbe26d6, 0x37232710, + 0xef250001, 0x063f801d, 0x000208e6, 0x0642007d, + 0x0780007f, 0xffbe0021, 0x51e02906, 0xffbe05b2, + 0x06402acc, 0x0780003f, 0xef250061, 0x063f8631, + 0x0002090e, 0x51e0007d, 0xffbe05ba, 0x0640325c, + 0x0780007f, 0xd20070e1, 0x17441201, 0x16250855, + 0xce028000, 0xde020330, 0x17240334, 0xe802eab5, + 0xea9aeaca, 0x003f16c2, 0x35c2e9e2, 0x001f16dd, + 0x000c36e2, 0x170631c4, 0x362694b4, 0x12d894b0, + 0x1261129c, 0x05d21df1, 0x0da11263, 0x1da515c2, + 0x0001e739, 0x0974063f, 0x007c0002, 0xe73b15d5, + 0x063f0001, 0x00020982, 0x06aa007c, 0x0dc2ffff, + 0x0da5d201, 0x0009e73b, 0x0998063f, 0x007c0002, + 0xff8005b5, 0xea41003e, 0x003f56dd, 0xeab65744, + 0x1640c5d5, 0xf6240001, 0x1503ea00, 0xe802155a, + 0xea9aeaca, 0x003f16c2, 0xbd8ae9e2, 0x05fad261, + 0x8339ef25, 0x09d4063f, 0x007d0002, 0x70ff0640, + 0x00610780, 0x5864f006, 0x5ad81303, 0x12d85a9c, + 0x0dba1299, 0x80011724, 0x30005640, 0x25d2114a, + 0x80011724, 0x129a12ca, 0x52c25002, 0x572a51c4, + 0x66408001, 0x514c8000, 0x060b1d82, 0x15d1fff0, + 0x57eb5201, 0x5f2400c0, 0x514be435, 0x38020de2, + 0x000c16e2, 0x854def25, 0x47e211c4, 0x32440fc9, + 0x0a40063f, 0x007d0002, 0x007f0640, 0x00e10780, + 0x2200063c, 0xf624aaaa, 0xe86000a4, 0xea610384, + 0x0d8205e1, 0x0d91ea63, 0x0dd50db2, 0x4292ffbe, + 0xff800dd5, 0x0da50034, 0x0076ff80, 0xffbe05f5, + 0x05c542de, 0xffbe3202, 0x3f840ed2, 0x39fd00a5, + 0x391c05d2, 0xffbe3202, 0x17840eae, 0x11e000a9, + 0x0640ddba, 0x078000ff, 0xefa40061, 0xea6100a5, + 0x159205e1, 0x05e1ea63, 0x0da50d82, 0x430effbe, + 0xffbe0da5, 0x05f543bc, 0x4406ffbe, 0x320305c5, + 0x0e88ffbe, 0x00a53fa4, 0x0d8239fd, 0x33000622, + 0x3902aaaa, 0xffbe3204, 0x06400e5e, 0x0780007f, + 0xef8400e1, 0xe7a400a7, 0x101d00a7, 0xffed0602, + 0x00424de1, 0x00160013, 0x001c0019, 0x0022001f, + 0x00280025, 0x002e002b, 0x00340031, 0x003a0037, + 0x0040003d, 0x00490043, 0xffbe0046, 0x3da543ea, + 0x4488ffbe, 0xffbe35f5, 0x35c5448a, 0x0098ff80, + 0xff803595, 0x2de500d4, 0x0114ff80, 0xff802db5, + 0x2d8501a8, 0x01e0ff80, 0xff8025d5, 0x25a502fe, + 0x05b0ff80, 0xff801df5, 0x1dc505d4, 0x694effbe, + 0xffbe1d95, 0x15e56a22, 0x0604ff80, 0xff8015b5, + 0x1585061e, 0x6c9effbe, 0xffbe0dd5, 0x0da56cea, + 0x6d96ffbe, 0xffbe05f5, 0x05c56e5e, 0xffbe3204, + 0x3f840dba, 0x39fd00a7, 0x06220d82, 0xaaaa4400, + 0x32083902, 0x0d90ffbe, 0x00a73fa4, 0x0d9239fc, + 0x55000622, 0x3902aaaa, 0x00103620, 0x0d78ffbe, + 0x00ff0640, 0x00a717a4, 0x1dab1269, 0x000a0042, + 0x001b000c, 0x0010000e, 0x0012001b, 0x001b0014, + 0x07be0016, 0x07be4470, 0x07be4522, 0x07be458e, + 0x07be45ae, 0x07be461a, 0x07be463a, 0x32054696, + 0x0d4807be, 0x17a4007f, 0x126900a7, 0x00421dcb, + 0x001d000a, 0x0010000c, 0x0016000e, 0x00140012, + 0x0018001d, 0x46fc07be, 0x47d607be, 0x494407be, + 0x487207be, 0x4a3607be, 0x4a8a07be, 0x497a07be, + 0x4b7407be, 0x07be3206, 0x007f0d02, 0x00a717a4, + 0xffe70602, 0x004245d1, 0x00460019, 0x001d001b, + 0x0021001f, 0x00250023, 0x00290027, 0x002d002b, + 0x0031002f, 0x00350033, 0x00370046, 0x003b0039, + 0x0046003d, 0x0046003f, 0x07be0041, 0x07be4b80, + 0x07be4c5e, 0x07be4d0c, 0x07be4d72, 0x07be4dd2, + 0x07be4e8c, 0x07be4f12, 0x07be504c, 0x07be50f6, + 0x07be512c, 0x07be51c6, 0x07be5212, 0x07be5320, + 0x07be5462, 0x07be54d0, 0x07be55fa, 0x07be562e, + 0x07be5698, 0x07be56d0, 0x07be582c, 0x3207599c, + 0x0c6807be, 0x17a4007f, 0x126900a7, 0x00421d8b, + 0x0019000a, 0x000e000c, 0x00100019, 0x00120019, + 0x00140019, 0x5a3e07be, 0x5abc07be, 0x5b5407be, + 0x5bba07be, 0x5c2207be, 0x5d3c07be, 0x07be3208, + 0x007f0c2a, 0x00a717a4, 0x0d811261, 0x12631582, + 0x0dd205f1, 0x05e21264, 0x07be05f5, 0x07805d24, + 0x07be0010, 0x32095f2c, 0x0c0007be, 0x0786007f, + 0x378470e1, 0x16240811, 0xe8068284, 0xe9c2eac5, + 0xe4391724, 0xd200e200, 0x07a4de24, 0x05e91283, + 0x07b337a4, 0x6cb6ffbe, 0xffbe65e5, 0x171da9f6, + 0x12d90001, 0x1264129d, 0xf7dd0d9a, 0x05e20006, + 0x0007e79d, 0xe2d8d201, 0x17bbe29f, 0x3784000d, + 0xcf250811, 0x063f83cd, 0x00020dbc, 0x129f12de, + 0x00793802, 0xf6241201, 0x139c00ac, 0xd1e0039d, + 0xe1e02582, 0x171d0dda, 0xf6240015, 0x12ddeb54, + 0x12c3129e, 0x121ff1c2, 0x15031501, 0x120115a5, + 0x00acf624, 0x571d139c, 0x56ca000b, 0x5241001f, + 0x00c017ea, 0x139d125f, 0x07b4f624, 0x05030501, + 0x0e5497c4, 0x0e540fc4, 0x000d3f3b, 0x0e5407c4, + 0x17441203, 0x300700a7, 0x3acb3298, 0x3ac63a9b, + 0x08e0ffbe, 0x00ac3624, 0x00401620, 0x1501f003, + 0x17250503, 0x3e24839d, 0x400a0e54, 0x1505480b, + 0x05ccffbe, 0x70ff0646, 0x00210780, 0x00a717a4, + 0x0d911261, 0x126415f2, 0x15f22591, 0x1d811266, + 0x1d950de2, 0x003aff80, 0xfd191724, 0x129512c5, + 0x16c21242, 0x17440003, 0x15851714, 0x0132ff80, + 0xffbe0dd5, 0x0da55f18, 0x01a6ff80, 0xffbe05f5, + 0x05c560f8, 0xffbe320a, 0x06400ab2, 0x0780003f, + 0x5f2400e1, 0xee2407b1, 0x662407a4, 0x100b8000, + 0x50021298, 0x51cc52c2, 0x0da211e0, 0xffdf0602, + 0x172a05f1, 0x56400001, 0x51428000, 0x320b05ba, + 0x56405dc5, 0x51423000, 0x36c255e2, 0x100b00ff, + 0xe72512cb, 0x129b841d, 0x063f3802, 0x00020efa, + 0x5744007c, 0x008a0810, 0x060d680a, 0x05baff01, + 0x45b53205, 0x100d6ac5, 0x172211c4, 0x16c28299, + 0x12610007, 0x12633df2, 0x100a35ea, 0x66c21285, + 0x16ca0003, 0x5a01001f, 0x00c05fe2, 0x17196764, + 0x100c62c2, 0x172211c4, 0x5f64ea49, 0x114b171d, + 0x17241dea, 0x12c5fd19, 0x12421295, 0x000376c2, + 0xfd191724, 0x129512c5, 0x000316c2, 0xfd9a11ee, + 0x172d69c4, 0x16c28299, 0x12610007, 0x126315b2, + 0x61c40daa, 0xea49172c, 0x05d25942, 0x17441206, + 0x15c500a7, 0x00133620, 0x000f3fbd, 0x6b0effbe, + 0xef250dd5, 0x063f8625, 0x00020fa8, 0x007d3201, + 0xf6241201, 0x138400a4, 0x06401383, 0x172400ff, + 0x5e24e421, 0x128107a4, 0x172405d9, 0x1283e439, + 0x37ab05d9, 0x07be000f, 0x17846a64, 0x12c50811, + 0x172211c4, 0x16c28299, 0x12630007, 0xf62405f2, + 0x038300a4, 0x13841201, 0x172425a5, 0x57241719, + 0x12c2171d, 0x172211c4, 0x5142ea49, 0xfd191724, + 0x129512c5, 0x05f251e0, 0x16c21242, 0x17440003, + 0x0dd51714, 0x17155784, 0x000316c2, 0x05fa11ea, + 0x000f3fab, 0x00133620, 0x6a7207be, 0x0788007f, + 0x67240021, 0x62d2eab1, 0x160c629a, 0x1261ffff, + 0x126315b3, 0x12691592, 0x126b0df2, 0x126d0dd2, + 0x06020db2, 0x0d82ffef, 0xffed1602, 0x05c31261, + 0x12611259, 0x57844d9b, 0x5e240811, 0x100a8284, + 0x11cb12c5, 0x05b26261, 0x0dba6262, 0x51c452c2, + 0x8085572a, 0x05d9528e, 0x07635200, 0x05f50001, + 0xeb6d5724, 0x00015763, 0xeb715724, 0x5503f003, + 0x1b005640, 0x05075505, 0x56ca530d, 0x568a0003, + 0x538d0080, 0x57225b0e, 0x5ecb0001, 0x6eca00e0, + 0x590d001f, 0x52d45b8e, 0x538f5299, 0xffff560c, + 0x05e35261, 0x05c25269, 0xffef060a, 0x3f8205ea, + 0x3ec7000d, 0x05d5000f, 0xeab13f24, 0x3a9c3acc, + 0xffbe3003, 0x12050436, 0x00a71744, 0x003f0648, + 0x00a717a4, 0x0d811261, 0x12631582, 0x0dd205f1, + 0x05e21264, 0x07be05f5, 0x07be5eac, 0x07be5fc4, + 0x320b6022, 0x082407be, 0x17a4007f, 0x126900a7, + 0x00421dab, 0x000c000a, 0x000e001b, 0x001b0010, + 0x00140012, 0x0016001b, 0x603607be, 0x613a07be, + 0x61a607be, 0x61c607be, 0x623207be, 0x625207be, + 0x62d007be, 0x07be320c, 0x007f07e2, 0x00a717a4, + 0x05d11261, 0x12620db2, 0x05d505c2, 0x643807be, + 0x655407be, 0x07be320d, 0x007f07c2, 0x00a717a4, + 0x05d11261, 0x126205e2, 0x05f505e2, 0x654007be, + 0x65fe07be, 0x666607be, 0x07be320e, 0x0780079e, + 0x008610e1, 0xeac5e806, 0x077de9c4, 0x077d8289, + 0x077d828d, 0x077d8291, 0x077d8295, 0x077d8299, + 0x077d829d, 0xe00682a1, 0xd8070087, 0x6b06ffbe, + 0x8285171d, 0x301c381b, 0x129d12d9, 0x05ca1264, + 0x6c54ffbe, 0xffbe05b5, 0x06406c86, 0x078010ff, + 0xd80770e1, 0xd008009b, 0xc809009a, 0x009ce006, + 0xeac5e81c, 0x82841624, 0x301de9c2, 0x46203a00, + 0xffbe0020, 0x301c062a, 0x401a381b, 0xffbe4819, + 0x301c6cba, 0x0001171d, 0x401a381b, 0x12d94819, + 0x1264129d, 0xffbe158a, 0xf7dd6e9e, 0x48190006, + 0x381b401a, 0x05ca301c, 0x6f1affbe, 0xffbe05e5, + 0x05b56f4e, 0x6f54ffbe, 0x70ff0640, 0x10e10780, + 0xe8060086, 0xe9c4eac5, 0x0087e006, 0xffbed807, + 0x171d7016, 0xee3d8285, 0x301c8284, 0x12d9381b, + 0x1264129d, 0xffbe0dea, 0xf7dd7012, 0x381b0006, + 0x05ca301c, 0x7064ffbe, 0xffbe05e5, 0x05b570c6, + 0x70f8ffbe, 0x10ff0640, 0x00610780, 0xe8060086, + 0x1624eac4, 0xe9c205a4, 0x00051728, 0x008b5807, + 0x30025002, 0x529852d0, 0x00013e0a, 0x32900087, + 0x2da25a61, 0x1dc25a63, 0x35aa5a64, 0x129d12da, + 0x05e21261, 0x0d821263, 0x0da21265, 0x30080dd5, + 0x8512ffbe, 0x300825f5, 0x85f4ffbe, 0x300825b5, + 0x86d6ffbe, 0x30081df5, 0x879cffbe, 0x12da1db5, + 0x1261129d, 0x126505b2, 0xffbe05ca, 0x15a58858, + 0x8862ffbe, 0x12da0df5, 0x1261129d, 0x126505b2, + 0xffbe05ca, 0x05e58860, 0x8886ffbe, 0xffbe05b5, + 0x577d88ac, 0x06400001, 0x0780007f, 0x00860061, + 0xeac4e806, 0x05a41624, 0xefc7e9c2, 0x30070004, + 0xffbe05ca, 0x05b588c4, 0x8976ffbe, 0x0005577d, + 0x007f0640, 0xffe1078a, 0x00bc3620, 0x8cbcffbe, + 0xffbea00a, 0x57638cbe, 0xffbe0002, 0x57638cb6, + 0xffbe0004, 0x57638cb4, 0x36200006, 0xffbe00bc, + 0x57638cae, 0x36200008, 0xffbe00bc, 0x57638caa, + 0xffbe000a, 0x57638cdc, 0xffbe000c, 0x57638cd4, + 0xffbe000e, 0x57638cd2, 0x36200010, 0xffbe00bc, + 0x57638ccc, 0xaa000012, 0xb200ba00, 0xe815ca00, + 0x1624eac3, 0xe9c204a4, 0xd860f01d, 0xe063c067, + 0x0220dff4, 0xffbe3018, 0xf01d8c42, 0xe7ea1061, + 0x57e30220, 0x5fe30003, 0x17ea0005, 0x50650220, + 0x57ebe1db, 0x11dc0220, 0x5fe351c2, 0x10640007, + 0x022017eb, 0x11cad862, 0x000957e3, 0xdfeae066, + 0x30180220, 0xffbed9c2, 0xe7ea8c16, 0xf01d0220, + 0xd060e1db, 0x000b17e3, 0xd8633018, 0x0220d7e2, + 0x8c04ffbe, 0x1061f01d, 0x0220dfea, 0x000d57e3, + 0x000f5fe3, 0x022017ea, 0xd9da5065, 0x022057eb, + 0x51c211db, 0x00115fe3, 0x17eb1064, 0xd0620220, + 0x57e311ca, 0xd8660013, 0x0220d7ea, 0xd1c23018, + 0x8c0affbe, 0x0220dfea, 0xb9fcd9da, 0xb81c05a9, + 0x05a9b1fb, 0xee1db01b, 0xca410040, 0xca640099, + 0x10159dc1, 0x500212c2, 0xbf6a51c4, 0x11c403bd, + 0x03ddb762, 0x0095aa41, 0x85f1aa68, 0xffff064a, + 0x00210780, 0x00041706, 0x12da0087, 0x16c2129d, + 0x3a610003, 0x2dc255b1, 0x3dd13a63, 0x3a6415e2, + 0x12614dda, 0x0de205e1, 0x05e11263, 0x45e50d82, + 0xa402ffbe, 0xffbe45c5, 0x4595a464, 0xa546ffbe, + 0xffbe3de5, 0x3db5a602, 0x05e11261, 0x12630de2, + 0x0d8205e1, 0xffbe35b5, 0x3595a3b8, 0xa41affbe, + 0xffbe2de5, 0x2db5a4d2, 0xa58effbe, 0x12612d85, + 0x0de205e1, 0x05e11263, 0x25850d82, 0xa35cffbe, + 0xffbe1de5, 0x1db5a3d0, 0xa47cffbe, 0xffbe1d85, + 0x15d5a538, 0x05e11261, 0x12630de2, 0x0d8205e1, + 0xffbe0dd5, 0x0db5a31c, 0xa3a6ffbe, 0xffbe0d85, + 0x05d5a428, 0xa50effbe, 0x520105a5, 0x003f0640, + 0x00210780, 0x0fc11784, 0x05f211e0, 0x0fb8f624, + 0x03883069, 0xabf4ffbe, 0xfd111724, 0x05b11284, + 0xfd081fc4, 0x003f0640, 0xf0e10780, 0x8625ef25, + 0x3201d200, 0x15e4063f, 0x007d0002, 0x5c591724, + 0x1281c00a, 0x0000e7e9, 0x80001625, 0x00c0ce02, + 0x301c1db5, 0xffbe0086, 0xe80ac6b2, 0x15b2e9e0, + 0xff80301d, 0x373d00a0, 0xdf390001, 0x063f0001, + 0x0002161e, 0x5261007b, 0xcfdd05c2, 0x05b20003, + 0x0d95d201, 0x1724e241, 0x12815c59, 0x000017e9, + 0xe587e1e2, 0x8625ef25, 0x164a063f, 0x30180002, + 0x501a007d, 0xf0ff0640, 0x10e10780, 0x5c591724, + 0x1281ea02, 0xea0105a9, 0x80001625, 0x00c0de02, + 0x301d15e5, 0xffbe0086, 0xe00ac642, 0x0de2e1e0, + 0xff80301c, 0x373c0030, 0xe73b0001, 0x063f0001, + 0x0002168e, 0x5261007c, 0xea410db2, 0x5c591724, + 0x12815202, 0x520105a9, 0xe5c7e9ea, 0x06405200, + 0x1a5c10ff, 0x00011726, 0x0001062a, 0x17630012, + 0x12cb0001, 0x114a128b, 0x00125640, 0x0dea11ea, + 0x17461202, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x1a440000, 0xf624007f, + 0x03800d24, 0x00dc1620, 0x12021381, 0x03831382, + 0x0d290764, 0x12011388, 0x007f1389, 0x00e10780, + 0x09e1ef84, 0x09e1e7a4, 0x1267101d, 0x0042259b, + 0x000b0008, 0x0011000e, 0x00170014, 0x001d001a, + 0x006eff80, 0xff8015d5, 0x15a501c2, 0xd03cffbe, + 0xffbe0df5, 0x0dc5d088, 0xd0f8ffbe, 0xff800d95, + 0x05e501f8, 0xd1f6ffbe, 0xffbe05b5, 0x3f84d2f4, + 0x39fd09e1, 0x06220d92, 0xaaaa6600, 0x36203902, + 0xffbe0020, 0x3fa401d2, 0x39fc09e1, 0x06220d92, + 0xaaaa7700, 0x36203902, 0xffbe0040, 0x178401ba, + 0x11e009e1, 0xff8005b2, 0x0640066c, 0x078000ff, + 0x17a40021, 0x126109e1, 0x05f205d1, 0x0d821263, + 0xff800d95, 0x05e5002c, 0x0056ff80, 0xffbe05b5, + 0xffbecdd4, 0x5784d2a8, 0x17a409e1, 0x51e209e3, + 0xf62405d2, 0x13a409bc, 0x064003a5, 0x0780003f, + 0xffbe0061, 0x1724cc88, 0x12815c59, 0xef250df1, + 0x063f8625, 0x000217f4, 0x007d3201, 0x8625ef25, + 0x1802063f, 0x300a0002, 0x0640007d, 0x0788007f, + 0x17240061, 0x12815c59, 0x17246de1, 0x5640c0a1, + 0x114a8000, 0x17240d9a, 0x129cd621, 0x962405d1, + 0x1fd2d623, 0x17240000, 0x5640c0a1, 0x114a8000, + 0x12035da2, 0xc000f624, 0x15501531, 0x55b2114a, + 0x8625ef25, 0x1856063f, 0x32010002, 0x1724007d, + 0x128efb75, 0x178415c9, 0x06025c61, 0xfdc2ffdf, + 0x5c611784, 0xffde0602, 0x172405ea, 0x06c2fb9d, + 0xf5fa000c, 0xfb759624, 0x0000afd2, 0xc0648fc4, + 0xd6239624, 0x00009fd2, 0x0dd11784, 0x05fa1262, + 0x3a013200, 0x4a024200, 0x3224ffbe, 0x17441202, + 0x172409e1, 0x1282c061, 0x074405c9, 0x1db509e1, + 0xc000f624, 0x35583d5a, 0xffbd4210, 0x1624fdf4, + 0xf00308fc, 0x16201501, 0x150300c0, 0x20001620, + 0x17251505, 0x362481ad, 0x400a09bc, 0x1507480b, + 0xfad6ffbd, 0x007f0648, 0x00210780, 0x09e117a4, + 0x05e211e0, 0x05f21264, 0x0d821265, 0xffbe0d95, + 0x05e5ccac, 0xccf2ffbe, 0xffbe05b5, 0xffbecd76, + 0x5784d14c, 0x17a409e1, 0x51e209e3, 0x12640db2, + 0x9e2405da, 0x07d3c049, 0xf6240000, 0x13a409bc, + 0x064003a5, 0x0780003f, 0xffbe0061, 0x1784cf60, + 0x126609e1, 0xef250dda, 0x063f824d, 0x0002195a, + 0xef25007d, 0x063f8251, 0x00021966, 0x0640007d, + 0x0780007f, 0xffbe0021, 0x1784d2a0, 0x12610a15, + 0x05d20de1, 0x05e11263, 0x0d950d82, 0xd30cffbe, + 0xffbe05e5, 0x05b5d3da, 0xd4b4ffbe, 0x003f0640, + 0x00210780, 0x0a0d1724, 0x00ff062b, 0x5200ffff, + 0x1262114b, 0x96400da2, 0x11f20030, 0x96400d92, + 0x11f20031, 0x0d950d82, 0xd518ffbe, 0xffbe05e5, + 0x05b5d5f8, 0xd60effbe, 0x003f0640, 0x00210780, + 0x0a0d1724, 0x5ec25200, 0x060b00ff, 0x15eaff80, + 0x12611298, 0x05f215b1, 0x0d811263, 0x126f0da2, + 0x0dc50db2, 0xd63cffbe, 0xffbe0d95, 0x05e5d64c, + 0xd65cffbe, 0xffbe05b5, 0x0640d662, 0x17a4003f, + 0x12610a0f, 0x05f21581, 0x05f11263, 0x126f0d82, + 0x0d950d82, 0xd65a07be, 0xd68007be, 0xd6a607be, + 0xd6c007be, 0x0780007f, 0x17840021, 0x52000a0d, + 0xff800602, 0x05e20df9, 0xff7e0602, 0x0d8205e9, + 0xffbe0d95, 0x05e5d6f6, 0xd706ffbe, 0xffbe05b5, + 0x0640d720, 0x1784003f, 0x06020a0d, 0x05baff80, + 0xd74607be, 0xff7f0602, 0x07be05ba, 0x07bed768, + 0x0780d76e, 0x17240021, 0x062b0a0d, 0xffff00ff, + 0x114b5200, 0x0da21262, 0x00309640, 0x0d9211f2, + 0x00319640, 0x0d8211f2, 0xffbe0d95, 0x05e5d822, + 0xd8d4ffbe, 0xffbe05b5, 0x0640d8ec, 0x1784003f, + 0x520109e1, 0x05ba1266, 0xd91a07be, 0x1784007f, + 0x520109e1, 0x05ba1266, 0xd98007be, 0x0780007f, + 0xee240061, 0x301dc500, 0xd9d6ffbe, 0x0009361d, + 0xd9e8ffbe, 0x0012361d, 0xffbe3a00, 0x361dda00, + 0x3a000019, 0xda2cffbe, 0x001f361d, 0xffbe3a01, + 0x361dd9ec, 0x3a010026, 0xda18ffbe, 0x007f0640, + 0x00610780, 0xc500ee24, 0xffbe301d, 0x361dda12, + 0xffbe0005, 0x0640da1a, 0x0780007f, 0x170400e1, + 0x16c2097c, 0x12610007, 0x126305b2, 0xffbe05ba, + 0x1724db90, 0x1285c0a1, 0x063c2dd1, 0xaaaa8800, + 0x0b71efa4, 0x0b700744, 0x0d91ea61, 0xea630db2, + 0xea650dc2, 0xea660dd2, 0x0df50de2, 0xdce8ffbe, + 0xffbe0dc5, 0x0d95dd3a, 0xdddcffbe, 0xffbe05e5, + 0x05b5de32, 0x00a6ff80, 0x0b713fa4, 0x05e239fd, + 0x3620391c, 0xffbd0080, 0x1784fd8e, 0x11e00b71, + 0x0640dd8a, 0x078000ff, 0x170400e1, 0x16c2093c, + 0x12610007, 0x126305b2, 0xffbe05ba, 0xffbedbb8, + 0x51e0eba0, 0x17243592, 0x1285c0a1, 0x063c2dd1, + 0xaaaacc00, 0x0c57efa4, 0x0c560744, 0x0d91ea61, + 0xea630db2, 0xea650dc2, 0xea660dd2, 0x0df50de2, + 0xe2dcffbe, 0xffbe0dc5, 0x0d95e32e, 0xe3e8ffbe, + 0xffbe05e5, 0x05b5e47c, 0x00feff80, 0x0c573fa4, + 0x05e239fd, 0x3620391c, 0xffbd0400, 0x1784fd0a, + 0x11e00c57, 0x0640dd8a, 0x078000ff, 0xef840061, + 0x101d0b73, 0x359b126b, 0x000c0042, 0x0012000f, + 0x00180015, 0x001e001b, 0x00240021, 0x002a0027, + 0xffbe002d, 0x2595dd88, 0x005cff80, 0xffbe1de5, + 0x1db5de12, 0xde3effbe, 0xffbe1d85, 0x15d5de94, + 0xde9cffbe, 0xffbe15a5, 0x0df5dea4, 0xdf38ffbe, + 0xffbe0dc5, 0x0d95dfaa, 0xdfe0ffbe, 0xffbe05e5, + 0x05b5dff6, 0xe054ffbe, 0x0b733f84, 0x0d9239fd, + 0x99000622, 0x3902aaaa, 0x01003620, 0xfc78ffbd, + 0x007f0640, 0x00610780, 0x0b73efa4, 0x0d81ea61, + 0xea630da2, 0x0dd20db1, 0x0de2ea65, 0xffbe0df5, + 0x0dc5e036, 0xe05cffbe, 0xffbe0d95, 0x05e5e098, + 0xe0e8ffbe, 0xffbe05b5, 0x3fa4e198, 0x39fd0b73, + 0x06220d92, 0xaaaabb00, 0x36203902, 0xffbd0200, + 0x0640fc26, 0x0780007f, 0xef840061, 0x101d0c59, + 0x359b126b, 0x000c0042, 0x0012000f, 0x00180015, + 0x001e001b, 0x00240021, 0x002a0027, 0xffbe002d, + 0x2595e3c8, 0x005cff80, 0xffbe1de5, 0x1db5e41c, + 0xe47affbe, 0xffbe1d85, 0x15d5e4e0, 0xe508ffbe, + 0xffbe15a5, 0x0df5e530, 0xe544ffbe, 0xffbe0dc5, + 0x0d95e61e, 0xe680ffbe, 0xffbe05e5, 0x05b5e696, + 0xe728ffbe, 0x0c593f84, 0x0d9239fd, 0xdd000622, + 0x3902aaaa, 0x08003620, 0xfb9cffbd, 0x007f0640, + 0x00610780, 0x0c59efa4, 0x0d81ea61, 0xea630dd2, + 0x05f20de1, 0x0de2ea65, 0xffbe0df5, 0x0dc5e70a, + 0xe734ffbe, 0xffbe0d95, 0x05e5e840, 0xe890ffbe, + 0xffbe05b5, 0x3fa4e8c4, 0x39fd0c59, 0x06220d92, + 0xaaaaee00, 0x36203902, 0xffbd1000, 0x0640fb4a, + 0x0780007f, 0x17240061, 0x1286c061, 0x16200d99, + 0x17640020, 0x3202c061, 0xffbe3a00, 0xefa4ef1c, + 0x07440cd5, 0xea610cd9, 0x0db20d91, 0x15c1ea63, + 0xea650db2, 0x0de20dc1, 0xffbe0df5, 0x0dc5eb38, + 0xeb5effbe, 0xffbe0d95, 0x05e5ebe6, 0xec4affbe, + 0xffbe05b5, 0x3fa4ecc8, 0x39fd0cd5, 0x06220d92, + 0xaaaaff00, 0x36203902, 0xffbd2000, 0x17a4fada, + 0x11e00cd9, 0x0640d5da, 0x0000007f, 0x000200de, + 0x0000102c, 0x00001064, 0x0000109e, 0x0000111c, + 0x0000115a, 0x00020142, 0x00020154, 0x000011a6, + 0x000011ee, 0x000012a6, 0x00001250, 0x000012f4, + 0x00001376, 0x0000ccc8, 0x0000ccfc, 0x0000cd72, + 0x0000cda8, 0x0000ce0a, 0x0000cecc, 0x000215d0, + 0x0000cfc4, 0x0000d018, 0x0000d062, 0x00021650, + 0x0000d12e, 0x0000d1a8, 0x0000d204, 0x0000d274, + 0x0000d2d0, 0x0000d334, 0x0000d3fe, 0x0000d462, + 0x0000d4e8, 0x0000d54a, 0x0000d5d0, 0x0000d632, + 0x0000d67a, 0x0000d6e2, 0x0000d73a, 0x0000d7b4, + 0x0000d84c, 0x0000d8c4, 0x0000d916, 0x0000d968, + 0x0000d9e4, 0x0000da36, 0x0000dab2, 0x0000db04, + 0x0000db5a, 0x0000db84, 0x0000dba4, 0x0000dbd8, + 0x0000dc22, 0x0000dc50, 0x0000dc90, 0x0000dcc6, + 0x0000dd14, 0x0000dd62, 0x0000dd86, 0x0000dda2, + 0x0000ddba, 0x0000ddce, 0x0000dde2, 0x0000ddf8, + 0x0000de12, 0x0000de28, 0x0000de3e, 0x0000de84, + 0x0000defe, 0x0000dfb2, 0x0000dfe6, 0x0000e01a, + 0x0000e050, 0x0000e086, 0x0000e0bc, 0x0000e0f2, + 0x0000e150, 0x0000e19c, 0x0000e1d0, 0x0000e212, + 0x0000e304, 0x0000e27a, 0x0000e318, 0x0000e3a4, + 0x0000e42a, 0x0000c608, 0x0000c6d8, 0x0000c74e, + 0x0000c76a, 0x0000c786, 0x0000c7d6, 0x0000c866, + 0x0000c930, 0x0000c960, 0x0000c98e, 0x0000c9c8, + 0x0000c9de, 0x0000c9fc, 0x0000ca28, 0x0000ca6c, + 0x0000ca90, 0x0000caa2, 0x0000cae4, 0x0000cb88, + 0x0000cc30, 0x0000cc52, 0x0000e578, 0x0000ea76, + 0x0000eae6, 0x0000eb6a, 0x0002196a, 0x00021998, + 0x0000eff6, 0x0000f018, 0x000219d4, 0x00021a16, + 0x0000f11e, 0x0000f146, 0x00021a3e, 0x00021a6e, + 0x0000f23e, 0x0000f268, 0x0000f29e, 0x00021a8a, + 0x0000f3c8, 0x0000f3e8, 0x00021ac6, 0x00021ad6, + 0x0000f48a, 0x00021ae6, 0x00021b28, 0x0000f57e, + 0x0000f60c, 0x0000f660, 0x0000f68a, 0x0000f6a2, + 0x0000f6b2, 0x0000f6dc, 0x00021b42, 0x00021bbe, + 0x0000f940, 0x0000f9b6, 0x0000fe5e, 0x0000ffbc, + 0x00010084, 0x000105e0, 0x000106ee, 0x00010722, + 0x00010762, 0x0001078a, 0x000107f8, 0x0001085c, + 0x0001089e, 0x000109e8, 0x00010be0, 0x00010c84, + 0x00010cf4, 0x00010d82, 0x00010da0, 0x00010e0e, + 0x00010e60, 0x00010eb4, 0x00010f18, 0x00010f66, + 0x00010f6e, 0x00010f76, 0x00010fb6, 0x00010fd4, + 0x00001ed6, 0x00002164, 0x000022bc, 0x000023ec, + 0x00002328, 0x00002530, 0x00000000, 0x000025d4, + 0x0000274c, 0x000208ea, 0x000034b4, 0x000035ca, + 0x000036ae, 0x0000372e, 0x0000382e, 0x0000385e, + 0x00003910, 0x00003960, 0x0000398e, 0x000039fc, + 0x00003a68, 0x00003a98, 0x00003ace, 0x00003b0e, + 0x00003b2e, 0x00003b60, 0x00003b6a, 0x000208fe, + 0x00003bb4, 0x00003cba, 0x00003d48, 0x00003dd4, + 0x00003e80, 0x00003f26, 0x0002091a, 0x00004030, + 0x0000408a, 0x00004116, 0x00004144, 0x000041e4, + 0x00004328, 0x00004416, 0x0000450a, 0x00004572, + 0x000045a8, 0x000045fc, 0x00004650, 0x0000468c, + 0x000046de, 0x00004790, 0x0000488c, 0x00004a8c, + 0x000048ac, 0x00004ab0, 0x00000000, 0x00000000, + 0x00000000, 0x00004c18, 0x00004ae0, 0x000022f2, + 0x00004e64, 0x00006e08, 0x00006c0e, 0x00007a08, + 0x00007a48, 0x00007aba, 0x00007ada, 0x00007af8, + 0x00007b82, 0x00007bd2, 0x00007c40, 0x00007cae, + 0x000211b6, 0x00021206, 0x00021274, 0x00008484, + 0x0000851c, 0x0000857a, 0x000085ca, 0x0000865e, + 0x00008758, 0x000087ec, 0x000088a2, 0x00008948, + 0x00008a54, 0x00008ac8, 0x00008b58, 0x00008bdc, + 0x00008bf2, 0x00008c4c, 0x00008cb4, 0x00008d5e, + 0x00008de6, 0x00008e6c, 0x00008f34, 0x00008f5e, + 0x00008ff4, 0x00009046, 0x000090da, 0x0000911c, + 0x00009146, 0x0000918e, 0x000091ae, 0x000091fa, + 0x000092e4, 0x000093a0, 0x000093e2, 0x00009424, + 0x00009458, 0x00009488, 0x000094ca, 0x0000950c, + 0x00009540, 0x00009586, 0x000096ac, 0x000097f6, + 0x000212c0, 0x00009bb2, 0x00009bde, 0x00009c12, + 0x00021362, 0x00009daa, 0x00009e20, 0x00009e7a, + 0x00009eb4, 0x00009f1a, 0x00009f7e, 0x00009fd6, + 0x0000a00a, 0x0002138c, 0x0000a0cc, 0x0000a110, + 0x0000a156, 0x0000a192, 0x0000a1e2, 0x0000a28e, + 0x0000a3ec, 0x0000a4ac, 0x0000a4d6, 0x0000a52a, + 0x0000a62c, 0x0000a662, 0x0000a77c, 0x0000a7be, + 0x0000a7e4, 0x0000a820, 0x0000a87a, 0x0000a914, + 0x0000a972, 0x0000aa32, 0x0000aaa2, 0x0000abf8, + 0x0000ad28, 0x0000ad48, 0x0000adb0, 0x0000ae52, + 0x0000ae8c, 0x0000af88, 0x0000b002, 0x0000b0ae, + 0x0000b1aa, 0x0000b2f0, 0x0000b3b0, 0x0000b442, + 0x0000b470, 0x0000b51a, 0x0000b550, 0x0000b578, + 0x0000b59a, 0x0000b5cc, 0x0000b5f6, 0x0000b648, + 0x0000b78e, 0x0000b7e6, 0x0000b894, 0x000214e8, + 0x0000bb76, 0x0000bce2, 0x0000bd04, 0x0000bd94, + 0x0000be98, 0x0000bfb0, 0x0000bfb2, 0x0000bff2, + 0x0000c060, 0x0000c0d8, 0x0000c158, 0x0000c1c6, + 0x0000c30e, 0x000215a8, 0x0000c388, 0x0000c4d0, + 0x0000c50e, 0x0000c548, 0x0000c588, 0x0000c5c8, + 0x000013e4, 0x00001436, 0x0000147e, 0x000014a6, + 0x000014de, 0x000014f2, 0x00001546, 0x000015c4, + 0x000015ea, 0x0000164c, 0x00001660, 0x0000168e, + 0x000016ca, 0x000016f0, 0x0000171e, 0x0000175e, + 0x00001798, 0x000017be, 0x000017e4, 0x0000183a, + 0x0000186a, 0x000018cc, 0x0000193a, 0x0002017e, + 0x00001966, 0x0000198e, 0x0000a1ca, 0x0000c2b4, + 0x000201bc, 0x0000cc74, 0x00011014, 0x00011076, + 0x000032dc, 0x000079cf +}; + +#endif /* __FIRMWARE_R8A779X_USB3_V3__ */ diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c new file mode 100644 index 0000000000..d47c99644d --- /dev/null +++ b/drivers/usb/host/xhci-rcar.c @@ -0,0 +1,159 @@ +/* + * Copyright (C) 2017 Marek Vasut <marek.vasut@gmail.com> + * + * Renesas RCar USB HOST xHCI Controller + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <fdtdec.h> +#include <usb.h> +#include <wait_bit.h> + +#include "xhci.h" +#include "xhci-rcar-r8a779x_usb3_v3.h" + +/* Register Offset */ +#define RCAR_USB3_DL_CTRL 0x250 /* FW Download Control & Status */ +#define RCAR_USB3_FW_DATA0 0x258 /* FW Data0 */ + +/* Register Settings */ +/* FW Download Control & Status */ +#define RCAR_USB3_DL_CTRL_ENABLE BIT(0) +#define RCAR_USB3_DL_CTRL_FW_SUCCESS BIT(4) +#define RCAR_USB3_DL_CTRL_FW_SET_DATA0 BIT(8) + +struct rcar_xhci_platdata { + fdt_addr_t hcd_base; + struct clk clk; +}; + +/** + * Contains pointers to register base addresses + * for the usb controller. + */ +struct rcar_xhci { + struct xhci_ctrl ctrl; /* Needs to come first in this struct! */ + struct usb_platdata usb_plat; + struct xhci_hccr *hcd; +}; + +static int xhci_rcar_download_fw(struct rcar_xhci *ctx, const u32 *fw_data, + const size_t fw_array_size) +{ + void __iomem *regs = (void __iomem *)ctx->hcd; + int i, ret; + + /* Download R-Car USB3.0 firmware */ + setbits_le32(regs + RCAR_USB3_DL_CTRL, RCAR_USB3_DL_CTRL_ENABLE); + + for (i = 0; i < fw_array_size; i++) { + writel(fw_data[i], regs + RCAR_USB3_FW_DATA0); + setbits_le32(regs + RCAR_USB3_DL_CTRL, + RCAR_USB3_DL_CTRL_FW_SET_DATA0); + + ret = wait_for_bit("xhci-rcar", regs + RCAR_USB3_DL_CTRL, + RCAR_USB3_DL_CTRL_FW_SET_DATA0, false, + 10, false); + if (ret) + break; + } + + clrbits_le32(regs + RCAR_USB3_DL_CTRL, RCAR_USB3_DL_CTRL_ENABLE); + + ret = wait_for_bit("xhci-rcar", regs + RCAR_USB3_DL_CTRL, + RCAR_USB3_DL_CTRL_FW_SUCCESS, true, + 10, false); + + return ret; +} + +static int xhci_rcar_probe(struct udevice *dev) +{ + struct rcar_xhci_platdata *plat = dev_get_platdata(dev); + struct rcar_xhci *ctx = dev_get_priv(dev); + struct xhci_hcor *hcor; + int len, ret; + + ret = clk_get_by_index(dev, 0, &plat->clk); + if (ret < 0) { + dev_err(dev, "Failed to get USB3 clock\n"); + return ret; + } + + ret = clk_enable(&plat->clk); + if (ret) { + dev_err(dev, "Failed to enable USB3 clock\n"); + goto err_clk; + } + + ctx->hcd = (struct xhci_hccr *)plat->hcd_base; + len = HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase)); + hcor = (struct xhci_hcor *)((uintptr_t)ctx->hcd + len); + + ret = xhci_rcar_download_fw(ctx, firmware_r8a779x_usb3_v3, + ARRAY_SIZE(firmware_r8a779x_usb3_v3)); + if (ret) { + dev_err(dev, "Failed to download firmware\n"); + goto err_fw; + } + + ret = xhci_register(dev, ctx->hcd, hcor); + if (ret) { + dev_err(dev, "Failed to register xHCI\n"); + goto err_fw; + } + + return 0; + +err_fw: + clk_disable(&plat->clk); +err_clk: + clk_free(&plat->clk); + return ret; +} + +static int xhci_rcar_deregister(struct udevice *dev) +{ + struct rcar_xhci_platdata *plat = dev_get_platdata(dev); + + clk_disable(&plat->clk); + clk_free(&plat->clk); + + return xhci_deregister(dev); +} + +static int xhci_rcar_ofdata_to_platdata(struct udevice *dev) +{ + struct rcar_xhci_platdata *plat = dev_get_platdata(dev); + + plat->hcd_base = devfdt_get_addr(dev); + if (plat->hcd_base == FDT_ADDR_T_NONE) { + debug("Can't get the XHCI register base address\n"); + return -ENXIO; + } + + return 0; +} + +static const struct udevice_id xhci_rcar_ids[] = { + { .compatible = "renesas,xhci-r8a7795" }, + { .compatible = "renesas,xhci-r8a7796" }, + { } +}; + +U_BOOT_DRIVER(usb_xhci) = { + .name = "xhci_rcar", + .id = UCLASS_USB, + .probe = xhci_rcar_probe, + .remove = xhci_rcar_deregister, + .ops = &xhci_usb_ops, + .of_match = xhci_rcar_ids, + .ofdata_to_platdata = xhci_rcar_ofdata_to_platdata, + .platdata_auto_alloc_size = sizeof(struct rcar_xhci_platdata), + .priv_auto_alloc_size = sizeof(struct rcar_xhci), + .flags = DM_FLAG_ALLOC_PRIV_DMA, +}; |