Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107230945
D33170.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D33170.diff
View Options
diff --git a/sys/dev/usb/controller/dwc3.c b/sys/dev/usb/controller/dwc3.c
--- a/sys/dev/usb/controller/dwc3.c
+++ b/sys/dev/usb/controller/dwc3.c
@@ -73,7 +73,6 @@
struct snps_dwc3_softc {
struct xhci_softc sc;
device_t dev;
- char dr_mode[16];
struct resource * mem_res;
bus_space_tag_t bst;
bus_space_handle_t bsh;
@@ -244,39 +243,38 @@
uint32_t reg;
reg = DWC3_READ(sc, DWC3_GUSB2PHYCFG0);
- if (OF_hasprop(sc->node, "snps,dis-u2-freeclk-exists-quirk"))
+ if (device_has_property(sc->dev, "snps,dis-u2-freeclk-exists-quirk"))
reg &= ~DWC3_GUSB2PHYCFG0_U2_FREECLK_EXISTS;
else
reg |= DWC3_GUSB2PHYCFG0_U2_FREECLK_EXISTS;
- if (OF_hasprop(sc->node, "snps,dis_u2_susphy_quirk"))
+ if (device_has_property(sc->dev, "snps,dis_u2_susphy_quirk"))
reg &= ~DWC3_GUSB2PHYCFG0_SUSPENDUSB20;
else
reg |= DWC3_GUSB2PHYCFG0_SUSPENDUSB20;
- if (OF_hasprop(sc->node, "snps,dis_enblslpm_quirk"))
+ if (device_has_property(sc->dev, "snps,dis_enblslpm_quirk"))
reg &= ~DWC3_GUSB2PHYCFG0_ENBLSLPM;
else
reg |= DWC3_GUSB2PHYCFG0_ENBLSLPM;
-
DWC3_WRITE(sc, DWC3_GUSB2PHYCFG0, reg);
reg = DWC3_READ(sc, DWC3_GUCTL1);
- if (OF_hasprop(sc->node, "snps,dis-tx-ipgap-linecheck-quirk"))
+ if (device_has_property(sc->dev, "snps,dis-tx-ipgap-linecheck-quirk"))
reg |= DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS;
DWC3_WRITE(sc, DWC3_GUCTL1, reg);
reg = DWC3_READ(sc, DWC3_GUSB3PIPECTL0);
- if (OF_hasprop(sc->node, "snps,dis-del-phy-power-chg-quirk"))
+ if (device_has_property(sc->dev, "snps,dis-del-phy-power-chg-quirk"))
reg |= DWC3_GUSB3PIPECTL0_DELAYP1TRANS;
- if (OF_hasprop(sc->node, "snps,dis_rxdet_inp3_quirk"))
+ if (device_has_property(sc->dev, "snps,dis_rxdet_inp3_quirk"))
reg |= DWC3_GUSB3PIPECTL0_DISRXDETINP3;
DWC3_WRITE(sc, DWC3_GUSB3PIPECTL0, reg);
-
}
static int
snps_dwc3_probe(device_t dev)
{
- struct snps_dwc3_softc *sc;
+ char dr_mode[16];
+ ssize_t s;
if (!ofw_bus_status_okay(dev))
return (ENXIO);
@@ -284,11 +282,16 @@
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
- sc = device_get_softc(dev);
- sc->node = ofw_bus_get_node(dev);
- OF_getprop(sc->node, "dr_mode", sc->dr_mode, sizeof(sc->dr_mode));
- if (strcmp(sc->dr_mode, "host") != 0) {
- device_printf(dev, "Only host mode is supported\n");
+ s = device_get_property(dev, "dr_mode", dr_mode, sizeof(dr_mode),
+ DEVICE_PROP_BUFFER);
+ if (s == -1) {
+ device_printf(dev, "Cannot determine dr_mode\n");
+ return (ENXIO);
+ }
+ if (strcmp(dr_mode, "host") != 0) {
+ device_printf(dev,
+ "Found dr_mode '%s' but only 'host' supported. s=%zd\n",
+ dr_mode, s);
return (ENXIO);
}
@@ -318,6 +321,7 @@
device_printf(dev, "snps id: %x\n", DWC3_READ(sc, DWC3_GSNPSID));
/* Get the phys */
+ sc->node = ofw_bus_get_node(dev);
phy_get_by_ofw_name(dev, sc->node, "usb2-phy", &sc->usb2_phy);
phy_get_by_ofw_name(dev, sc->node, "usb3-phy", &sc->usb3_phy);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 4:52 PM (20 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15771165
Default Alt Text
D33170.diff (2 KB)
Attached To
Mode
D33170: USB: dwc3: use device_{has,get}_property()
Attached
Detach File
Event Timeline
Log In to Comment