[rtems-libbsd commit] ehci_imx: Port to RTEMS
Christian Mauderer
christianm at rtems.org
Wed Apr 15 15:13:21 UTC 2020
Module: rtems-libbsd
Branch: 5-freebsd-12
Commit: 4a2d99b4b055d4d93720fbd3ccec66e9242f98ac
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=4a2d99b4b055d4d93720fbd3ccec66e9242f98ac
Author: Christian Mauderer <christian.mauderer at embedded-brains.de>
Date: Wed Nov 14 10:40:50 2018 +0100
ehci_imx: Port to RTEMS
Update #3869.
---
freebsd/sys/arm/freescale/imx/imx6_usbphy.c | 11 +++++++++++
freebsd/sys/dev/usb/controller/ehci_imx.c | 12 ++++++++++++
2 files changed, 23 insertions(+)
diff --git a/freebsd/sys/arm/freescale/imx/imx6_usbphy.c b/freebsd/sys/arm/freescale/imx/imx6_usbphy.c
index 8f47507..ad54560 100644
--- a/freebsd/sys/arm/freescale/imx/imx6_usbphy.c
+++ b/freebsd/sys/arm/freescale/imx/imx6_usbphy.c
@@ -91,6 +91,17 @@ usbphy_detach(device_t dev)
return (0);
}
+#ifdef __rtems__
+#define BUS_SPACE_PHYSADDR(res, offs) \
+ ((u_int)(rman_get_start(res)+(offs)))
+
+void
+imx6_anatop_write_4(bus_size_t offset, uint32_t value)
+{
+
+ bus_space_write_4(0, 0x20c8000, offset, value);
+}
+#endif /* __rtems__ */
static int
usbphy_attach(device_t dev)
{
diff --git a/freebsd/sys/dev/usb/controller/ehci_imx.c b/freebsd/sys/dev/usb/controller/ehci_imx.c
index a872fb6..d158df1 100644
--- a/freebsd/sys/dev/usb/controller/ehci_imx.c
+++ b/freebsd/sys/dev/usb/controller/ehci_imx.c
@@ -303,6 +303,16 @@ imx_ehci_probe(device_t dev)
return (ENXIO);
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) {
+#ifdef __rtems__
+ char dr_mode[24];
+
+ if (OF_getprop(ofw_bus_get_node(dev), "dr_mode",
+ &dr_mode, sizeof(dr_mode)) > 0 &&
+ strcasecmp(dr_mode, "host") != 0) {
+ return (ENXIO);
+ }
+#endif /* __rtems__ */
+
device_set_desc(dev, "Freescale i.MX integrated USB controller");
return (BUS_PROBE_DEFAULT);
}
@@ -437,8 +447,10 @@ imx_ehci_attach(device_t dev)
goto out;
}
+#ifndef __rtems__
/* Turn on clocks. */
imx_ccm_usb_enable(dev);
+#endif /* __rtems__ */
/* Disable overcurrent detection, if configured to do so. */
if (OF_hasprop(ofw_bus_get_node(sc->dev), "disable-over-current"))
More information about the vc
mailing list