Patchwork [U-Boot,RESEND,v2,19/20] sf: Remove unneeded flash drivers files

login
register
mail settings
Submitter Jagannadha Sutradharudu Teki
Date Aug. 6, 2013, 4:17 p.m.
Message ID <420ec50e-51be-4681-aae6-eed97a2e31f1@DB9EHSMHS009.ehs.local>
Download mbox | patch
Permalink /patch/265133/
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Comments

Jagannadha Sutradharudu Teki - Aug. 6, 2013, 4:17 p.m.
Now the common probing is handled in spi_flash_probe.c
hence removed the unneeded flash drivers.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
---
Changes for v2:
	- none

 drivers/mtd/spi/Makefile             |  12 +-
 drivers/mtd/spi/atmel.c              | 544 -----------------------------------
 drivers/mtd/spi/eon.c                |  60 ----
 drivers/mtd/spi/gigadevice.c         |  65 -----
 drivers/mtd/spi/macronix.c           |  98 -------
 drivers/mtd/spi/ramtron.c            | 406 --------------------------
 drivers/mtd/spi/spansion.c           | 141 ---------
 drivers/mtd/spi/spi_flash_internal.h |  10 -
 drivers/mtd/spi/sst.c                | 232 ---------------
 drivers/mtd/spi/stmicro.c            | 202 -------------
 drivers/mtd/spi/winbond.c            | 141 ---------
 11 files changed, 2 insertions(+), 1909 deletions(-)
 delete mode 100644 drivers/mtd/spi/atmel.c
 delete mode 100644 drivers/mtd/spi/eon.c
 delete mode 100644 drivers/mtd/spi/gigadevice.c
 delete mode 100644 drivers/mtd/spi/macronix.c
 delete mode 100644 drivers/mtd/spi/ramtron.c
 delete mode 100644 drivers/mtd/spi/spansion.c
 delete mode 100644 drivers/mtd/spi/sst.c
 delete mode 100644 drivers/mtd/spi/stmicro.c
 delete mode 100644 drivers/mtd/spi/winbond.c

Patch

diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
index e06924a..db2003b 100644
--- a/drivers/mtd/spi/Makefile
+++ b/drivers/mtd/spi/Makefile
@@ -16,16 +16,8 @@  endif
 ifdef CONFIG_CMD_SF
 COBJS-y	+= spi_flash.o
 endif
-COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash_probe.o spi_flash_ops.o
-COBJS-$(CONFIG_SPI_FLASH_ATMEL)	+= atmel.o
-COBJS-$(CONFIG_SPI_FLASH_EON)	+= eon.o
-COBJS-$(CONFIG_SPI_FLASH_GIGADEVICE)	+= gigadevice.o
-COBJS-$(CONFIG_SPI_FLASH_MACRONIX)	+= macronix.o
-COBJS-$(CONFIG_SPI_FLASH_SPANSION)	+= spansion.o
-COBJS-$(CONFIG_SPI_FLASH_SST)	+= sst.o
-COBJS-$(CONFIG_SPI_FLASH_STMICRO)	+= stmicro.o
-COBJS-$(CONFIG_SPI_FLASH_WINBOND)	+= winbond.o
-COBJS-$(CONFIG_SPI_FRAM_RAMTRON)	+= ramtron.o
+COBJS-$(CONFIG_SPI_FLASH) += spi_flash_probe.o spi_flash_ops.o
+COBJS-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.o
 COBJS-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o
 
 COBJS	:= $(COBJS-y)
