Skip to content

Commit

Permalink
Merge branch 'master' of git://git.denx.de/u-boot-usb
Browse files Browse the repository at this point in the history
- DWC3 improvements
- i.MX7 EHCI bugfix
  • Loading branch information
trini committed Oct 25, 2019
2 parents c9e50bb + 235f5e1 commit 271103a
Show file tree
Hide file tree
Showing 49 changed files with 384 additions and 274 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ M: Bin Meng <[email protected]>
S: Maintained
T: git https://gitlab.denx.de/u-boot/custodians/u-boot-usb.git topic-xhci
F: drivers/usb/host/xhci*
F: include/usb/xhci.h

VIDEO
M: Anatolij Gustschin <[email protected]>
Expand Down
32 changes: 32 additions & 0 deletions arch/arm/dts/keystone-k2e-evm-u-boot.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,40 @@
soc {
u-boot,dm-pre-reloc;
};
aliases {
usb0 = &usb;
usb1 = &usb1;
};
};

&i2c1 {
u-boot,dm-pre-reloc;
};

&usb_phy {
#phy-cells = <0>;
psc-domain = <2>;
};

&usb {
dwc3@2690000 {
phys = <&usb_phy>;
dr_mode = "host";
snps,u2ss_inp3_quirk;
status = "okay";
};
};

&usb1_phy {
#phy-cells = <0>;
psc-domain = <1>;
};

&usb1 {
dwc3@25010000 {
phys = <&usb1_phy>;
dr_mode = "peripheral";
snps,u2ss_inp3_quirk;
status = "okay";
};
};
28 changes: 28 additions & 0 deletions arch/arm/dts/keystone-k2g-evm-u-boot.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
soc {
u-boot,dm-pre-reloc;
};
aliases {
usb0 = &usb0;
usb1 = &usb1;
};
};

&i2c0 {
Expand All @@ -16,3 +20,27 @@
&i2c1 {
u-boot,dm-pre-reloc;
};

&usb0_phy {
compatible = "ti,keystone-usbphy";
#phy-cells = <0>;
reg = <0x2620738 24>;
psc-domain = <25>;
};

&usb0 {
phys = <&usb0_phy>;
snps,u2ss_inp3_quirk;
};

&usb1_phy {
compatible = "ti,keystone-usbphy";
#phy-cells = <0>;
reg = <0x2620750 24>;
psc-domain = <26>;
};

&usb1 {
phys = <&usb1_phy>;
snps,u2ss_inp3_quirk;
};
14 changes: 14 additions & 0 deletions arch/arm/dts/keystone-k2hk-evm-u-boot.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,17 @@
&i2c1 {
u-boot,dm-pre-reloc;
};

&usb_phy {
#phy-cells = <0>;
psc-domain = <2>;
};

&usb {
dwc3@2690000 {
phys = <&usb_phy>;
dr_mode = "host";
snps,u2ss_inp3_quirk;
status = "okay";
};
};
18 changes: 18 additions & 0 deletions arch/arm/dts/keystone-k2l-evm-u-boot.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
*/

&usb_phy {
#phy-cells = <0>;
psc-domain = <2>;
};

&usb {
dwc3@2690000 {
phys = <&usb_phy>;
dr_mode = "host";
snps,u2ss_inp3_quirk;
status = "okay";
};
};
2 changes: 1 addition & 1 deletion arch/arm/mach-keystone/include/mach/psc_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static inline u32 boot_set_bitfield(u32 z, u32 f, u32 x, u32 y)
* Timeout limit on checking PTSTAT. This is the number of times the
* wait function will be called before giving up.
*/
#define PSC_PTSTAT_TIMEOUT_LIMIT 100
#define PSC_PTSTAT_TIMEOUT_LIMIT 100000

u32 psc_get_domain_num(u32 mod_num);
int psc_enable_module(u32 mod_num);
Expand Down
13 changes: 0 additions & 13 deletions board/ti/ks2_evm/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,7 @@ struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)

int board_init(void)
{
#if CONFIG_IS_ENABLED(DM_USB)
int rc = psc_enable_module(KS2_LPSC_USB);

if (rc)
puts("Cannot enable USB0 module");
#ifdef KS2_LPSC_USB_1
rc = psc_enable_module(KS2_LPSC_USB_1);
if (rc)
puts("Cannot enable USB1 module");
#endif
#endif

gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;

return 0;
}

