mtd: spi-nor: allow registering multiple MTDs when DM is enabled
authorMarek Behún <marek.behun@nic.cz>
Wed, 26 May 2021 12:08:20 +0000 (14:08 +0200)
committerJagan Teki <jagan@amarulasolutions.com>
Thu, 24 Jun 2021 06:23:31 +0000 (11:53 +0530)
commitb7f060565e3161f8977a3a93e4b31ed6031af874
tree0a8638edd3b39da21d35320429f0a13ae37cdbf0
parentdc339bf784f08707583a5b6465381354f48d4fa8
mtd: spi-nor: allow registering multiple MTDs when DM is enabled

Currently when the SPI_FLASH_MTD config option is enabled, only one SPI
can be registered as MTD at any time - it is the last one probed (since
with old non-DM model only one SPI NOR could be probed at any time).

When DM is enabled, allow for registering multiple SPI NORs as MTDs by
utilizing the nor->mtd structure, which is filled in by spi_nor_scan
anyway, instead of filling a separate struct mtd_info.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Cc: Priyanka Jain <priyanka.jain@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heiko Schocher <hs@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
drivers/mtd/spi/sf_internal.h
drivers/mtd/spi/sf_mtd.c
drivers/mtd/spi/sf_probe.c