1 From 6f1195d231ab576809fe2f4cff44a6e48cff2457 Mon Sep 17 00:00:00 2001
2 From: Yutang Jiang <yutang.jiang@nxp.com>
3 Date: Fri, 2 Sep 2016 22:00:16 +0800
4 Subject: [PATCH 113/113] mtd: spi-nor: fsl-quad: move mtd_device_register to
7 After call mtd_device_register, the mtd devices should be workable immediately.
8 If before finish all of init work call the mtd_device_register, it will not
9 respond work request timely.
11 For example, openwrt/lede have a AUTO split special flash partitions mechanism
12 while mtd driver register. So, before call mtd_device_register, must let all of
15 Signed-off-by: Yutang Jiang <yutang.jiang@nxp.com>
17 drivers/mtd/spi-nor/fsl-quadspi.c | 14 ++++++++++----
18 1 file changed, 10 insertions(+), 4 deletions(-)
20 --- a/drivers/mtd/spi-nor/fsl-quadspi.c
21 +++ b/drivers/mtd/spi-nor/fsl-quadspi.c
22 @@ -1280,10 +1280,6 @@ static int fsl_qspi_probe(struct platfor
26 - ret = mtd_device_register(mtd, NULL, 0);
30 /* Set the correct NOR size now. */
31 if (q->nor_size == 0) {
32 q->nor_size = mtd->size;
33 @@ -1313,6 +1309,16 @@ static int fsl_qspi_probe(struct platfor
34 goto last_init_failed;
36 fsl_qspi_clk_disable_unprep(q);
38 + for (i = 0; i < q->nor_num; i++) {
39 + /* skip the holes */
40 + if (!q->has_second_chip)
43 + ret = mtd_device_register(&q->nor[i].mtd, NULL, 0);
45 + goto last_init_failed;