Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
m25p80.c File Reference
#include <linux/init.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/mutex.h>
#include <linux/math64.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/mod_devicetable.h>
#include <linux/mtd/cfi.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/of_platform.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>

Go to the source code of this file.

Data Structures

struct  m25p
 
struct  flash_info
 

Macros

#define OPCODE_WREN   0x06 /* Write enable */
 
#define OPCODE_RDSR   0x05 /* Read status register */
 
#define OPCODE_WRSR   0x01 /* Write status register 1 byte */
 
#define OPCODE_NORM_READ   0x03 /* Read data bytes (low frequency) */
 
#define OPCODE_FAST_READ   0x0b /* Read data bytes (high frequency) */
 
#define OPCODE_PP   0x02 /* Page program (up to 256 bytes) */
 
#define OPCODE_BE_4K   0x20 /* Erase 4KiB block */
 
#define OPCODE_BE_32K   0x52 /* Erase 32KiB block */
 
#define OPCODE_CHIP_ERASE   0xc7 /* Erase whole flash chip */
 
#define OPCODE_SE   0xd8 /* Sector erase (usually 64KiB) */
 
#define OPCODE_RDID   0x9f /* Read JEDEC ID */
 
#define OPCODE_BP   0x02 /* Byte program */
 
#define OPCODE_WRDI   0x04 /* Write disable */
 
#define OPCODE_AAI_WP   0xad /* Auto address increment word program */
 
#define OPCODE_EN4B   0xb7 /* Enter 4-byte mode */
 
#define OPCODE_EX4B   0xe9 /* Exit 4-byte mode */
 
#define OPCODE_BRWR   0x17 /* Bank register write */
 
#define SR_WIP   1 /* Write in progress */
 
#define SR_WEL   2 /* Write enable latch */
 
#define SR_BP0   4 /* Block protect 0 */
 
#define SR_BP1   8 /* Block protect 1 */
 
#define SR_BP2   0x10 /* Block protect 2 */
 
#define SR_SRWD   0x80 /* SR write protect */
 
#define MAX_READY_WAIT_JIFFIES   (40 * HZ) /* M25P16 specs 40s max chip erase */
 
#define MAX_CMD_SIZE   5
 
#define OPCODE_READ   OPCODE_NORM_READ
 
#define FAST_READ_DUMMY_BYTE   0
 
#define JEDEC_MFR(_jedec_id)   ((_jedec_id) >> 16)
 
#define SECT_4K   0x01 /* OPCODE_BE_4K works uniformly */
 
#define M25P_NO_ERASE   0x02 /* No erase command needed */
 
#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)
 
#define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_width)
 

Functions

 MODULE_DEVICE_TABLE (spi, m25p_ids)
 
 module_spi_driver (m25p80_driver)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("Mike Lavender")
 
 MODULE_DESCRIPTION ("MTD SPI driver for ST M25Pxx flash chips")
 

Macro Definition Documentation

#define CAT25_INFO (   _sector_size,
  _n_sectors,
  _page_size,
  _addr_width 
)
Value:
((kernel_ulong_t)&(struct flash_info) { \
.sector_size = (_sector_size), \
.n_sectors = (_n_sectors), \
.page_size = (_page_size), \
.addr_width = (_addr_width), \
.flags = M25P_NO_ERASE, \
})

Definition at line 609 of file m25p80.c.

#define FAST_READ_DUMMY_BYTE   0

Definition at line 81 of file m25p80.c.

#define INFO (   _jedec_id,
  _ext_id,
  _sector_size,
  _n_sectors,
  _flags 
)
Value:
((kernel_ulong_t)&(struct flash_info) { \
.jedec_id = (_jedec_id), \
.ext_id = (_ext_id), \
.sector_size = (_sector_size), \
.n_sectors = (_n_sectors), \
.page_size = 256, \
.flags = (_flags), \
})

Definition at line 599 of file m25p80.c.

#define JEDEC_MFR (   _jedec_id)    ((_jedec_id) >> 16)

Definition at line 84 of file m25p80.c.

#define M25P_NO_ERASE   0x02 /* No erase command needed */

Definition at line 596 of file m25p80.c.

#define MAX_CMD_SIZE   5

Definition at line 74 of file m25p80.c.

#define MAX_READY_WAIT_JIFFIES   (40 * HZ) /* M25P16 specs 40s max chip erase */

Definition at line 73 of file m25p80.c.

#define OPCODE_AAI_WP   0xad /* Auto address increment word program */

Definition at line 54 of file m25p80.c.

#define OPCODE_BE_32K   0x52 /* Erase 32KiB block */

Definition at line 46 of file m25p80.c.

#define OPCODE_BE_4K   0x20 /* Erase 4KiB block */

Definition at line 45 of file m25p80.c.

#define OPCODE_BP   0x02 /* Byte program */

Definition at line 52 of file m25p80.c.

#define OPCODE_BRWR   0x17 /* Bank register write */

Definition at line 61 of file m25p80.c.

#define OPCODE_CHIP_ERASE   0xc7 /* Erase whole flash chip */

Definition at line 47 of file m25p80.c.

#define OPCODE_EN4B   0xb7 /* Enter 4-byte mode */

Definition at line 57 of file m25p80.c.

#define OPCODE_EX4B   0xe9 /* Exit 4-byte mode */

Definition at line 58 of file m25p80.c.

#define OPCODE_FAST_READ   0x0b /* Read data bytes (high frequency) */

Definition at line 43 of file m25p80.c.

#define OPCODE_NORM_READ   0x03 /* Read data bytes (low frequency) */

Definition at line 42 of file m25p80.c.

#define OPCODE_PP   0x02 /* Page program (up to 256 bytes) */

Definition at line 44 of file m25p80.c.

#define OPCODE_RDID   0x9f /* Read JEDEC ID */

Definition at line 49 of file m25p80.c.

#define OPCODE_RDSR   0x05 /* Read status register */

Definition at line 40 of file m25p80.c.

#define OPCODE_READ   OPCODE_NORM_READ

Definition at line 80 of file m25p80.c.

#define OPCODE_SE   0xd8 /* Sector erase (usually 64KiB) */

Definition at line 48 of file m25p80.c.

#define OPCODE_WRDI   0x04 /* Write disable */

Definition at line 53 of file m25p80.c.

#define OPCODE_WREN   0x06 /* Write enable */

Definition at line 39 of file m25p80.c.

#define OPCODE_WRSR   0x01 /* Write status register 1 byte */

Definition at line 41 of file m25p80.c.

#define SECT_4K   0x01 /* OPCODE_BE_4K works uniformly */

Definition at line 595 of file m25p80.c.

#define SR_BP0   4 /* Block protect 0 */

Definition at line 67 of file m25p80.c.

#define SR_BP1   8 /* Block protect 1 */

Definition at line 68 of file m25p80.c.

#define SR_BP2   0x10 /* Block protect 2 */

Definition at line 69 of file m25p80.c.

#define SR_SRWD   0x80 /* SR write protect */

Definition at line 70 of file m25p80.c.

#define SR_WEL   2 /* Write enable latch */

Definition at line 65 of file m25p80.c.

#define SR_WIP   1 /* Write in progress */

Definition at line 64 of file m25p80.c.

Function Documentation

MODULE_AUTHOR ( "Mike Lavender"  )
MODULE_DESCRIPTION ( "MTD SPI driver for ST M25Pxx flash chips )
MODULE_DEVICE_TABLE ( spi  ,
m25p_ids   
)
MODULE_LICENSE ( "GPL"  )
module_spi_driver ( m25p80_driver  )