svn commit: r368026 - head/sys/arm/freescale/imx
Ian Lepore
ian at FreeBSD.org
Wed Nov 25 18:09:02 UTC 2020
Author: ian
Date: Wed Nov 25 18:09:01 2020
New Revision: 368026
URL: https://svnweb.freebsd.org/changeset/base/368026
Log:
A couple small fixes for the imx6_sdma driver...
Attach after interrupt controllers, since the attach function tries to
set up an interrupt handler.
Check for the availability of the required firmware early in the attach
code (before allocating resources). If the firmware is not available, set
a static var to remember that, so that if the device is re-probed on later
passes it won't repeatedly try to attach and then complain again about
missing firmware.
Modified:
head/sys/arm/freescale/imx/imx6_sdma.c
Modified: head/sys/arm/freescale/imx/imx6_sdma.c
==============================================================================
--- head/sys/arm/freescale/imx/imx6_sdma.c Wed Nov 25 17:15:24 2020 (r368025)
+++ head/sys/arm/freescale/imx/imx6_sdma.c Wed Nov 25 18:09:01 2020 (r368026)
@@ -75,6 +75,12 @@ static struct resource_spec sdma_spec[] = {
{ -1, 0 }
};
+/*
+ * This will get set to true if we can't load firmware while attaching, to
+ * prevent multiple attempts to re-attach the device on each bus pass.
+ */
+static bool firmware_unavailable;
+
static void
sdma_intr(void *arg)
{
@@ -117,7 +123,7 @@ static int
sdma_probe(device_t dev)
{
- if (!ofw_bus_status_okay(dev))
+ if (!ofw_bus_status_okay(dev) || firmware_unavailable)
return (ENXIO);
if (!ofw_bus_is_compatible(dev, "fsl,imx6q-sdma"))
@@ -468,6 +474,11 @@ sdma_attach(device_t dev)
sc = device_get_softc(dev);
sc->dev = dev;
+ if (load_firmware(sc) == -1) {
+ firmware_unavailable = true;
+ return (ENXIO);
+ }
+
if (bus_alloc_resources(dev, sdma_spec, sc->res)) {
device_printf(dev, "could not allocate resources\n");
return (ENXIO);
@@ -487,9 +498,6 @@ sdma_attach(device_t dev)
return (ENXIO);
}
- if (load_firmware(sc) == -1)
- return (ENXIO);
-
if (boot_firmware(sc) == -1)
return (ENXIO);
@@ -511,5 +519,6 @@ static driver_t sdma_driver = {
static devclass_t sdma_devclass;
+/* We want to attach after all interrupt controllers, before anything else. */
EARLY_DRIVER_MODULE(sdma, simplebus, sdma_driver, sdma_devclass, 0, 0,
- BUS_PASS_RESOURCE);
+ BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST);
More information about the svn-src-all
mailing list