summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorHuang Shijie <b32955@freescale.com>2014-04-15 13:35:59 +0800
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 08:58:21 -0500
commit753b8b8761404ae98eb0c76734bf512c17311a70 (patch)
treea4de0bde3080f8c9005e902c7cd4ab17db256846 /drivers/mtd
parent545c7383dfba874180b394f8b00b563a6541e158 (diff)
ENGR00308399 mtd: fsl-quadspi: quit if the M4 is using the quadspi
Detect if the quadspi is used by the M4. If the M4 does use it, we quit. Signed-off-by: Huang Shijie <b32955@freescale.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/spi-nor/fsl-quadspi.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index 4f8bc62761d6..091b2ed99f86 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -882,6 +882,13 @@ static void fsl_qspi_unprep(struct spi_nor *nor, enum spi_nor_ops ops)
clk_disable(q->clk_en);
}
+/* If the uboot enable the M4 to use the Quadspi, we should quit. */
+static bool fsl_m4_is_using(struct fsl_qspi *q)
+{
+ return (readl(q->iobase + QUADSPI_BUF0CR) ==
+ QUADSPI_BUFXCR_INVALID_MSTRID);
+}
+
static int fsl_qspi_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -948,6 +955,12 @@ static int fsl_qspi_probe(struct platform_device *pdev)
goto map_failed;
}
+ if (fsl_m4_is_using(q)) {
+ dev_info(dev, "The M4 is using quadspi controller, we quit.\n");
+ ret = -EINVAL;
+ goto irq_failed;
+ }
+
/* find the irq */
ret = platform_get_irq(pdev, 0);
if (ret < 0) {