[PATCH v2 01/23] spi: remove flash_platform_data support

Marco Felsch m.felsch at pengutronix.de
Mon Mar 13 06:41:40 PDT 2023


Drop the non-dt platform data since the last user was removed by commit
1266831db8 ("ARM: OMAP: PCM051: Remove spi platform data").

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 drivers/mtd/devices/m25p80.c        | 15 +--------------
 drivers/mtd/devices/mtd_dataflash.c |  4 +---
 drivers/mtd/spi-nor/spi-nor.c       |  1 -
 include/spi/flash.h                 | 31 -------------------------------
 4 files changed, 2 insertions(+), 49 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 05c6473a28..ce3789c096 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -15,7 +15,6 @@
 #include <driver.h>
 #include <of.h>
 #include <spi/spi.h>
-#include <spi/flash.h>
 #include <xfuncs.h>
 #include <malloc.h>
 #include <errno.h>
@@ -205,7 +204,6 @@ static int m25p_probe(struct device *dev)
 {
 	struct spi_device *spi = (struct spi_device *)dev->type_data;
 	struct spi_mem *spimem = spi->mem;
-	struct flash_platform_data	*data;
 	struct m25p			*flash;
 	struct spi_nor			*nor;
 	struct spi_nor_hwcaps hwcaps = {
@@ -218,8 +216,6 @@ static int m25p_probe(struct device *dev)
 	bool				use_large_blocks;
 	int ret;
 
-	data = dev->platform_data;
-
 	flash = xzalloc(sizeof *flash);
 
 	nor = &flash->spi_nor;
@@ -245,14 +241,7 @@ static int m25p_probe(struct device *dev)
 
 	dev->priv = (void *)flash;
 
-	if (data && data->name)
-		flash->mtd.name = data->name;
-
-	if (data && data->type)
-		flash_name = data->type;
-	else if (data && data->name)
-		flash_name = data->name;
-	else if (dev->id_entry)
+	if (dev->id_entry)
 		flash_name = dev->id_entry->name;
 	else
 		flash_name = NULL; /* auto-detect */
@@ -267,8 +256,6 @@ static int m25p_probe(struct device *dev)
 	device_id = DEVICE_ID_SINGLE;
 	if (dev->of_node)
 		flash_name = of_alias_get(dev->of_node);
-	else if (data && data->name)
-		flash_name = data->name;
 
 	if (!flash_name) {
 		device_id = DEVICE_ID_DYNAMIC;
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index b6a0c79d2f..b5dbe4de3e 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -17,7 +17,6 @@
 #include <clock.h>
 
 #include <spi/spi.h>
-#include <spi/flash.h>
 
 #include <linux/math64.h>
 #include <linux/mtd/mtd.h>
@@ -599,7 +598,6 @@ add_dataflash_otp(struct spi_device *spi, char *name,
 {
 	struct dataflash		*priv;
 	struct mtd_info			*device;
-	struct flash_platform_data	*pdata = spi->dev.platform_data;
 	char				*otp_tag = "";
 	int				err = 0;
 
@@ -617,7 +615,7 @@ add_dataflash_otp(struct spi_device *spi, char *name,
 			name);
 
 	device = &priv->mtd;
-	device->name = (pdata && pdata->name) ? pdata->name : "dataflash";
+	device->name = "dataflash";
 	device->size = nr_pages * (uint64_t)pagesize;
 	device->erasesize = pagesize;
 	device->writesize = pagesize;
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index f83c3f02a0..8f6726ca4b 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -19,7 +19,6 @@
 #include <linux/mtd/cfi.h>
 #include <linux/mtd/spi-nor.h>
 #include <of.h>
-#include <spi/flash.h>
 
 #define SPI_NOR_MAX_ID_LEN	6
 #define SPI_NOR_MAX_ADDR_WIDTH	4
diff --git a/include/spi/flash.h b/include/spi/flash.h
deleted file mode 100644
index 796d649d9a..0000000000
--- a/include/spi/flash.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef LINUX_SPI_FLASH_H
-#define LINUX_SPI_FLASH_H
-
-struct mtd_partition;
-
-/**
- * struct flash_platform_data: board-specific flash data
- * @name: optional flash device name (eg, as used with mtdparts=)
- * @parts: optional array of mtd_partitions for static partitioning
- * @nr_parts: number of mtd_partitions for static partitoning
- * @type: optional flash device type (e.g. m25p80 vs m25p64), for use
- *	with chips that can't be queried for JEDEC or other IDs
- *
- * Board init code (in arch/.../mach-xxx/board-yyy.c files) can
- * provide information about SPI flash parts (such as DataFlash) to
- * help set up the device and its appropriate default partitioning.
- *
- * Note that for DataFlash, sizes for pages, blocks, and sectors are
- * rarely powers of two; and partitions should be sector-aligned.
- */
-struct flash_platform_data {
-	char		*name;
-	struct mtd_partition	*parts;
-	unsigned int		nr_parts;
-	char			*type;
-
-	/* we'll likely add more ... use JEDEC IDs, etc */
-};
-
-#endif

-- 
2.30.2




More information about the barebox mailing list