usb/dwc3: Read the full IDs/version
We need to enable some quirks based on the version so read it. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D37393 Sponsored by: Beckhoff Automation GmbH & Co. KG
This commit is contained in:
parent
dbd7bb7c89
commit
0e87f58bd7
@ -86,6 +86,9 @@ struct snps_dwc3_softc {
|
|||||||
bus_space_tag_t bst;
|
bus_space_tag_t bst;
|
||||||
bus_space_handle_t bsh;
|
bus_space_handle_t bsh;
|
||||||
uint32_t snpsid;
|
uint32_t snpsid;
|
||||||
|
uint32_t snpsversion;
|
||||||
|
uint32_t snpsrevision;
|
||||||
|
uint32_t snpsversion_type;
|
||||||
#ifdef FDT
|
#ifdef FDT
|
||||||
clk_t clk_ref;
|
clk_t clk_ref;
|
||||||
clk_t clk_suspend;
|
clk_t clk_suspend;
|
||||||
@ -389,8 +392,31 @@ snps_dwc3_common_attach(device_t dev, bool is_fdt)
|
|||||||
sc->bsh = rman_get_bushandle(sc->mem_res);
|
sc->bsh = rman_get_bushandle(sc->mem_res);
|
||||||
|
|
||||||
sc->snpsid = DWC3_READ(sc, DWC3_GSNPSID);
|
sc->snpsid = DWC3_READ(sc, DWC3_GSNPSID);
|
||||||
if (bootverbose)
|
sc->snpsversion = DWC3_VERSION(sc->snpsid);
|
||||||
device_printf(sc->dev, "snps id: %#012x\n", sc->snpsid);
|
sc->snpsrevision = DWC3_REVISION(sc->snpsid);
|
||||||
|
if (sc->snpsversion == DWC3_1_IP_ID ||
|
||||||
|
sc->snpsversion == DWC3_2_IP_ID) {
|
||||||
|
sc->snpsrevision = DWC3_READ(sc, DWC3_1_VER_NUMBER);
|
||||||
|
sc->snpsversion_type = DWC3_READ(sc, DWC3_1_VER_TYPE);
|
||||||
|
}
|
||||||
|
if (bootverbose) {
|
||||||
|
switch (sc->snpsversion) {
|
||||||
|
case DWC3_IP_ID:
|
||||||
|
device_printf(sc->dev, "SNPS Version: DWC3 (%x %x)\n",
|
||||||
|
sc->snpsversion, sc->snpsrevision);
|
||||||
|
break;
|
||||||
|
case DWC3_1_IP_ID:
|
||||||
|
device_printf(sc->dev, "SNPS Version: DWC3.1 (%x %x %x)\n",
|
||||||
|
sc->snpsversion, sc->snpsrevision,
|
||||||
|
sc->snpsversion_type);
|
||||||
|
break;
|
||||||
|
case DWC3_2_IP_ID:
|
||||||
|
device_printf(sc->dev, "SNPS Version: DWC3.2 (%x %x %x)\n",
|
||||||
|
sc->snpsversion, sc->snpsrevision,
|
||||||
|
sc->snpsversion_type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
#ifdef DWC3_DEBUG
|
#ifdef DWC3_DEBUG
|
||||||
snps_dwc3_dump_ctrlparams(sc);
|
snps_dwc3_dump_ctrlparams(sc);
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,6 +31,15 @@
|
|||||||
#ifndef _DWC3_H_
|
#ifndef _DWC3_H_
|
||||||
#define _DWC3_H_
|
#define _DWC3_H_
|
||||||
|
|
||||||
|
#define DWC3_IP_ID 0x5533
|
||||||
|
#define DWC3_1_IP_ID 0x3331
|
||||||
|
#define DWC3_2_IP_ID 0x3332
|
||||||
|
|
||||||
|
#define DWC3_VERSION_MASK 0xFFFF0000
|
||||||
|
#define DWC3_REVISION_MASK 0xFFFF
|
||||||
|
#define DWC3_VERSION(x) (((x) & DWC3_VERSION_MASK) >> 16)
|
||||||
|
#define DWC3_REVISION(x) ((x) & DWC3_REVISION_MASK)
|
||||||
|
|
||||||
#define DWC3_GSBUSCFG0 0xc100
|
#define DWC3_GSBUSCFG0 0xc100
|
||||||
#define DWC3_GSBUSCFG1 0xc104
|
#define DWC3_GSBUSCFG1 0xc104
|
||||||
#define DWC3_GTXTHRCFG 0xc108
|
#define DWC3_GTXTHRCFG 0xc108
|
||||||
@ -80,6 +89,9 @@
|
|||||||
#define DWC3_GPRTBIMAP_HSLO 0xc180
|
#define DWC3_GPRTBIMAP_HSLO 0xc180
|
||||||
#define DWC3_GPRTBIMAP_FSLO 0xc188
|
#define DWC3_GPRTBIMAP_FSLO 0xc188
|
||||||
|
|
||||||
|
#define DWC3_1_VER_NUMBER 0xc1a0
|
||||||
|
#define DWC3_1_VER_TYPE 0xc1a4
|
||||||
|
|
||||||
#define DWC3_GUSB2PHYCFG0 0xc200
|
#define DWC3_GUSB2PHYCFG0 0xc200
|
||||||
#define DWC3_GUSB2PHYCFG0_PHYSOFTRST (1 << 31)
|
#define DWC3_GUSB2PHYCFG0_PHYSOFTRST (1 << 31)
|
||||||
#define DWC3_GUSB2PHYCFG0_U2_FREECLK_EXISTS (1 << 30)
|
#define DWC3_GUSB2PHYCFG0_U2_FREECLK_EXISTS (1 << 30)
|
||||||
|
Loading…
Reference in New Issue
Block a user