Expand Down
1 change: 0 additions & 1 deletion configs/avnet_ultra96_rev1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ CONFIG_ZYNQ_SPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
1 change: 1 addition & 0 deletions configs/evb-rk3328_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_GENERIC=y
CONFIG_USB_DWC2=y
CONFIG_USB_DWC3=y
# CONFIG_USB_DWC3_GADGET is not set
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_MANUFACTURER="Rockchip"
CONFIG_USB_GADGET_VENDOR_NUM=0x2207
Expand Down
3 changes: 1 addition & 2 deletions configs/k2g_evm_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ CONFIG_MII=y
CONFIG_DRIVER_TI_KEYSTONE_NET=y
CONFIG_PHY=y
CONFIG_NOP_PHY=y
CONFIG_KEYSTONE_USB_PHY=y
CONFIG_REMOTEPROC_TI_POWER=y
CONFIG_DM_SERIAL=y
CONFIG_SYS_NS16550=y
Expand All @@ -73,9 +74,7 @@ CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_DM_USB_GADGET=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DOWNLOAD=y
Expand Down
1 change: 1 addition & 0 deletions configs/khadas-vim3_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ CONFIG_DM_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_DWC3=y
# CONFIG_USB_DWC3_GADGET is not set
CONFIG_USB_DWC3_MESON_G12A=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
Expand Down
1 change: 1 addition & 0 deletions configs/odroid-n2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ CONFIG_DM_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_DWC3=y
# CONFIG_USB_DWC3_GADGET is not set
CONFIG_USB_DWC3_MESON_G12A=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
Expand Down
1 change: 1 addition & 0 deletions configs/rock64-rk3328_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_GENERIC=y
CONFIG_USB_DWC2=y
CONFIG_USB_DWC3=y
# CONFIG_USB_DWC3_GADGET is not set
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_MANUFACTURER="Rockchip"
CONFIG_USB_GADGET_VENDOR_NUM=0x2207
Expand Down
1 change: 1 addition & 0 deletions configs/sei510_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ CONFIG_DM_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_DWC3=y
# CONFIG_USB_DWC3_GADGET is not set
CONFIG_USB_DWC3_MESON_G12A=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VENDOR_NUM=0x18d1
Expand Down
1 change: 1 addition & 0 deletions configs/sei610_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ CONFIG_DM_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_DWC3=y
# CONFIG_USB_DWC3_GADGET is not set
CONFIG_USB_DWC3_MESON_G12A=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VENDOR_NUM=0x18d1
Expand Down
1 change: 1 addition & 0 deletions configs/u200_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ CONFIG_DM_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_DWC3=y
# CONFIG_USB_DWC3_GADGET is not set
CONFIG_USB_DWC3_MESON_G12A=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
Expand Down
1 change: 0 additions & 1 deletion configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ CONFIG_ZYNQMP_GQSPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
1 change: 0 additions & 1 deletion configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ CONFIG_SPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
1 change: 0 additions & 1 deletion configs/xilinx_zynqmp_zc1751_xm017_dc3_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ CONFIG_SPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
1 change: 0 additions & 1 deletion configs/xilinx_zynqmp_zcu100_revC_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ CONFIG_ZYNQ_SPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
1 change: 0 additions & 1 deletion configs/xilinx_zynqmp_zcu102_rev1_0_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ CONFIG_ZYNQMP_GQSPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
1 change: 0 additions & 1 deletion configs/xilinx_zynqmp_zcu102_revA_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ CONFIG_ZYNQMP_GQSPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
1 change: 0 additions & 1 deletion configs/xilinx_zynqmp_zcu102_revB_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ CONFIG_ZYNQMP_GQSPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
1 change: 0 additions & 1 deletion configs/xilinx_zynqmp_zcu104_revA_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ CONFIG_ZYNQMP_GQSPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
1 change: 0 additions & 1 deletion configs/xilinx_zynqmp_zcu104_revC_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ CONFIG_ZYNQMP_GQSPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
1 change: 0 additions & 1 deletion configs/xilinx_zynqmp_zcu106_revA_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ CONFIG_ZYNQMP_GQSPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
1 change: 0 additions & 1 deletion configs/xilinx_zynqmp_zcu111_revA_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ CONFIG_ZYNQMP_GQSPI=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_XHCI_ZYNQMP=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GADGET=y
CONFIG_USB_DWC3_GENERIC=y
Expand Down
22 changes: 22 additions & 0 deletions drivers/phy/keystone-usb-phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <dm/device.h>
#include <generic-phy.h>
#include <asm/io.h>
#include <asm/arch/psc_defs.h>

/* USB PHY control register offsets */
#define USB_PHY_CTL_UTMI 0x0000
Expand All @@ -22,15 +23,25 @@
#define PHY_REF_SSP_EN BIT(29)

struct keystone_usb_phy {
u32 psc_domain;
void __iomem *reg;
};

static int keystone_usb_init(struct phy *phy)
{
u32 val;
int rc;
struct udevice *dev = phy->dev;
struct keystone_usb_phy *keystone = dev_get_priv(dev);

/* Release USB from reset */
rc = psc_enable_module(keystone->psc_domain);
if (rc) {
debug("Cannot enable USB module");
return -rc;
}
mdelay(10);

/*
* VBUSVLDEXTSEL has a default value of 1 in BootCfg but shouldn't.
* It should always be cleared because our USB PHY has an onchip VBUS
Expand Down Expand Up @@ -72,13 +83,24 @@ static int keystone_usb_power_off(struct phy *phy)

static int keystone_usb_exit(struct phy *phy)
{
struct udevice *dev = phy->dev;
struct keystone_usb_phy *keystone = dev_get_priv(dev);

if (psc_disable_module(keystone->psc_domain))
debug("failed to disable USB module!\n");

return 0;
}

static int keystone_usb_phy_probe(struct udevice *dev)
{
int rc;
struct keystone_usb_phy *keystone = dev_get_priv(dev);

rc = dev_read_u32(dev, "psc-domain", &keystone->psc_domain);
if (rc)
return rc;

keystone->reg = dev_remap_addr_index(dev, 0);
if (!keystone->reg) {
pr_err("unable to remap usb phy\n");
Expand Down
Loading

0 comments on commit 271103a

Please sign in to comment.