From f9418e99109c36247c768419ed28c14d0edc1477 Mon Sep 17 00:00:00 2001 From: Yuan Yao Date: Fri, 13 Jan 2017 15:49:53 +0800 Subject: mtd: spi-nor: fsl-quad: allow sub node probe failed The QSPI can support max to four spi flash at the same time. But sometime one or more flash maybe probe failed because of the wrong setting or the hardware issue or some othere. But as long as there is one flash probe success, that the QSPI driver should probe success and finish all the initialization. Signed-off-by: Yuan Yao diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index 6e1168b..5a5b355 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -1161,6 +1161,7 @@ static int fsl_qspi_probe(struct platform_device *pdev) struct spi_nor *nor; struct mtd_info *mtd; int ret, i = 0; + int find_node; enum read_mode mode = SPI_NOR_QUAD; q = devm_kzalloc(dev, sizeof(*q), GFP_KERNEL); @@ -1238,6 +1239,7 @@ static int fsl_qspi_probe(struct platform_device *pdev) mutex_init(&q->lock); + find_node = 0; /* iterate the subnodes. */ for_each_available_child_of_node(dev->of_node, np) { /* skip the holes */ @@ -1264,7 +1266,7 @@ static int fsl_qspi_probe(struct platform_device *pdev) ret = of_property_read_u32(np, "spi-max-frequency", &q->clk_rate); if (ret < 0) - goto mutex_failed; + continue; /* set the chip address for READID */ fsl_qspi_set_base_addr(q, nor); @@ -1278,11 +1280,11 @@ static int fsl_qspi_probe(struct platform_device *pdev) ret = spi_nor_scan(nor, NULL, mode); if (ret) - goto mutex_failed; + continue; ret = mtd_device_register(mtd, NULL, 0); if (ret) - goto mutex_failed; + continue; /* Set the correct NOR size now. */ if (q->nor_size == 0) { @@ -1305,8 +1307,12 @@ static int fsl_qspi_probe(struct platform_device *pdev) nor->page_size = q->devtype_data->txfifo; i++; + find_node++; } + if (find_node == 0) + goto mutex_failed; + /* finish the rest init. */ ret = fsl_qspi_nor_setup_last(q); if (ret) -- cgit v0.10.2