aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini2019-11-23 20:50:11 -0500
committerTom Rini2019-11-23 20:50:11 -0500
commit9a0cbae22a613dfd55e15565785749b74c19fdf0 (patch)
treee66f4ce35ba9d7ce812b95b8b441fc0bec917a4f /drivers
parentc8f2fe4e670c91172540ab36700d7a8411fc6f76 (diff)
parent8019d32c4701b95410113541deb7f28d5c2b02a5 (diff)
Merge tag 'u-boot-rockchip-20191124' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip
- Clean vid/pid in Kconfig and add fastboot for rk3399 - add 'u-boot, spl-fifo-mode' for mmc - Use FIT generator for rk3229 optee and rk3368 ATF - fan53555: add support for Silergy SYR82X and SYR83X
Diffstat (limited to 'drivers')
-rw-r--r--drivers/fastboot/Kconfig3
-rw-r--r--drivers/i2c/rk_i2c.c5
-rw-r--r--drivers/mmc/rockchip_dw_mmc.c5
-rw-r--r--drivers/power/pmic/fan53555.c7
-rw-r--r--drivers/power/regulator/fan53555.c47
-rw-r--r--drivers/usb/dwc3/core.c27
-rw-r--r--drivers/usb/dwc3/core.h12
-rw-r--r--drivers/usb/gadget/Kconfig7
8 files changed, 95 insertions, 18 deletions
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index d63ecdd27e4..433ea0dc3bf 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -64,7 +64,7 @@ config FASTBOOT_USB_DEV
config FASTBOOT_FLASH
bool "Enable FASTBOOT FLASH command"
- default y if ARCH_SUNXI
+ default y if ARCH_SUNXI || ARCH_ROCKCHIP
depends on MMC || (NAND && CMD_MTDPARTS)
select IMAGE_SPARSE
help
@@ -89,6 +89,7 @@ endchoice
config FASTBOOT_FLASH_MMC_DEV
int "Define FASTBOOT MMC FLASH default device"
depends on FASTBOOT_FLASH_MMC
+ default 0 if ARCH_ROCKCHIP
default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1
default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1
help
diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c
index cdd94bb05a9..32b2ee85787 100644
--- a/drivers/i2c/rk_i2c.c
+++ b/drivers/i2c/rk_i2c.c
@@ -253,7 +253,6 @@ static int rk_i2c_read(struct rk_i2c *i2c, uchar chip, uint reg, uint r_len,
}
i2c_exit:
- rk_i2c_send_stop_bit(i2c);
rk_i2c_disable(i2c);
return err;
@@ -332,7 +331,6 @@ static int rk_i2c_write(struct rk_i2c *i2c, uchar chip, uint reg, uint r_len,
}
i2c_exit:
- rk_i2c_send_stop_bit(i2c);
rk_i2c_disable(i2c);
return err;
@@ -360,6 +358,9 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg,
}
}
+ rk_i2c_send_stop_bit(i2c);
+ rk_i2c_disable(i2c);
+
return 0;
}
diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
index b2a1201631a..a0e1be8794d 100644
--- a/drivers/mmc/rockchip_dw_mmc.c
+++ b/drivers/mmc/rockchip_dw_mmc.c
@@ -72,6 +72,11 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)
return -EINVAL;
priv->fifo_mode = dev_read_bool(dev, "fifo-mode");
+#ifdef CONFIG_SPL_BUILD
+ if (!priv->fifo_mode)
+ priv->fifo_mode = dev_read_bool(dev, "u-boot,spl-fifo-mode");
+#endif
+
/*
* 'clock-freq-min-max' is deprecated
* (see https://github.com/torvalds/linux/commit/b023030f10573de738bbe8df63d43acab64c9f7b)
diff --git a/drivers/power/pmic/fan53555.c b/drivers/power/pmic/fan53555.c
index 1ca59c5f0c5..11304d2146a 100644
--- a/drivers/power/pmic/fan53555.c
+++ b/drivers/power/pmic/fan53555.c
@@ -8,6 +8,7 @@
#include <dm/device-internal.h>
#include <dm/lists.h>
#include <i2c.h>
+#include <power/fan53555.h>
#include <power/pmic.h>
#include <power/regulator.h>
@@ -58,7 +59,7 @@ static int pmic_fan53555_bind(struct udevice *dev)
return -ENOENT;
}
- return device_bind_with_driver_data(dev, drv, "SW", 0,
+ return device_bind_with_driver_data(dev, drv, "SW", dev->driver_data,
dev_ofnode(dev), &child);
};
@@ -69,7 +70,9 @@ static struct dm_pmic_ops pmic_fan53555_ops = {
};
static const struct udevice_id pmic_fan53555_match[] = {
- { .compatible = "fcs,fan53555" },
+ { .compatible = "fcs,fan53555", .data = FAN53555_VENDOR_FAIRCHILD, },
+ { .compatible = "silergy,syr827", .data = FAN53555_VENDOR_SILERGY, },
+ { .compatible = "silergy,syr828", .data = FAN53555_VENDOR_SILERGY, },
{ },
};
diff --git a/drivers/power/regulator/fan53555.c b/drivers/power/regulator/fan53555.c
index dbd55023779..24a9b67586b 100644
--- a/drivers/power/regulator/fan53555.c
+++ b/drivers/power/regulator/fan53555.c
@@ -10,6 +10,7 @@
#include <fdtdec.h>
#include <i2c.h>
#include <asm/gpio.h>
+#include <power/fan53555.h>
#include <power/pmic.h>
#include <power/regulator.h>
@@ -27,21 +28,37 @@
* See http://www.onsemi.com/pub/Collateral/FAN53555-D.pdf for details.
*/
static const struct {
+ unsigned int vendor;
u8 die_id;
u8 die_rev;
+ bool check_rev;
u32 vsel_min;
u32 vsel_step;
} ic_types[] = {
- { 0x0, 0x3, 600000, 10000 }, /* Option 00 */
- { 0x0, 0xf, 800000, 10000 }, /* Option 13 */
- { 0x0, 0xc, 600000, 12500 }, /* Option 23 */
- { 0x1, 0x3, 600000, 10000 }, /* Option 01 */
- { 0x3, 0x3, 600000, 10000 }, /* Option 03 */
- { 0x4, 0xf, 603000, 12826 }, /* Option 04 */
- { 0x5, 0x3, 600000, 10000 }, /* Option 05 */
- { 0x8, 0x1, 600000, 10000 }, /* Option 08 */
- { 0x8, 0xf, 600000, 10000 }, /* Option 08 */
- { 0xc, 0xf, 603000, 12826 }, /* Option 09 */
+ /* Option 00 */
+ { FAN53555_VENDOR_FAIRCHILD, 0x0, 0x3, true, 600000, 10000 },
+ /* Option 13 */
+ { FAN53555_VENDOR_FAIRCHILD, 0x0, 0xf, true, 800000, 10000 },
+ /* Option 23 */
+ { FAN53555_VENDOR_FAIRCHILD, 0x0, 0xc, true, 600000, 12500 },
+ /* Option 01 */
+ { FAN53555_VENDOR_FAIRCHILD, 0x1, 0x3, true, 600000, 10000 },
+ /* Option 03 */
+ { FAN53555_VENDOR_FAIRCHILD, 0x3, 0x3, true, 600000, 10000 },
+ /* Option 04 */
+ { FAN53555_VENDOR_FAIRCHILD, 0x4, 0xf, true, 603000, 12826 },
+ /* Option 05 */
+ { FAN53555_VENDOR_FAIRCHILD, 0x5, 0x3, true, 600000, 10000 },
+ /* Option 08 */
+ { FAN53555_VENDOR_FAIRCHILD, 0x8, 0x1, true, 600000, 10000 },
+ /* Option 08 */
+ { FAN53555_VENDOR_FAIRCHILD, 0x8, 0xf, true, 600000, 10000 },
+ /* Option 09 */
+ { FAN53555_VENDOR_FAIRCHILD, 0xc, 0xf, true, 603000, 12826 },
+ /* SYL82X */
+ { FAN53555_VENDOR_SILERGY, 0x8, 0x0, false, 712500, 12500 },
+ /* SYL83X */
+ { FAN53555_VENDOR_SILERGY, 0x9, 0x0, false, 712500, 12500 },
};
/* I2C-accessible byte-sized registers */
@@ -142,7 +159,7 @@ static int fan53555_regulator_set_value(struct udevice *dev, int uV)
debug("%s: uV=%d; writing volume %d: %02x\n",
__func__, uV, pdata->vol_reg, vol);
- return pmic_clrsetbits(dev, pdata->vol_reg, GENMASK(6, 0), vol);
+ return pmic_clrsetbits(dev->parent, pdata->vol_reg, GENMASK(6, 0), vol);
}
static int fan53555_voltages_setup(struct udevice *dev)
@@ -152,10 +169,14 @@ static int fan53555_voltages_setup(struct udevice *dev)
/* Init voltage range and step */
for (i = 0; i < ARRAY_SIZE(ic_types); ++i) {
+ if (ic_types[i].vendor != priv->vendor)
+ continue;
+
if (ic_types[i].die_id != priv->die_id)
continue;
- if (ic_types[i].die_rev != priv->die_rev)
+ if (ic_types[i].check_rev &&
+ ic_types[i].die_rev != priv->die_rev)
continue;
priv->vsel_min = ic_types[i].vsel_min;
@@ -193,7 +214,7 @@ static int fan53555_probe(struct udevice *dev)
return ID2;
/* extract vendor, die_id and die_rev */
- priv->vendor = bitfield_extract(ID1, 5, 3);
+ priv->vendor = dev->driver_data;
priv->die_id = ID1 & GENMASK(3, 0);
priv->die_rev = ID2 & GENMASK(3, 0);
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 23af60c98d3..f779562de2e 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -613,6 +613,31 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
dwc3_gadget_run(dwc);
}
+static void dwc3_uboot_hsphy_mode(struct dwc3_device *dwc3_dev,
+ struct dwc3 *dwc)
+{
+ enum usb_phy_interface hsphy_mode = dwc3_dev->hsphy_mode;
+ u32 reg;
+
+ /* Set dwc3 usb2 phy config */
+ reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
+ reg |= DWC3_GUSB2PHYCFG_PHYIF;
+ reg &= ~DWC3_GUSB2PHYCFG_USBTRDTIM_MASK;
+
+ switch (hsphy_mode) {
+ case USBPHY_INTERFACE_MODE_UTMI:
+ reg |= DWC3_GUSB2PHYCFG_USBTRDTIM_8BIT;
+ break;
+ case USBPHY_INTERFACE_MODE_UTMIW:
+ reg |= DWC3_GUSB2PHYCFG_USBTRDTIM_16BIT;
+ break;
+ default:
+ break;
+ }
+
+ dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
+}
+
#define DWC3_ALIGN_MASK (16 - 1)
/**
@@ -721,6 +746,8 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev)
goto err0;
}
+ dwc3_uboot_hsphy_mode(dwc3_dev, dwc);
+
ret = dwc3_event_buffers_setup(dwc);
if (ret) {
dev_err(dwc->dev, "failed to setup event buffers\n");
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index be9672266a7..bff53e072b9 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -162,6 +162,18 @@
/* Global USB2 PHY Configuration Register */
#define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31)
#define DWC3_GUSB2PHYCFG_SUSPHY (1 << 6)
+#define DWC3_GUSB2PHYCFG_PHYIF BIT(3)
+
+/* Global USB2 PHY Configuration Mask */
+#define DWC3_GUSB2PHYCFG_USBTRDTIM_MASK (0xf << 10)
+
+/* Global USB2 PHY Configuration Offset */
+#define DWC3_GUSB2PHYCFG_USBTRDTIM_OFFSET 10
+
+#define DWC3_GUSB2PHYCFG_USBTRDTIM_16BIT (0x5 << \
+ DWC3_GUSB2PHYCFG_USBTRDTIM_OFFSET)
+#define DWC3_GUSB2PHYCFG_USBTRDTIM_8BIT (0x9 << \
+ DWC3_GUSB2PHYCFG_USBTRDTIM_OFFSET)
/* Global USB3 PIPE Control Register */
#define DWC3_GUSB3PIPECTL_PHYSOFTRST (1 << 31)
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 26b4d12a09f..58ca82d4de6 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -39,6 +39,7 @@ if USB_GADGET
config USB_GADGET_MANUFACTURER
string "Vendor name of the USB device"
default "Allwinner Technology" if ARCH_SUNXI
+ default "Rockchip" if ARCH_ROCKCHIP
default "U-Boot"
help
Vendor name of the USB device emulated, reported to the host device.
@@ -47,6 +48,7 @@ config USB_GADGET_MANUFACTURER
config USB_GADGET_VENDOR_NUM
hex "Vendor ID of the USB device"
default 0x1f3a if ARCH_SUNXI
+ default 0x2207 if ARCH_ROCKCHIP
default 0x0
help
Vendor ID of the USB device emulated, reported to the host device.
@@ -56,6 +58,11 @@ config USB_GADGET_VENDOR_NUM
config USB_GADGET_PRODUCT_NUM
hex "Product ID of the USB device"
default 0x1010 if ARCH_SUNXI
+ default 0x310a if ROCKCHIP_RK3036
+ default 0x310c if ROCKCHIP_RK3128
+ default 0x320a if ROCKCHIP_RK3229 || ROCKCHIP_RK3288
+ default 0x330a if ROCKCHIP_RK3328
+ default 0x330c if ROCKCHIP_RK3399
default 0x0
help
Product ID of the USB device emulated, reported to the host device.