diff options
author | Jagan Teki <jteki@openedev.com> | 2015-11-04 07:31:59 (GMT) |
---|---|---|
committer | Jagan Teki <jteki@openedev.com> | 2015-11-17 18:31:07 (GMT) |
commit | 7693fb37564422b2e0ec9717deab7ca51a093f4e (patch) | |
tree | 8abafe37426ead7ebeed0b84c89b2e3108ae7a27 /drivers/mtd | |
parent | 2d1345972147dc7edb959f7b4e9408bae278866a (diff) | |
download | u-boot-7693fb37564422b2e0ec9717deab7ca51a093f4e.tar.xz |
sf: Remove eeprom_m95xxx test driver
The relevent boards which used this driver got zapped
in previous release and the driver is never used in the
code and also it doesn't use/do any spi-flash operations.
Commit details for relevent removed boards:
"ARM: at91: remove non-generic boards"
(sha1: f6b42c140387589ded24749781ce565571092eac)
Cc: Tom Rini <trini@konsulko.com>
Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Signed-off-by: Jagan Teki <jteki@openedev.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/spi/Makefile | 1 | ||||
-rw-r--r-- | drivers/mtd/spi/eeprom_m95xxx.c | 111 |
2 files changed, 0 insertions, 112 deletions
diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile index ff48b25..cf4e7e1 100644 --- a/drivers/mtd/spi/Makefile +++ b/drivers/mtd/spi/Makefile @@ -20,4 +20,3 @@ obj-$(CONFIG_SPI_FLASH) += sf_ops.o sf_params.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/eeprom_m95xxx.c b/drivers/mtd/spi/eeprom_m95xxx.c deleted file mode 100644 index a019939..0000000 --- a/drivers/mtd/spi/eeprom_m95xxx.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2009 - * Albin Tonnerre, Free Electrons <albin.tonnerre@free-electrons.com> - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <spi.h> - -#define SPI_EEPROM_WREN 0x06 -#define SPI_EEPROM_RDSR 0x05 -#define SPI_EEPROM_READ 0x03 -#define SPI_EEPROM_WRITE 0x02 - -#ifndef CONFIG_DEFAULT_SPI_BUS -#define CONFIG_DEFAULT_SPI_BUS 0 -#endif - -#ifndef CONFIG_DEFAULT_SPI_MODE -#define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0 -#endif - -#ifndef CONFIG_SYS_SPI_WRITE_TOUT -#define CONFIG_SYS_SPI_WRITE_TOUT (5 * CONFIG_SYS_HZ) -#endif - -ssize_t spi_read(uchar *addr, int alen, uchar *buffer, int len) -{ - struct spi_slave *slave; - u8 cmd = SPI_EEPROM_READ; - - slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000, - CONFIG_DEFAULT_SPI_MODE); - if (!slave) - return 0; - - spi_claim_bus(slave); - - /* command */ - if (spi_xfer(slave, 8, &cmd, NULL, SPI_XFER_BEGIN)) - return -1; - - /* - * if alen == 3, addr[0] is the block number, we never use it here. - * All we need are the lower 16 bits. - */ - if (alen == 3) - addr++; - - /* address, and data */ - if (spi_xfer(slave, 16, addr, NULL, 0)) - return -1; - if (spi_xfer(slave, 8 * len, NULL, buffer, SPI_XFER_END)) - return -1; - - spi_release_bus(slave); - spi_free_slave(slave); - return len; -} - -ssize_t spi_write(uchar *addr, int alen, uchar *buffer, int len) -{ - struct spi_slave *slave; - char buf[3]; - ulong start; - - slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000, - CONFIG_DEFAULT_SPI_MODE); - if (!slave) - return 0; - - spi_claim_bus(slave); - - buf[0] = SPI_EEPROM_WREN; - if (spi_xfer(slave, 8, buf, NULL, SPI_XFER_BEGIN | SPI_XFER_END)) - return -1; - - buf[0] = SPI_EEPROM_WRITE; - - /* As for reading, drop addr[0] if alen is 3 */ - if (alen == 3) { - alen--; - addr++; - } - - memcpy(buf + 1, addr, alen); - /* command + addr, then data */ - if (spi_xfer(slave, 24, buf, NULL, SPI_XFER_BEGIN)) - return -1; - if (spi_xfer(slave, len * 8, buffer, NULL, SPI_XFER_END)) - return -1; - - start = get_timer(0); - do { - buf[0] = SPI_EEPROM_RDSR; - buf[1] = 0; - spi_xfer(slave, 16, buf, buf, SPI_XFER_BEGIN | SPI_XFER_END); - - if (!(buf[1] & 1)) - break; - - } while (get_timer(start) < CONFIG_SYS_SPI_WRITE_TOUT); - - if (buf[1] & 1) - printf("*** spi_write: Timeout while writing!\n"); - - spi_release_bus(slave); - spi_free_slave(slave); - return len; -} |