mtd: ST SPEAr: Add SMI driver for serial NOR flash

SPEAr platforms (spear3xx/spear6xx/spear13xx) provide SMI (Serial Memory
Interface) controller to access serial NOR flash. SMI provides a simple
interface for SPI/serial NOR flashes and has certain inbuilt commands
and features to support these flashes easily. It also makes it possible
to map an address range in order to directly access (read/write) the SNOR
over address bus. This patch intends to provide serial nor driver support
for spear platforms which are accessed through SMI.

Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
Shiraz Hashim 2012-01-12 14:38:57 +01:00 committed by David Woodhouse
parent 661a08327d
commit f18dbbb1bf
4 changed files with 1180 additions and 0 deletions

View file

@ -102,6 +102,13 @@ config M25PXX_USE_FAST_READ
help
This option enables FAST_READ access supported by ST M25Pxx.
config MTD_SPEAR_SMI
tristate "SPEAR MTD NOR Support through SMI controller"
depends on PLAT_SPEAR
default y
help
This enable SNOR support on SPEAR platforms using SMI controller
config MTD_SST25L
tristate "Support SST25L (non JEDEC) SPI Flash chips"
depends on SPI_MASTER

View file

@ -17,6 +17,7 @@ obj-$(CONFIG_MTD_LART) += lart.o
obj-$(CONFIG_MTD_BLOCK2MTD) += block2mtd.o
obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataflash.o
obj-$(CONFIG_MTD_M25P80) += m25p80.o
obj-$(CONFIG_MTD_SPEAR_SMI) += spear_smi.o
obj-$(CONFIG_MTD_SST25L) += sst25l.o
CFLAGS_docg3.o += -I$(src)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,60 @@
/*
* Copyright © 2010 ST Microelectronics
* Shiraz Hashim <shiraz.hashim@st.com>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#ifndef __MTD_SPEAR_SMI_H
#define __MTD_SPEAR_SMI_H
#include <linux/types.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/platform_device.h>
/* macro to define partitions for flash devices */
#define DEFINE_PARTS(n, of, s) \
{ \
.name = n, \
.offset = of, \
.size = s, \
}
/**
* struct spear_smi_flash_info - platform structure for passing flash
* information
*
* name: name of the serial nor flash for identification
* mem_base: the memory base on which the flash is mapped
* size: size of the flash in bytes
* partitions: parition details
* nr_partitions: number of partitions
* fast_mode: whether flash supports fast mode
*/
struct spear_smi_flash_info {
char *name;
unsigned long mem_base;
unsigned long size;
struct mtd_partition *partitions;
int nr_partitions;
u8 fast_mode;
};
/**
* struct spear_smi_plat_data - platform structure for configuring smi
*
* clk_rate: clk rate at which SMI must operate
* num_flashes: number of flashes present on board
* board_flash_info: specific details of each flash present on board
*/
struct spear_smi_plat_data {
unsigned long clk_rate;
int num_flashes;
struct spear_smi_flash_info *board_flash_info;
};
#endif /* __MTD_SPEAR_SMI_H */