aboutsummaryrefslogtreecommitdiff
path: root/sys/arm/freescale
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2020-11-25 18:09:01 +0000
committerIan Lepore <ian@FreeBSD.org>2020-11-25 18:09:01 +0000
commit4b7ae525a8e9a428ddba663d9d589e9a6abed45a (patch)
tree1f9dd0b534707640ef10ede3bf788b75ccdf961e /sys/arm/freescale
parentbca0e1d2ac08064d720a14486c2dfb73f4961bef (diff)
downloadsrc-4b7ae525a8e9a428ddba663d9d589e9a6abed45a.tar.gz
src-4b7ae525a8e9a428ddba663d9d589e9a6abed45a.zip
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.
Notes
Notes: svn path=/head/; revision=368026
Diffstat (limited to 'sys/arm/freescale')
-rw-r--r--sys/arm/freescale/imx/imx6_sdma.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/arm/freescale/imx/imx6_sdma.c b/sys/arm/freescale/imx/imx6_sdma.c
index 3bae225a75d5..ca817208ae73 100644
--- a/sys/arm/freescale/imx/imx6_sdma.c
+++ b/sys/arm/freescale/imx/imx6_sdma.c
@@ -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);