public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jagan Teki <jteki@openedev.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/8] sf: Drop SPI_FLASH_MTD driver
Date: Tue, 13 Oct 2015 01:24:14 +0530	[thread overview]
Message-ID: <1444679655-30349-7-git-send-email-jteki@openedev.com> (raw)
In-Reply-To: <1444679655-30349-1-git-send-email-jteki@openedev.com>

Now MTD core has been added as part of spi-flash layer,
so there is no need for explicit driver for handling
mtd stuff, hence removed all neccessary code regarding
SPI_FLASH_MTD driver.

Signed-off-by: Jagan Teki <jteki@openedev.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Heiko Schocher <hs@denx.de>
---
 drivers/mtd/spi/Kconfig       |  12 -----
 drivers/mtd/spi/Makefile      |   1 -
 drivers/mtd/spi/sf_internal.h |   5 --
 drivers/mtd/spi/sf_mtd.c      | 104 ------------------------------------------
 4 files changed, 122 deletions(-)
 delete mode 100644 drivers/mtd/spi/sf_mtd.c

diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
index 3f7433c..78932a4 100644
--- a/drivers/mtd/spi/Kconfig
+++ b/drivers/mtd/spi/Kconfig
@@ -116,16 +116,4 @@ config SPI_FLASH_DATAFLASH
 
 	  If unsure, say N
 
-config SPI_FLASH_MTD
-	bool "SPI Flash MTD support"
-	depends on SPI_FLASH
-	help
-          Enable the MTD support for spi flash layer, this adapter is for
-	  translating mtd_read/mtd_write commands into spi_flash_read/write
-	  commands. It is not intended to use it within sf_cmd or the SPI
-	  flash subsystem. Such an adapter is needed for subsystems like
-	  UBI which can only operate on top of the MTD layer.
-
-	  If unsure, say N
-
 endmenu # menu "SPI Flash Support"
diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile
index 66c4424..1824261 100644
--- a/drivers/mtd/spi/Makefile
+++ b/drivers/mtd/spi/Makefile
@@ -14,6 +14,5 @@ endif
 
 obj-$(CONFIG_SPI_FLASH) += sf_probe.o sf_ops.o sf_params.o sf.o
 obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o
-obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o
 obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o
 obj-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o
diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index d74bc18..84afddf 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -191,11 +191,6 @@ int spi_flash_write_common(struct spi_flash *flash, const u8 *cmd,
 int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,
 		size_t cmd_len, void *data, size_t data_len);
 