diff --git a/drivers/mtd/spi/atmel.c b/drivers/mtd/spi/atmel.c
deleted file mode 100644
index f34df43..0000000
--- a/drivers/mtd/spi/atmel.c
+++ /dev/null
@@ -1,544 +0,0 @@ 
-/*
- * Atmel SPI DataFlash support
- *
- * Copyright (C) 2008 Atmel Corporation
- * Licensed under the GPL-2 or later.
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <spi_flash.h>
-
-#include "spi_flash_internal.h"
-
-/* AT45-specific commands */
-#define CMD_AT45_READ_STATUS		0xd7
-#define CMD_AT45_ERASE_PAGE		0x81
-#define CMD_AT45_LOAD_PROG_BUF1		0x82
-#define CMD_AT45_LOAD_BUF1		0x84
-#define CMD_AT45_LOAD_PROG_BUF2		0x85
-#define CMD_AT45_LOAD_BUF2		0x87
-#define CMD_AT45_PROG_BUF1		0x88
-#define CMD_AT45_PROG_BUF2		0x89
-
-/* AT45 status register bits */
-#define AT45_STATUS_P2_PAGE_SIZE	(1 << 0)
-#define AT45_STATUS_READY		(1 << 7)
-
-/* DataFlash family IDs, as obtained from the second idcode byte */
-#define DF_FAMILY_AT26F			0
-#define DF_FAMILY_AT45			1
-#define DF_FAMILY_AT26DF		2	/* AT25DF and AT26DF */
-
-struct atmel_spi_flash_params {
-	u8		idcode1;
-	/* Log2 of page size in power-of-two mode */
-	u8		l2_page_size;
-	u8		pages_per_block;
-	u8		blocks_per_sector;
-	u8		nr_sectors;
-	const char	*name;
-};
-
-/* spi_flash needs to be first so upper layers can free() it */
-struct atmel_spi_flash {
-	struct spi_flash flash;
-	const struct atmel_spi_flash_params *params;
-};
-
-static inline struct atmel_spi_flash *
-to_atmel_spi_flash(struct spi_flash *flash)
-{
-	return container_of(flash, struct atmel_spi_flash, flash);
-}
-
-static const struct atmel_spi_flash_params atmel_spi_flash_table[] = {
-	{
-		.idcode1		= 0x22,
-		.l2_page_size		= 8,
-		.pages_per_block	= 8,
-		.blocks_per_sector	= 16,
-		.nr_sectors		= 4,
-		.name			= "AT45DB011D",
-	},
-	{
-		.idcode1		= 0x23,
-		.l2_page_size		= 8,
-		.pages_per_block	= 8,
-		.blocks_per_sector	= 16,
-		.nr_sectors		= 8,
-		.name			= "AT45DB021D",
-	},
-	{
-		.idcode1		= 0x24,
-		.l2_page_size		= 8,
-		.pages_per_block	= 8,
-		.blocks_per_sector	= 32,
-		.nr_sectors		= 8,
-		.name			= "AT45DB041D",
-	},
-	{
-		.idcode1		= 0x25,
-		.l2_page_size		= 8,
-		.pages_per_block	= 8,
-		.blocks_per_sector	= 32,
-		.nr_sectors		= 16,
-		.name			= "AT45DB081D",
-	},
-	{
-		.idcode1		= 0x26,
-		.l2_page_size		= 9,
-		.pages_per_block	= 8,
-		.blocks_per_sector	= 32,
-		.nr_sectors		= 16,
-		.name			= "AT45DB161D",
-	},
-	{
-		.idcode1		= 0x27,
-		.l2_page_size		= 9,
-		.pages_per_block	= 8,
-		.blocks_per_sector	= 64,
-		.nr_sectors		= 64,
-		.name			= "AT45DB321D",
-	},
-	{
-		.idcode1		= 0x28,
-		.l2_page_size		= 10,
-		.pages_per_block	= 8,
-		.blocks_per_sector	= 32,
-		.nr_sectors		= 32,
-		.name			= "AT45DB642D",
-	},
-	{
-		.idcode1		= 0x47,
-		.l2_page_size		= 8,
-		.pages_per_block	= 16,
-		.blocks_per_sector	= 16,
-		.nr_sectors		= 64,
-		.name			= "AT25DF321",
-	},
-};
-
-static int at45_wait_ready(struct spi_flash *flash, unsigned long timeout)
-{
-	struct spi_slave *spi = flash->spi;
-	unsigned long timebase;
-	int ret;
-	u8 cmd = CMD_AT45_READ_STATUS;
-	u8 status;
-
-	timebase = get_timer(0);
-
-	ret = spi_xfer(spi, 8, &cmd, NULL, SPI_XFER_BEGIN);
-	if (ret)
-		return -1;
-
-	do {
-		ret = spi_xfer(spi, 8, NULL, &status, 0);
-		if (ret)
-			return -1;
-
-		if (status & AT45_STATUS_READY)
-			break;
-	} while (get_timer(timebase) < timeout);
-
-	/* Deactivate CS */
-	spi_xfer(spi, 0, NULL, NULL, SPI_XFER_END);
-
-	if (status & AT45_STATUS_READY)
-		return 0;
-
-	/* Timed out */
-	return -1;
-}
-
-/*
- * Assemble the address part of a command for AT45 devices in
- * non-power-of-two page size mode.
- */
-static void at45_build_address(struct atmel_spi_flash *asf, u8 *cmd, u32 offset)
-{
-	unsigned long page_addr;
-	unsigned long byte_addr;
-	unsigned long page_size;
-	unsigned int page_shift;
-
-	/*
-	 * The "extra" space per page is the power-of-two page size
-	 * divided by 32.
-	 */
-	page_shift = asf->params->l2_page_size;
-	page_size = (1 << page_shift) + (1 << (page_shift - 5));
-	page_shift++;
-	page_addr = offset / page_size;
-	byte_addr = offset % page_size;
-
-	cmd[0] = page_addr >> (16 - page_shift);
-	cmd[1] = page_addr << (page_shift - 8) | (byte_addr >> 8);
-	cmd[2] = byte_addr;
-}
-
-static int dataflash_read_fast_at45(struct spi_flash *flash,
-		u32 offset, size_t len, void *buf)
-{
-	struct atmel_spi_flash *asf = to_atmel_spi_flash(flash);
-	u8 cmd[5];
-
-	cmd[0] = CMD_READ_ARRAY_FAST;
-	at45_build_address(asf, cmd + 1, offset);
-	cmd[4] = 0x00;
-
-	return spi_flash_read_common(flash, cmd, sizeof(cmd), buf, len);
-}
-
-/*
- * TODO: the two write funcs (_p2/_at45) should get unified ...
- */
-static int dataflash_write_p2(struct spi_flash *flash,
-		u32 offset, size_t len, const void *buf)
-{
-	struct atmel_spi_flash *asf = to_atmel_spi_flash(flash);
-	unsigned long page_size;
-	u32 addr = offset;
-	size_t chunk_len;
-	size_t actual;
-	int ret;
-	u8 cmd[4];
-
-	/*
-	 * TODO: This function currently uses only page buffer #1.  We can
-	 * speed this up by using both buffers and loading one buffer while
-	 * the other is being programmed into main memory.
-	 */
-
-	page_size = (1 << asf->params->l2_page_size);
-
-	ret = spi_claim_bus(flash->spi);
-	if (ret) {
-		debug("SF: Unable to claim SPI bus\n");
-		return ret;
-	}
-
-	for (actual = 0; actual < len; actual += chunk_len) {
-		chunk_len = min(len - actual, page_size - (addr % page_size));
-
-		/* Use the same address bits for both commands */
-		cmd[0] = CMD_AT45_LOAD_BUF1;
-		cmd[1] = addr >> 16;
-		cmd[2] = addr >> 8;
-		cmd[3] = addr;
-
-		ret = spi_flash_cmd_write(flash->spi, cmd, 4,
-				buf + actual, chunk_len);
-		if (ret < 0) {
-			debug("SF: Loading AT45 buffer failed\n");
-			goto out;
-		}
-
-		cmd[0] = CMD_AT45_PROG_BUF1;
-		ret = spi_flash_cmd_write(flash->spi, cmd, 4, NULL, 0);
-		if (ret < 0) {
-			debug("SF: AT45 page programming failed\n");
-			goto out;
-		}
-
-		ret = at45_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
-		if (ret < 0) {
-			debug("SF: AT45 page programming timed out\n");
-			goto out;
-		}
-
-		addr += chunk_len;
-	}
-
-	debug("SF: AT45: Successfully programmed %zu bytes @ 0x%x\n",
-	      len, offset);
-	ret = 0;
-
-out:
-	spi_release_bus(flash->spi);
-	return ret;
-}
-
-static int dataflash_write_at45(struct spi_flash *flash,
-		u32 offset, size_t len, const void *buf)
-{
-	struct atmel_spi_flash *asf = to_atmel_spi_flash(flash);
-	unsigned long page_addr;
-	unsigned long byte_addr;
-	unsigned long page_size;
-	unsigned int page_shift;
-	size_t chunk_len;
-	size_t actual;
-	int ret;
-	u8 cmd[4];
-
-	/*
-	 * TODO: This function currently uses only page buffer #1.  We can
-	 * speed this up by using both buffers and loading one buffer while
-	 * the other is being programmed into main memory.
-	 */
-
-	page_shift = asf->params->l2_page_size;
-	page_size = (1 << page_shift) + (1 << (page_shift - 5));
-	page_shift++;
-	page_addr = offset / page_size;
-	byte_addr = offset % page_size;
-
-	ret = spi_claim_bus(flash->spi);
-	if (ret) {
-		debug("SF: Unable to claim SPI bus\n");
-		return ret;
-	}
-
-	for (actual = 0; actual < len; actual += chunk_len) {
-		chunk_len = min(len - actual, page_size - byte_addr);
-
-		/* Use the same address bits for both commands */
-		cmd[0] = CMD_AT45_LOAD_BUF1;
-		cmd[1] = page_addr >> (16 - page_shift);
-		cmd[2] = page_addr << (page_shift - 8) | (byte_addr >> 8);
-		cmd[3] = byte_addr;
-
-		ret = spi_flash_cmd_write(flash->spi, cmd, 4,
-				buf + actual, chunk_len);
-		if (ret < 0) {
-			debug("SF: Loading AT45 buffer failed\n");
-			goto out;
-		}
-
-		cmd[0] = CMD_AT45_PROG_BUF1;
-		ret = spi_flash_cmd_write(flash->spi, cmd, 4, NULL, 0);
-		if (ret < 0) {
-			debug("SF: AT45 page programming failed\n");
-			goto out;
-		}
-
-		ret = at45_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
-		if (ret < 0) {
-			debug("SF: AT45 page programming timed out\n");
-			goto out;
-		}
-
-		page_addr++;
-		byte_addr = 0;
-	}
-
-	debug("SF: AT45: Successfully programmed %zu bytes @ 0x%x\n",
-	      len, offset);
-	ret = 0;
-
-out:
-	spi_release_bus(flash->spi);
-	return ret;
-}
-
-/*
- * TODO: the two erase funcs (_p2/_at45) should get unified ...
- */
-static int dataflash_erase_p2(struct spi_flash *flash, u32 offset, size_t len)
-{
-	struct atmel_spi_flash *asf = to_atmel_spi_flash(flash);
-	unsigned long page_size;
-
-	size_t actual;
-	int ret;
-	u8 cmd[4];
-
-	/*
-	 * TODO: This function currently uses page erase only. We can
-	 * probably speed things up by using block and/or sector erase
-	 * when possible.
-	 */
-
-	page_size = (1 << asf->params->l2_page_size);
-
-	if (offset % page_size || len % page_size) {
-		debug("SF: Erase offset/length not multiple of page size\n");
-		return -1;
-	}
-
-	cmd[0] = CMD_AT45_ERASE_PAGE;
-	cmd[3] = 0x00;
-
-	ret = spi_claim_bus(flash->spi);
-	if (ret) {
-		debug("SF: Unable to claim SPI bus\n");
-		return ret;
-	}
-
-	for (actual = 0; actual < len; actual += page_size) {
-		cmd[1] = offset >> 16;
-		cmd[2] = offset >> 8;
-
-		ret = spi_flash_cmd_write(flash->spi, cmd, 4, NULL, 0);
-		if (ret < 0) {
-			debug("SF: AT45 page erase failed\n");
-			goto out;
-		}
-
-		ret = at45_wait_ready(flash, SPI_FLASH_PAGE_ERASE_TIMEOUT);
-		if (ret < 0) {
-			debug("SF: AT45 page erase timed out\n");
-			goto out;
-		}
-
-		offset += page_size;
-	}
-
-	debug("SF: AT45: Successfully erased %zu bytes @ 0x%x\n",
-	      len, offset);
-	ret = 0;
-
-out:
-	spi_release_bus(flash->spi);
-	return ret;
-}
-
-static int dataflash_erase_at45(struct spi_flash *flash, u32 offset, size_t len)
-{
-	struct atmel_spi_flash *asf = to_atmel_spi_flash(flash);
-	unsigned long page_addr;
-	unsigned long page_size;
-	unsigned int page_shift;
-	size_t actual;
-	int ret;
-	u8 cmd[4];
-
-	/*
-	 * TODO: This function currently uses page erase only. We can
-	 * probably speed things up by using block and/or sector erase
-	 * when possible.
-	 */
-
-	page_shift = asf->params->l2_page_size;
-	page_size = (1 << page_shift) + (1 << (page_shift - 5));
-	page_shift++;
-	page_addr = offset / page_size;
-
-	if (offset % page_size || len % page_size) {
-		debug("SF: Erase offset/length not multiple of page size\n");
-		return -1;
-	}
-
-	cmd[0] = CMD_AT45_ERASE_PAGE;
-	cmd[3] = 0x00;
-
-	ret = spi_claim_bus(flash->spi);
-	if (ret) {
-		debug("SF: Unable to claim SPI bus\n");
-		return ret;
-	}
-
-	for (actual = 0; actual < len; actual += page_size) {
-		cmd[1] = page_addr >> (16 - page_shift);
-		cmd[2] = page_addr << (page_shift - 8);
-
-		ret = spi_flash_cmd_write(flash->spi, cmd, 4, NULL, 0);
-		if (ret < 0) {
-			debug("SF: AT45 page erase failed\n");
-			goto out;
-		}
-
-		ret = at45_wait_ready(flash, SPI_FLASH_PAGE_ERASE_TIMEOUT);
-		if (ret < 0) {
-			debug("SF: AT45 page erase timed out\n");
-			goto out;
-		}
-
-		page_addr++;
-	}
-
-	debug("SF: AT45: Successfully erased %zu bytes @ 0x%x\n",
-	      len, offset);
-	ret = 0;
-
-out:
-	spi_release_bus(flash->spi);
-	return ret;
-}
-
-struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode)
-{
-	const struct atmel_spi_flash_params *params;
-	unsigned page_size;
-	unsigned int family;
-	struct atmel_spi_flash *asf;
-	unsigned int i;
-	int ret;
-	u8 status;
-
-	for (i = 0; i < ARRAY_SIZE(atmel_spi_flash_table); i++) {
-		params = &atmel_spi_flash_table[i];
-		if (params->idcode1 == idcode[1])
-			break;
-	}
-
-	if (i == ARRAY_SIZE(atmel_spi_flash_table)) {
-		debug("SF: Unsupported DataFlash ID %02x\n",
-		      idcode[1]);
-		return NULL;
-	}
-
-	asf = spi_flash_alloc(struct atmel_spi_flash, spi, params->name);
-	if (!asf) {
-		debug("SF: Failed to allocate memory\n");
-		return NULL;
-	}
-
-	asf->params = params;
-
-	/* Assuming power-of-two page size initially. */
-	page_size = 1 << params->l2_page_size;
-
-	family = idcode[1] >> 5;
-
-	switch (family) {
-	case DF_FAMILY_AT45:
-		/*
-		 * AT45 chips have configurable page size. The status
-		 * register indicates which configuration is active.
-		 */
-		ret = spi_flash_cmd(spi, CMD_AT45_READ_STATUS, &status, 1);
-		if (ret)
-			goto err;
-
-		debug("SF: AT45 status register: %02x\n", status);
-
-		if (!(status & AT45_STATUS_P2_PAGE_SIZE)) {
-			asf->flash.read = dataflash_read_fast_at45;
-			asf->flash.write = dataflash_write_at45;
-			asf->flash.erase = dataflash_erase_at45;
-			page_size += 1 << (params->l2_page_size - 5);
-		} else {
-			asf->flash.write = dataflash_write_p2;
-			asf->flash.erase = dataflash_erase_p2;
-		}
-
-		asf->flash.page_size = page_size;
-		asf->flash.sector_size = page_size;
-		break;
-
-	case DF_FAMILY_AT26F:
-	case DF_FAMILY_AT26DF:
-		asf->flash.page_size = page_size;
-		asf->flash.sector_size = 4096;
-		/* clear SPRL# bit for locked flash */
-		spi_flash_cmd_write_status(&asf->flash, 0);
-		break;
-
-	default:
-		debug("SF: Unsupported DataFlash family %u\n", family);
-		goto err;
-	}
-
-	asf->flash.size = page_size * params->pages_per_block
-				* params->blocks_per_sector
-				* params->nr_sectors;
-
-	return &asf->flash;
-
-err:
-	free(asf);
-	return NULL;
-}
diff --git a/drivers/mtd/spi/eon.c b/drivers/mtd/spi/eon.c
deleted file mode 100644
index 25cfc12..0000000
--- a/drivers/mtd/spi/eon.c
+++ /dev/null
@@ -1,60 +0,0 @@ 
-/*
- * (C) Copyright 2010, ucRobotics Inc.
- * Author: Chong Huang <chuang@ucrobotics.com>
- * Licensed under the GPL-2 or later.
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <spi_flash.h>
-
-#include "spi_flash_internal.h"
-
-struct eon_spi_flash_params {
-	u8 idcode1;
-	u16 nr_sectors;
-	const char *name;
-};
-
-static const struct eon_spi_flash_params eon_spi_flash_table[] = {
-	{
-		.idcode1 = 0x16,
-		.nr_sectors = 1024,
-		.name = "EN25Q32B",
-	},
-	{
-		.idcode1 = 0x18,
-		.nr_sectors = 4096,
-		.name = "EN25Q128",
-	},
-};
-
-struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode)
-{
-	const struct eon_spi_flash_params *params;
-	struct spi_flash *flash;
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(eon_spi_flash_table); ++i) {
-		params = &eon_spi_flash_table[i];
-		if (params->idcode1 == idcode[2])
-			break;
-	}
-
-	if (i == ARRAY_SIZE(eon_spi_flash_table)) {
-		debug("SF: Unsupported EON ID %02x\n", idcode[1]);
-		return NULL;
-	}
-
-	flash = spi_flash_alloc_base(spi, params->name);
-	if (!flash) {
-		debug("SF: Failed to allocate memory\n");
-		return NULL;
-	}
-
-	flash->page_size = 256;
-	flash->sector_size = 256 * 16 * 16;
-	flash->size = 256 * 16 * params->nr_sectors;
-
-	return flash;
-}
diff --git a/drivers/mtd/spi/gigadevice.c b/drivers/mtd/spi/gigadevice.c
deleted file mode 100644
index b42581a..0000000
--- a/drivers/mtd/spi/gigadevice.c
+++ /dev/null
@@ -1,65 +0,0 @@ 
-/*
- * Gigadevice SPI flash driver
- * Copyright 2013, Samsung Electronics Co., Ltd.
- * Author: Banajit Goswami <banajit.g@samsung.com>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <spi_flash.h>
-
-#include "spi_flash_internal.h"
-
-struct gigadevice_spi_flash_params {
-	uint16_t	id;
-	uint16_t	nr_blocks;
-	const char	*name;
-};
-
-static const struct gigadevice_spi_flash_params gigadevice_spi_flash_table[] = {
-	{
-		.id			= 0x6016,
-		.nr_blocks		= 64,
-		.name			= "GD25LQ",
-	},
-	{
-		.id			= 0x4017,
-		.nr_blocks		= 128,
-		.name			= "GD25Q64B",
-	},
-};
-
-struct spi_flash *spi_flash_probe_gigadevice(struct spi_slave *spi, u8 *idcode)
-{
-	const struct gigadevice_spi_flash_params *params;
-	struct spi_flash *flash;
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(gigadevice_spi_flash_table); i++) {
-		params = &gigadevice_spi_flash_table[i];
-		if (params->id == ((idcode[1] << 8) | idcode[2]))
-			break;
-	}
-
-	if (i == ARRAY_SIZE(gigadevice_spi_flash_table)) {
-		debug("SF: Unsupported Gigadevice ID %02x%02x\n",
-		      idcode[1], idcode[2]);
-		return NULL;
-	}
-
-	flash = spi_flash_alloc_base(spi, params->name);
-	if (!flash) {
-		debug("SF: Failed to allocate memory\n");
-		return NULL;
-	}
-	/* page_size */
-	flash->page_size = 256;
-	/* sector_size = page_size * pages_per_sector */
-	flash->sector_size = flash->page_size * 16;
-	/* size = sector_size * sector_per_block * number of blocks */
-	flash->size = flash->sector_size * 16 * params->nr_blocks;
-
-	return flash;
-}
diff --git a/drivers/mtd/spi/macronix.c b/drivers/mtd/spi/macronix.c
deleted file mode 100644
index 70435eb..0000000
--- a/drivers/mtd/spi/macronix.c
+++ /dev/null
@@ -1,98 +0,0 @@ 
-/*
- * Copyright 2009(C) Marvell International Ltd. and its affiliates
- * Prafulla Wadaskar <prafulla@marvell.com>
- *
- * Based on drivers/mtd/spi/stmicro.c
- *
- * Copyright 2008, Network Appliance Inc.
- * Jason McMullan <mcmullan@netapp.com>
- *
- * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
- * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <spi_flash.h>
-
-#include "spi_flash_internal.h"
-
-struct macronix_spi_flash_params {
-	u16 idcode;
-	u16 nr_blocks;
-	const char *name;
-};
-
-static const struct macronix_spi_flash_params macronix_spi_flash_table[] = {
-	{
-		.idcode = 0x2013,
-		.nr_blocks = 8,
-		.name = "MX25L4005",
-	},
-	{
-		.idcode = 0x2014,
-		.nr_blocks = 16,
-		.name = "MX25L8005",
-	},
-	{
-		.idcode = 0x2015,
-		.nr_blocks = 32,
-		.name = "MX25L1605D",
-	},
-	{
-		.idcode = 0x2016,
-		.nr_blocks = 64,
-		.name = "MX25L3205D",
-	},
-	{
-		.idcode = 0x2017,
-		.nr_blocks = 128,
-		.name = "MX25L6405D",
-	},
-	{
-		.idcode = 0x2018,
-		.nr_blocks = 256,
-		.name = "MX25L12805D",
-	},
-	{
-		.idcode = 0x2618,
-		.nr_blocks = 256,
-		.name = "MX25L12855E",
-	},
-};
-
-struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode)
-{
-	const struct macronix_spi_flash_params *params;
-	struct spi_flash *flash;
-	unsigned int i;
-	u16 id = idcode[2] | idcode[1] << 8;
-
-	for (i = 0; i < ARRAY_SIZE(macronix_spi_flash_table); i++) {
-		params = &macronix_spi_flash_table[i];
-		if (params->idcode == id)
-			break;
-	}
-
-	if (i == ARRAY_SIZE(macronix_spi_flash_table)) {
-		debug("SF: Unsupported Macronix ID %04x\n", id);
-		return NULL;
-	}
-
-	flash = spi_flash_alloc_base(spi, params->name);
-	if (!flash) {
-		debug("SF: Failed to allocate memory\n");
-		return NULL;
-	}
-
-	flash->page_size = 256;
-	flash->sector_size = 256 * 16 * 16;
-	flash->size = flash->sector_size * params->nr_blocks;
-
-	/* Clear BP# bits for read-only flash */
-	spi_flash_cmd_write_status(flash, 0);
-
-	return flash;
-}
diff --git a/drivers/mtd/spi/ramtron.c b/drivers/mtd/spi/ramtron.c
deleted file mode 100644
index c9701d0..0000000
--- a/drivers/mtd/spi/ramtron.c
+++ /dev/null
@@ -1,406 +0,0 @@ 
-/*
- * (C) Copyright 2010
- * Reinhard Meyer, EMK Elektronik, reinhard.meyer@emk-elektronik.de
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-/*
- * Note: RAMTRON SPI FRAMs are ferroelectric, nonvolatile RAMs
- * with an interface identical to SPI flash devices.
- * However since they behave like RAM there are no delays or
- * busy polls required. They can sustain read or write at the
- * allowed SPI bus speed, which can be 40 MHz for some devices.
- *
- * Unfortunately some RAMTRON devices do not have a means of
- * identifying them. They will leave the SO line undriven when
- * the READ-ID command is issued. It is therefore mandatory
- * that the MISO line has a proper pull-up, so that READ-ID
- * will return a row of 0xff. This 0xff pseudo-id will cause
- * probes by all vendor specific functions that are designed
- * to handle it. If the MISO line is not pulled up, READ-ID
- * could return any random noise, even mimicking another
- * device.
- *
- * We use CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC
- * to define which device will be assumed after a simple status
- * register verify. This method is prone to false positive
- * detection and should therefore be the last to be tried.
- * Enter it in the last position in the table in spi_flash.c!
- *
- * The define CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC both activates
- * compilation of the special handler and defines the device
- * to assume.
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <spi_flash.h>
-#include "spi_flash_internal.h"
-
-/*
- * Properties of supported FRAMs
- * Note: speed is currently not used because we have no method to deliver that
- * value to the upper layers
- */
-struct ramtron_spi_fram_params {
-	u32	size;		/* size in bytes */
-	u8	addr_len;	/* number of address bytes */
-	u8	merge_cmd;	/* some address bits are in the command byte */
-	u8	id1;		/* device ID 1 (family, density) */
-	u8	id2;		/* device ID 2 (sub, rev, rsvd) */
-	u32	speed;		/* max. SPI clock in Hz */
-	const char *name;	/* name for display and/or matching */
-};
-
-struct ramtron_spi_fram {
-	struct spi_flash flash;
-	const struct ramtron_spi_fram_params *params;
-};
-
-static inline struct ramtron_spi_fram *to_ramtron_spi_fram(struct spi_flash
-							     *flash)
-{
-	return container_of(flash, struct ramtron_spi_fram, flash);
-}
-
-/*
- * table describing supported FRAM chips:
- * chips without RDID command must have the values 0xff for id1 and id2
- */
-static const struct ramtron_spi_fram_params ramtron_spi_fram_table[] = {
-	{
-		.size = 32*1024,
-		.addr_len = 2,
-		.merge_cmd = 0,
-		.id1 = 0x22,
-		.id2 = 0x00,
-		.speed = 40000000,
-		.name = "FM25V02",
-	},
-	{
-		.size = 32*1024,
-		.addr_len = 2,
-		.merge_cmd = 0,
-		.id1 = 0x22,
-		.id2 = 0x01,
-		.speed = 40000000,
-		.name = "FM25VN02",
-	},
-	{
-		.size = 64*1024,
-		.addr_len = 2,
-		.merge_cmd = 0,
-		.id1 = 0x23,
-		.id2 = 0x00,
-		.speed = 40000000,
-		.name = "FM25V05",
-	},
-	{
-		.size = 64*1024,
-		.addr_len = 2,
-		.merge_cmd = 0,
-		.id1 = 0x23,
-		.id2 = 0x01,
-		.speed = 40000000,
-		.name = "FM25VN05",
-	},
-	{
-		.size = 128*1024,
-		.addr_len = 3,
-		.merge_cmd = 0,
-		.id1 = 0x24,
-		.id2 = 0x00,
-		.speed = 40000000,
-		.name = "FM25V10",
-	},
-	{
-		.size = 128*1024,
-		.addr_len = 3,
-		.merge_cmd = 0,
-		.id1 = 0x24,
-		.id2 = 0x01,
-		.speed = 40000000,
-		.name = "FM25VN10",
-	},
-#ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC
-	{
-		.size = 256*1024,
-		.addr_len = 3,
-		.merge_cmd = 0,
-		.id1 = 0xff,
-		.id2 = 0xff,
-		.speed = 40000000,
-		.name = "FM25H20",
-	},
-#endif
-};
-
-static int ramtron_common(struct spi_flash *flash,
-		u32 offset, size_t len, void *buf, u8 command)
-{
-	struct ramtron_spi_fram *sn = to_ramtron_spi_fram(flash);
-	u8 cmd[4];
-	int cmd_len;
-	int ret;
-
-	if (sn->params->addr_len == 3 && sn->params->merge_cmd == 0) {
-		cmd[0] = command;
-		cmd[1] = offset >> 16;
-		cmd[2] = offset >> 8;
-		cmd[3] = offset;
-		cmd_len = 4;
-	} else if (sn->params->addr_len == 2 && sn->params->merge_cmd == 0) {
-		cmd[0] = command;
-		cmd[1] = offset >> 8;
-		cmd[2] = offset;
-		cmd_len = 3;
-	} else {
-		printf("SF: unsupported addr_len or merge_cmd\n");
-		return -1;
-	}
-
-	/* claim the bus */
-	ret = spi_claim_bus(flash->spi);
-	if (ret) {
-		debug("SF: Unable to claim SPI bus\n");
-		return ret;
-	}
-
-	if (command == CMD_PAGE_PROGRAM) {
-		/* send WREN */
-		ret = spi_flash_cmd_write_enable(flash);
-		if (ret < 0) {
-			debug("SF: Enabling Write failed\n");
-			goto releasebus;
-		}
-	}
-
-	/* do the transaction */
-	if (command == CMD_PAGE_PROGRAM)
-		ret = spi_flash_cmd_write(flash->spi, cmd, cmd_len, buf, len);
-	else
-		ret = spi_flash_cmd_read(flash->spi, cmd, cmd_len, buf, len);
-	if (ret < 0)
-		debug("SF: Transaction failed\n");
-
-releasebus:
-	/* release the bus */
-	spi_release_bus(flash->spi);
-	return ret;
-}
-
-static int ramtron_read(struct spi_flash *flash,
-		u32 offset, size_t len, void *buf)
-{
-	return ramtron_common(flash, offset, len, buf,
-		CMD_READ_ARRAY_SLOW);
-}
-
-static int ramtron_write(struct spi_flash *flash,
-		u32 offset, size_t len, const void *buf)
-{
-	return ramtron_common(flash, offset, len, (void *)buf,
-		CMD_PAGE_PROGRAM);
-}
-
-static int ramtron_erase(struct spi_flash *flash, u32 offset, size_t len)
-{
-	debug("SF: Erase of RAMTRON FRAMs is pointless\n");
-	return -1;
-}
-
-/*
- * nore: we are called here with idcode pointing to the first non-0x7f byte
- * already!
- */
-static struct spi_flash *spi_fram_probe_ramtron(struct spi_slave *spi,
-		u8 *idcode)
-{
-	const struct ramtron_spi_fram_params *params;
-	struct ramtron_spi_fram *sn;
-	unsigned int i;
-#ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC
-	int ret;
-	u8 sr;
-#endif
-
-	/* NOTE: the bus has been claimed before this function is called! */
-	switch (idcode[0]) {
-	case 0xc2:
-		/* JEDEC conformant RAMTRON id */
-		for (i = 0; i < ARRAY_SIZE(ramtron_spi_fram_table); i++) {
-			params = &ramtron_spi_fram_table[i];
-			if (idcode[1] == params->id1 &&
-			    idcode[2] == params->id2)
-				goto found;
-		}
-		break;
-#ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC
-	case 0xff:
-		/*
-		 * probably open MISO line, pulled up.
-		 * We COULD have a non JEDEC conformant FRAM here,
-		 * read the status register to verify
-		 */
-		ret = spi_flash_cmd(spi, CMD_READ_STATUS, &sr, 1);
-		if (ret)
-			return NULL;
-
-		/* Bits 5,4,0 are fixed 0 for all devices */
-		if ((sr & 0x31) != 0x00)
-			return NULL;
-		/* now find the device */
-		for (i = 0; i < ARRAY_SIZE(ramtron_spi_fram_table); i++) {
-			params = &ramtron_spi_fram_table[i];
-			if (!strcmp(params->name,
-				    CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC))
-				goto found;
-		}
-		debug("SF: Unsupported non-JEDEC RAMTRON device "
-			CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC "\n");
-		break;
-#endif
-	default:
-		break;
-	}
-
-	/* arriving here means no method has found a device we can handle */
-	debug("SF/ramtron: unsupported device id0=%02x id1=%02x id2=%02x\n",
-	      idcode[0], idcode[1], idcode[2]);
-	return NULL;
-
-found:
-	sn = malloc(sizeof(*sn));
-	if (!sn) {
-		debug("SF: Failed to allocate memory\n");
-		return NULL;
-	}
-
-	sn->params = params;
-
-	sn->flash.write = ramtron_write;
-	sn->flash.read = ramtron_read;
-	sn->flash.erase = ramtron_erase;
-	sn->flash.size = params->size;
-
-	return &sn->flash;
-}
-
-/*
- * The following table holds all device probe functions
- * (All flashes are removed and implemented a common probe at
- *  spi_flash_probe.c)
- *
- * shift:  number of continuation bytes before the ID
- * idcode: the expected IDCODE or 0xff for non JEDEC devices
- * probe:  the function to call
- *
- * Non JEDEC devices should be ordered in the table such that
- * the probe functions with best detection algorithms come first.
- *
- * Several matching entries are permitted, they will be tried
- * in sequence until a probe function returns non NULL.
- *
- * IDCODE_CONT_LEN may be redefined if a device needs to declare a
- * larger "shift" value.  IDCODE_PART_LEN generally shouldn't be
- * changed.  This is the max number of bytes probe functions may
- * examine when looking up part-specific identification info.
- *
- * Probe functions will be given the idcode buffer starting at their
- * manu id byte (the "idcode" in the table below).  In other words,
- * all of the continuation bytes will be skipped (the "shift" below).
- */
-#define IDCODE_CONT_LEN 0
-#define IDCODE_PART_LEN 5
-static const struct {
-	const u8 shift;
-	const u8 idcode;
-	struct spi_flash *(*probe) (struct spi_slave *spi, u8 *idcode);
-} flashes[] = {
-	/* Keep it sorted by define name */
-#ifdef CONFIG_SPI_FRAM_RAMTRON
-	{ 6, 0xc2, spi_fram_probe_ramtron, },
-# undef IDCODE_CONT_LEN
-# define IDCODE_CONT_LEN 6
-#endif
-#ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC
-	{ 0, 0xff, spi_fram_probe_ramtron, },
-#endif
-};
-#define IDCODE_LEN (IDCODE_CONT_LEN + IDCODE_PART_LEN)
-
-struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
-		unsigned int max_hz, unsigned int spi_mode)
-{
-	struct spi_slave *spi;
-	struct spi_flash *flash = NULL;
-	int ret, i, shift;
-	u8 idcode[IDCODE_LEN], *idp;
-
-	spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
-	if (!spi) {
-		printf("SF: Failed to set up slave\n");
-		return NULL;
-	}
-
-	ret = spi_claim_bus(spi);
-	if (ret) {
-		debug("SF: Failed to claim SPI bus: %d\n", ret);
-		goto err_claim_bus;
-	}
-
-	/* Read the ID codes */
-	ret = spi_flash_cmd(spi, CMD_READ_ID, idcode, sizeof(idcode));
-	if (ret)
-		goto err_read_id;
-
-#ifdef DEBUG
-	printf("SF: Got idcodes\n");
-	print_buffer(0, idcode, 1, sizeof(idcode), 0);
-#endif
-
-	/* count the number of continuation bytes */
-	for (shift = 0, idp = idcode;
-	     shift < IDCODE_CONT_LEN && *idp == 0x7f;
-	     ++shift, ++idp)
-		continue;
-
-	/* search the table for matches in shift and id */
-	for (i = 0; i < ARRAY_SIZE(flashes); ++i)
-		if (flashes[i].shift == shift && flashes[i].idcode == *idp) {
-			/* we have a match, call probe */
-			flash = flashes[i].probe(spi, idp);
-			if (flash)
-				break;
-		}
-
-	if (!flash) {
-		printf("SF: Unsupported manufacturer %02x\n", *idp);
-		goto err_manufacturer_probe;
-	}
-
-	printf("SF: Detected %s with page size ", flash->name);
-	print_size(flash->sector_size, ", total ");
-	print_size(flash->size, "");
-	if (flash->memory_map)
-		printf(", mapped at %p", flash->memory_map);
-	puts("\n");
-
-	spi_release_bus(spi);
-
-	return flash;
-
-err_manufacturer_probe:
-err_read_id:
-	spi_release_bus(spi);
-err_claim_bus:
-	spi_free_slave(spi);
-	return NULL;
-}
-
-void spi_flash_free(struct spi_flash *flash)
-{
-	spi_free_slave(flash->spi);
-	free(flash);
-}
diff --git a/drivers/mtd/spi/spansion.c b/drivers/mtd/spi/spansion.c
deleted file mode 100644
index fa7ac8c..0000000
--- a/drivers/mtd/spi/spansion.c
+++ /dev/null
@@ -1,141 +0,0 @@ 
-/*
- * Copyright (C) 2009 Freescale Semiconductor, Inc.
- *
- * Author: Mingkai Hu (Mingkai.hu@freescale.com)
- * Based on stmicro.c by Wolfgang Denk (wd@denx.de),
- * TsiChung Liew (Tsi-Chung.Liew@freescale.com),
- * and  Jason McMullan (mcmullan@netapp.com)
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <spi_flash.h>
-
-#include "spi_flash_internal.h"
-
-struct spansion_spi_flash_params {
-	u16 idcode1;
-	u16 idcode2;
-	u16 pages_per_sector;
-	u16 nr_sectors;
-	const char *name;
-};
-
-static const struct spansion_spi_flash_params spansion_spi_flash_table[] = {
-	{
-		.idcode1 = 0x0213,
-		.idcode2 = 0,
-		.pages_per_sector = 256,
-		.nr_sectors = 16,
-		.name = "S25FL008A",
-	},
-	{
-		.idcode1 = 0x0214,
-		.idcode2 = 0,
-		.pages_per_sector = 256,
-		.nr_sectors = 32,
-		.name = "S25FL016A",
-	},
-	{
-		.idcode1 = 0x0215,
-		.idcode2 = 0,
-		.pages_per_sector = 256,
-		.nr_sectors = 64,
-		.name = "S25FL032A",
-	},
-	{
-		.idcode1 = 0x0216,
-		.idcode2 = 0,
-		.pages_per_sector = 256,
-		.nr_sectors = 128,
-		.name = "S25FL064A",
-	},
-	{
-		.idcode1 = 0x2018,
-		.idcode2 = 0x0301,
-		.pages_per_sector = 256,
-		.nr_sectors = 256,
-		.name = "S25FL128P_64K",
-	},
-	{
-		.idcode1 = 0x2018,
-		.idcode2 = 0x0300,
-		.pages_per_sector = 1024,
-		.nr_sectors = 64,
-		.name = "S25FL128P_256K",
-	},
-	{
-		.idcode1 = 0x0215,
-		.idcode2 = 0x4d00,
-		.pages_per_sector = 256,
-		.nr_sectors = 64,
-		.name = "S25FL032P",
-	},
-	{
-		.idcode1 = 0x0216,
-		.idcode2 = 0x4d00,
-		.pages_per_sector = 256,
-		.nr_sectors = 128,
-		.name = "S25FL064P",
-	},
-	{
-		.idcode1 = 0x2018,
-		.idcode2 = 0x4d01,
-		.pages_per_sector = 256,
-		.nr_sectors = 256,
-		.name = "S25FL129P_64K/S25FL128S_64K",
-	},
-	{
-		.idcode1 = 0x0219,
-		.idcode2 = 0x4d01,
-		.pages_per_sector = 256,
-		.nr_sectors = 512,
-		.name = "S25FL256S_64K",
-	},
-	{
-		.idcode1 = 0x0220,
-		.idcode2 = 0x4d01,
-		.pages_per_sector = 256,
-		.nr_sectors = 1024,
-		.name = "S25FL512S_64K",
-	},
-};
-
-struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)
-{
-	const struct spansion_spi_flash_params *params;
-	struct spi_flash *flash;
-	unsigned int i;
-	unsigned short jedec, ext_jedec;
-
-	jedec = idcode[1] << 8 | idcode[2];
-	ext_jedec = idcode[3] << 8 | idcode[4];
-
-	for (i = 0; i < ARRAY_SIZE(spansion_spi_flash_table); i++) {
-		params = &spansion_spi_flash_table[i];
-		if (params->idcode1 == jedec) {
-			if (params->idcode2 == ext_jedec)
-				break;
-		}
-	}
-
-	if (i == ARRAY_SIZE(spansion_spi_flash_table)) {
-		debug("SF: Unsupported SPANSION ID %04x %04x\n",
-		      jedec, ext_jedec);
-		return NULL;
-	}
-
-	flash = spi_flash_alloc_base(spi, params->name);
-	if (!flash) {
-		debug("SF: Failed to allocate memory\n");
-		return NULL;
-	}
-
-	flash->page_size = 256;
-	flash->sector_size = 256 * params->pages_per_sector;
-	flash->size = flash->sector_size * params->nr_sectors;
-
-	return flash;
-}
diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h
index a9d03ee..286082a 100644
--- a/drivers/mtd/spi/spi_flash_internal.h
+++ b/drivers/mtd/spi/spi_flash_internal.h
@@ -127,13 +127,3 @@  int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout);
 
 /* Erase sectors. */
 int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len);
-
-/* Manufacturer-specific probe functions */
-struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode);
-struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode);
-struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode);
-struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode);
-struct spi_flash *spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode);
-struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 *idcode);
-struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode);
-struct spi_flash *spi_flash_probe_gigadevice(struct spi_slave *spi, u8 *idcode);
diff --git a/drivers/mtd/spi/sst.c b/drivers/mtd/spi/sst.c
deleted file mode 100644
index c9dec3c52..0000000
--- a/drivers/mtd/spi/sst.c
+++ /dev/null
@@ -1,232 +0,0 @@ 
-/*
- * Driver for SST serial flashes
- *
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- * Copyright 2008, Network Appliance Inc.
- * Jason McMullan <mcmullan@netapp.com>
- * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
- * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
- * Copyright (c) 2008-2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <spi_flash.h>
-
-#include "spi_flash_internal.h"
-
-#define CMD_SST_BP		0x02	/* Byte Program */
-#define CMD_SST_AAI_WP		0xAD	/* Auto Address Incr Word Program */
-
-#define SST_SR_WIP		(1 << 0)	/* Write-in-Progress */
-#define SST_SR_WEL		(1 << 1)	/* Write enable */
-#define SST_SR_BP0		(1 << 2)	/* Block Protection 0 */
-#define SST_SR_BP1		(1 << 3)	/* Block Protection 1 */
-#define SST_SR_BP2		(1 << 4)	/* Block Protection 2 */
-#define SST_SR_AAI		(1 << 6)	/* Addressing mode */
-#define SST_SR_BPL		(1 << 7)	/* BP bits lock */
-
-#define SST_FEAT_WP		(1 << 0)	/* Supports AAI word program */
-#define SST_FEAT_MBP		(1 << 1)	/* Supports multibyte program */
-
-struct sst_spi_flash_params {
-	u8 idcode1;
-	u8 flags;
-	u16 nr_sectors;
-	const char *name;
-};
-
-struct sst_spi_flash {
-	struct spi_flash flash;
-	const struct sst_spi_flash_params *params;
-};
-
-static const struct sst_spi_flash_params sst_spi_flash_table[] = {
-	{
-		.idcode1 = 0x8d,
-		.flags = SST_FEAT_WP,
-		.nr_sectors = 128,
-		.name = "SST25VF040B",
-	},
-	{
-		.idcode1 = 0x8e,
-		.flags = SST_FEAT_WP,
-		.nr_sectors = 256,
-		.name = "SST25VF080B",
-	},
-	{
-		.idcode1 = 0x41,
-		.flags = SST_FEAT_WP,
-		.nr_sectors = 512,
-		.name = "SST25VF016B",
-	},
-	{
-		.idcode1 = 0x4a,
-		.flags = SST_FEAT_WP,
-		.nr_sectors = 1024,
-		.name = "SST25VF032B",
-	},
-	{
-		.idcode1 = 0x4b,
-		.flags = SST_FEAT_MBP,
-		.nr_sectors = 2048,
-		.name = "SST25VF064C",
-	},
-	{
-		.idcode1 = 0x01,
-		.flags = SST_FEAT_WP,
-		.nr_sectors = 16,
-		.name = "SST25WF512",
-	},
-	{
-		.idcode1 = 0x02,
-		.flags = SST_FEAT_WP,
-		.nr_sectors = 32,
-		.name = "SST25WF010",
-	},
-	{
-		.idcode1 = 0x03,
-		.flags = SST_FEAT_WP,
-		.nr_sectors = 64,
-		.name = "SST25WF020",
-	},
-	{
-		.idcode1 = 0x04,
-		.flags = SST_FEAT_WP,
-		.nr_sectors = 128,
-		.name = "SST25WF040",
-	},
-};
-
-static int
-sst_byte_write(struct spi_flash *flash, u32 offset, const void *buf)
-{
-	int ret;
-	u8 cmd[4] = {
-		CMD_SST_BP,
-		offset >> 16,
-		offset >> 8,
-		offset,
-	};
-
-	debug("BP[%02x]: 0x%p => cmd = { 0x%02x 0x%06x }\n",
-	      spi_w8r8(flash->spi, CMD_READ_STATUS), buf, cmd[0], offset);
-
-	ret = spi_flash_cmd_write_enable(flash);
-	if (ret)
-		return ret;
-
-	ret = spi_flash_cmd_write(flash->spi, cmd, sizeof(cmd), buf, 1);
-	if (ret)
-		return ret;
-
-	return spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
-}
-
-static int
-sst_write_wp(struct spi_flash *flash, u32 offset, size_t len, const void *buf)
-{
-	size_t actual, cmd_len;
-	int ret;
-	u8 cmd[4];
-
-	ret = spi_claim_bus(flash->spi);
-	if (ret) {
-		debug("SF: Unable to claim SPI bus\n");
-		return ret;
-	}
-
-	/* If the data is not word aligned, write out leading single byte */
-	actual = offset % 2;
-	if (actual) {
-		ret = sst_byte_write(flash, offset, buf);
-		if (ret)
-			goto done;
-	}
-	offset += actual;
-
-	ret = spi_flash_cmd_write_enable(flash);
-	if (ret)
-		goto done;
-
-	cmd_len = 4;
-	cmd[0] = CMD_SST_AAI_WP;
-	cmd[1] = offset >> 16;
-	cmd[2] = offset >> 8;
-	cmd[3] = offset;
-
-	for (; actual < len - 1; actual += 2) {
-		debug("WP[%02x]: 0x%p => cmd = { 0x%02x 0x%06x }\n",
-		      spi_w8r8(flash->spi, CMD_READ_STATUS), buf + actual,
-		      cmd[0], offset);
-
-		ret = spi_flash_cmd_write(flash->spi, cmd, cmd_len,
-					buf + actual, 2);
-		if (ret) {
-			debug("SF: sst word program failed\n");
-			break;
-		}
-
-		ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT);
-		if (ret)
-			break;
-
-		cmd_len = 1;
-		offset += 2;
-	}
-
-	if (!ret)
-		ret = spi_flash_cmd_write_disable(flash);
-
-	/* If there is a single trailing byte, write it out */
-	if (!ret && actual != len)
-		ret = sst_byte_write(flash, offset, buf + actual);
-
- done:
-	debug("SF: sst: program %s %zu bytes @ 0x%zx\n",
-	      ret ? "failure" : "success", len, offset - actual);
-
-	spi_release_bus(flash->spi);
-	return ret;
-}
-
-struct spi_flash *
-spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode)
-{
-	const struct sst_spi_flash_params *params;
-	struct sst_spi_flash *stm;
-	size_t i;
-
-	for (i = 0; i < ARRAY_SIZE(sst_spi_flash_table); ++i) {
-		params = &sst_spi_flash_table[i];
-		if (params->idcode1 == idcode[2])
-			break;
-	}
-
-	if (i == ARRAY_SIZE(sst_spi_flash_table)) {
-		debug("SF: Unsupported SST ID %02x\n", idcode[1]);
-		return NULL;
-	}
-
-	stm = spi_flash_alloc(struct sst_spi_flash, spi, params->name);
-	if (!stm) {
-		debug("SF: Failed to allocate memory\n");
-		return NULL;
-	}
-
-	stm->params = params;
-
-	if (stm->params->flags & SST_FEAT_WP)
-		stm->flash.write = sst_write_wp;
-	stm->flash.page_size = 256;
-	stm->flash.sector_size = 4096;
-	stm->flash.size = stm->flash.sector_size * params->nr_sectors;
-
-	/* Flash powers up read-only, so clear BP# bits */
-	spi_flash_cmd_write_status(&stm->flash, 0);
-
-	return &stm->flash;
-}
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
deleted file mode 100644
index c5fa64e..0000000
--- a/drivers/mtd/spi/stmicro.c
+++ /dev/null
@@ -1,202 +0,0 @@ 
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * Copyright 2008, Network Appliance Inc.
- * Jason McMullan <mcmullan@netapp.com>
- *
- * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
- * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <spi_flash.h>
-
-#include "spi_flash_internal.h"
-
-/* M25Pxx-specific commands */
-#define CMD_M25PXX_RES	0xab	/* Release from DP, and Read Signature */
-
-struct stmicro_spi_flash_params {
-	u16 id;
-	u16 pages_per_sector;
-	u16 nr_sectors;
-	const char *name;
-};
-
-static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = {
-	{
-		.id = 0x2011,
-		.pages_per_sector = 128,
-		.nr_sectors = 4,
-		.name = "M25P10",
-	},
-	{
-		.id = 0x2015,
-		.pages_per_sector = 256,
-		.nr_sectors = 32,
-		.name = "M25P16",
-	},
-	{
-		.id = 0x2012,
-		.pages_per_sector = 256,
-		.nr_sectors = 4,
-		.name = "M25P20",
-	},
-	{
-		.id = 0x2016,
-		.pages_per_sector = 256,
-		.nr_sectors = 64,
-		.name = "M25P32",
-	},
-	{
-		.id = 0x2013,
-		.pages_per_sector = 256,
-		.nr_sectors = 8,
-		.name = "M25P40",
-	},
-	{
-		.id = 0x2017,
-		.pages_per_sector = 256,
-		.nr_sectors = 128,
-		.name = "M25P64",
-	},
-	{
-		.id = 0x2014,
-		.pages_per_sector = 256,
-		.nr_sectors = 16,
-		.name = "M25P80",
-	},
-	{
-		.id = 0x2018,
-		.pages_per_sector = 1024,
-		.nr_sectors = 64,
-		.name = "M25P128",
-	},
-	{
-		.id = 0xba16,
-		.pages_per_sector = 256,
-		.nr_sectors = 64,
-		.name = "N25Q32",
-	},
-	{
-		.id = 0xbb16,
-		.pages_per_sector = 256,
-		.nr_sectors = 64,
-		.name = "N25Q32A",
-	},
-	{
-		.id = 0xba17,
-		.pages_per_sector = 256,
-		.nr_sectors = 128,
-		.name = "N25Q064",
-	},
-	{
-		.id = 0xbb17,
-		.pages_per_sector = 256,
-		.nr_sectors = 128,
-		.name = "N25Q64A",
-	},
-	{
-		.id = 0xba18,
-		.pages_per_sector = 256,
-		.nr_sectors = 256,
-		.name = "N25Q128",
-	},
-	{
-		.id = 0xbb18,
-		.pages_per_sector = 256,
-		.nr_sectors = 256,
-		.name = "N25Q128A",
-	},
-	{
-		.id = 0xba19,
-		.pages_per_sector = 256,
-		.nr_sectors = 512,
-		.name = "N25Q256",
-	},
-	{
-		.id = 0xbb19,
-		.pages_per_sector = 256,
-		.nr_sectors = 512,
-		.name = "N25Q256A",
-	},
-	{
-		.id = 0xba20,
-		.pages_per_sector = 256,
-		.nr_sectors = 1024,
-		.name = "N25Q512",
-	},
-	{
-		.id = 0xbb20,
-		.pages_per_sector = 256,
-		.nr_sectors = 1024,
-		.name = "N25Q512A",
-	},
-	{
-		.id = 0xba21,
-		.pages_per_sector = 256,
-		.nr_sectors = 2048,
-		.name = "N25Q1024",
-	},
-	{
-		.id = 0xbb21,
-		.pages_per_sector = 256,
-		.nr_sectors = 2048,
-		.name = "N25Q1024A",
-	},
-};
-
-struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 *idcode)
-{
-	const struct stmicro_spi_flash_params *params;
-	struct spi_flash *flash;
-	unsigned int i;
-	u16 id;
-
-	if (idcode[0] == 0xff) {
-		i = spi_flash_cmd(spi, CMD_M25PXX_RES,
-				  idcode, 4);
-		if (i)
-			return NULL;
-		if ((idcode[3] & 0xf0) == 0x10) {
-			idcode[0] = 0x20;
-			idcode[1] = 0x20;
-			idcode[2] = idcode[3] + 1;
-		} else {
-			return NULL;
-		}
-	}
-
-	id = ((idcode[1] << 8) | idcode[2]);
-
-	for (i = 0; i < ARRAY_SIZE(stmicro_spi_flash_table); i++) {
-		params = &stmicro_spi_flash_table[i];
-		if (params->id == id)
-			break;
-	}
-
-	if (i == ARRAY_SIZE(stmicro_spi_flash_table)) {
-		debug("SF: Unsupported STMicro ID %04x\n", id);
-		return NULL;
-	}
-
-	flash = spi_flash_alloc_base(spi, params->name);
-	if (!flash) {
-		debug("SF: Failed to allocate memory\n");
-		return NULL;
-	}
-
-	flash->page_size = 256;
-	flash->sector_size = 256 * params->pages_per_sector;
-	flash->size = flash->sector_size * params->nr_sectors;
-
-	/* for >= 512MiB flashes, use flag status instead of read_status */
-	if (flash->size >= 0x4000000)
-		flash->poll_cmd = CMD_FLAG_STATUS;
-
-	return flash;
-}
diff --git a/drivers/mtd/spi/winbond.c b/drivers/mtd/spi/winbond.c
deleted file mode 100644
index b31911a..0000000
--- a/drivers/mtd/spi/winbond.c
+++ /dev/null
@@ -1,141 +0,0 @@ 
-/*
- * Copyright 2008, Network Appliance Inc.
- * Author: Jason McMullan <mcmullan <at> netapp.com>
- * Licensed under the GPL-2 or later.
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <spi_flash.h>
-
-#include "spi_flash_internal.h"
-
-struct winbond_spi_flash_params {
-	uint16_t	id;
-	uint16_t	nr_blocks;
-	const char	*name;
-};
-
-static const struct winbond_spi_flash_params winbond_spi_flash_table[] = {
-	{
-		.id			= 0x2014,
-		.nr_blocks		= 16,
-		.name			= "W25P80",
-	},
-	{
-		.id			= 0x2015,
-		.nr_blocks		= 32,
-		.name			= "W25P16",
-	},
-	{
-		.id			= 0x2016,
-		.nr_blocks		= 64,
-		.name			= "W25P32",
-	},
-	{
-		.id			= 0x3013,
-		.nr_blocks		= 8,
-		.name			= "W25X40",
-	},
-	{
-		.id			= 0x3015,
-		.nr_blocks		= 32,
-		.name			= "W25X16",
-	},
-	{
-		.id			= 0x3016,
-		.nr_blocks		= 64,
-		.name			= "W25X32",
-	},
-	{
-		.id			= 0x3017,
-		.nr_blocks		= 128,
-		.name			= "W25X64",
-	},
-	{
-		.id			= 0x4014,
-		.nr_blocks		= 16,
-		.name			= "W25Q80BL/W25Q80BV",
-	},
-	{
-		.id			= 0x4015,
-		.nr_blocks		= 32,
-		.name			= "W25Q16CL/W25Q16DV",
-	},
-	{
-		.id			= 0x4016,
-		.nr_blocks		= 64,
-		.name			= "W25Q32BV/W25Q32FV_SPI",
-	},
-	{
-		.id			= 0x4017,
-		.nr_blocks		= 128,
-		.name			= "W25Q64CV/W25Q64FV_SPI",
-	},
-	{
-		.id			= 0x4018,
-		.nr_blocks		= 256,
-		.name			= "W25Q128BV/W25Q128FV_SPI",
-	},
-	{
-		.id			= 0x4019,
-		.nr_blocks		= 512,
-		.name			= "W25Q256",
-	},
-	{
-		.id			= 0x5014,
-		.nr_blocks		= 16,
-		.name			= "W25Q80BW",
-	},
-	{
-		.id			= 0x6015,
-		.nr_blocks		= 32,
-		.name			= "W25Q16DW",
-	},
-	{
-		.id			= 0x6016,
-		.nr_blocks		= 64,
-		.name			= "W25Q32DW/W25Q32FV_QPI",
-	},
-	{
-		.id			= 0x6017,
-		.nr_blocks		= 128,
-		.name			= "W25Q64DW/W25Q64FV_QPI",
-	},
-	{
-		.id			= 0x6018,
-		.nr_blocks		= 256,
-		.name			= "W25Q128FW/W25Q128FV_QPI",
-	},
-};
-
-struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
-{
-	const struct winbond_spi_flash_params *params;
-	struct spi_flash *flash;
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(winbond_spi_flash_table); i++) {
-		params = &winbond_spi_flash_table[i];
-		if (params->id == ((idcode[1] << 8) | idcode[2]))
-			break;
-	}
-
-	if (i == ARRAY_SIZE(winbond_spi_flash_table)) {
-		debug("SF: Unsupported Winbond ID %02x%02x\n",
-		      idcode[1], idcode[2]);
-		return NULL;
-	}
-
-	flash = spi_flash_alloc_base(spi, params->name);
-	if (!flash) {
-		debug("SF: Failed to allocate memory\n");
-		return NULL;
-	}
-
-	flash->page_size = 256;
-	flash->sector_size = (idcode[1] == 0x20) ? 65536 : 4096;
-	flash->size = 4096 * 16 * params->nr_blocks;
-
-	return flash;
-}