-#ifdef CONFIG_SPI_FLASH_MTD
-int spi_flash_mtd_register(struct spi_flash *flash);
-void spi_flash_mtd_unregister(void);
-#endif
-
 /**
  * spi_flash_scan - scan the SPI FLASH
  * @flash:	the spi flash structure
diff --git a/drivers/mtd/spi/sf_mtd.c b/drivers/mtd/spi/sf_mtd.c
deleted file mode 100644
index 0b9cb62..0000000
--- a/drivers/mtd/spi/sf_mtd.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2012-2014 Daniel Schwierzeck, daniel.schwierzeck at gmail.com
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <malloc.h>
-#include <asm/errno.h>
-#include <linux/mtd/mtd.h>
-#include <spi_flash.h>
-
-static struct mtd_info sf_mtd_info;
-static char sf_mtd_name[8];
-
-static int spi_flash_mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
-{
-	struct spi_flash *flash = mtd->priv;
-	int err;
-
-	instr->state = MTD_ERASING;
-
-	err = spi_flash_erase(flash, instr->addr, instr->len);
-	if (err) {
-		instr->state = MTD_ERASE_FAILED;
-		instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
-		return -EIO;
-	}
-
-	instr->state = MTD_ERASE_DONE;
-	mtd_erase_callback(instr);
-
-	return 0;
-}
-
-static int spi_flash_mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
-	size_t *retlen, u_char *buf)
-{
-	struct spi_flash *flash = mtd->priv;
-	int err;
-
-	err = spi_flash_read(flash, from, len, buf);
-	if (!err)
-		*retlen = len;
-
-	return err;
-}
-
-static int spi_flash_mtd_write(struct mtd_info *mtd, loff_t to, size_t len,
-	size_t *retlen, const u_char *buf)
-{
-	struct spi_flash *flash = mtd->priv;
-	int err;
-
-	err = spi_flash_write(flash, to, len, buf);
-	if (!err)
-		*retlen = len;
-
-	return err;
-}
-
-static void spi_flash_mtd_sync(struct mtd_info *mtd)
-{
-}
-
-static int spi_flash_mtd_number(void)
-{
-#ifdef CONFIG_SYS_MAX_FLASH_BANKS
-	return CONFIG_SYS_MAX_FLASH_BANKS;
-#else
-	return 0;
-#endif
-}
-
-int spi_flash_mtd_register(struct spi_flash *flash)
-{
-	memset(&sf_mtd_info, 0, sizeof(sf_mtd_info));
-	sprintf(sf_mtd_name, "nor%d", spi_flash_mtd_number());
-
-	sf_mtd_info.name = sf_mtd_name;
-	sf_mtd_info.type = MTD_NORFLASH;
-	sf_mtd_info.flags = MTD_CAP_NORFLASH;
-	sf_mtd_info.writesize = 1;
-	sf_mtd_info.writebufsize = flash->page_size;
-
-	sf_mtd_info._erase = spi_flash_mtd_erase;
-	sf_mtd_info._read = spi_flash_mtd_read;
-	sf_mtd_info._write = spi_flash_mtd_write;
-	sf_mtd_info._sync = spi_flash_mtd_sync;
-
-	sf_mtd_info.size = flash->size;
-	sf_mtd_info.priv = flash;
-
-	/* Only uniform flash devices for now */
-	sf_mtd_info.numeraseregions = 0;
-	sf_mtd_info.erasesize = flash->sector_size;
-
-	return add_mtd_device(&sf_mtd_info);
-}
-
-void spi_flash_mtd_unregister(void)
-{
-	del_mtd_device(&sf_mtd_info);
-}
-- 
1.9.1

  parent reply	other threads:[~2015-10-12 19:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 19:54 [U-Boot] [PATCH 1/8] sf: Add MTD support to spi_flash Jagan Teki
2015-10-12 19:54 ` [U-Boot] [PATCH 2/8] sf: Use mtd_info ops instead of spi_flash ops Jagan Teki
2015-10-29  6:29   ` Heiko Schocher
2015-10-12 19:54 ` [U-Boot] [PATCH 3/8] cmd_sf: Use mtd->size instead of flash->size Jagan Teki
2015-10-29  6:32   ` Heiko Schocher
2015-10-12 19:54 ` [U-Boot] [PATCH 4/8] dm-sf: use mtd_ops, drop dm_spi_flash_ops Jagan Teki
2015-10-29  6:35   ` Heiko Schocher
2015-10-29 13:11     ` Jagan Teki
2015-11-06  3:15       ` Simon Glass
2015-10-12 19:54 ` [U-Boot] [PATCH 5/8] sf: Add MTD support for non-dm spi_flash interface Jagan Teki
2015-10-29  6:37   ` Heiko Schocher
2015-10-12 19:54 ` [U-Boot] [PATCH 6/8] sf: probe: Minor cleanup Jagan Teki
2015-10-29  6:54   ` Heiko Schocher
2015-10-12 19:54 ` Jagan Teki [this message]
2015-10-12 19:54 ` [U-Boot] [PATCH 8/8] configs: Remove CONFIG_SPI_FLASH_MTD Jagan Teki
2015-10-29  6:04 ` [U-Boot] [PATCH 1/8] sf: Add MTD support to spi_flash Heiko Schocher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444679655-30349-7-git-send-email-jteki@openedev.com \
    --to=jteki@openedev.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox