Add support for generic EEPROM access via a character driver. Add also the EEPROM driver itself. From Sebastien Lorquet

This commit is contained in:
Gregory Nutt
2014-11-26 13:55:34 -06:00
parent 18e0fa46c8
commit 40b27115cc
8 changed files with 970 additions and 3 deletions
+11
View File
@@ -207,6 +207,17 @@ menuconfig SPI
if SPI if SPI
source drivers/spi/Kconfig source drivers/spi/Kconfig
menuconfig SPI_EEPROM
bool "SPI EEPROM support"
default n
---help---
This directory holds implementations of SPI EEPROM drivers
if SPI_EEPROM
source drivers/eeprom/Kconfig
endif
endif # SPI endif # SPI
menuconfig I2S menuconfig I2S
+1
View File
@@ -52,6 +52,7 @@ VPATH = .
include analog$(DELIM)Make.defs include analog$(DELIM)Make.defs
include audio$(DELIM)Make.defs include audio$(DELIM)Make.defs
include bch$(DELIM)Make.defs include bch$(DELIM)Make.defs
include eeprom$(DELIM)Make.defs
include input$(DELIM)Make.defs include input$(DELIM)Make.defs
include lcd$(DELIM)Make.defs include lcd$(DELIM)Make.defs
include mmcsd$(DELIM)Make.defs include mmcsd$(DELIM)Make.defs
+21
View File
@@ -0,0 +1,21 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
config SPI_EE_25XX
bool "Microchip 25xxNNN / Atmel AT25NNN EEPROM devices"
default n
depends on SPI_EEPROM
---help---
This selection enables support for the Microchip/Atmel SPI EEPROM
devices
if SPI_EE_25XX
config EE25XX_SPIMODE
int "SPI mode (0-3)"
default 0
depends on SPI_EE_25XX
endif
+46
View File
@@ -0,0 +1,46 @@
############################################################################
# drivers/eeprom/Make.defs
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
ifneq ($(CONFIG_SPI_EE_25XX),0)
# Include the Microchip/Atmel xx25xx driver
CSRCS += spi_xx25xx.c
# Include build support
DEPPATH += --dep-path eeprom
VPATH += :eeprom
endif
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -2,8 +2,8 @@ MTD README
========== ==========
MTD stands for "Memory Technology Devices". This directory contains MTD stands for "Memory Technology Devices". This directory contains
drivers that operate on various memory technoldogy devices and provide an drivers that operate on various memory technology devices and provide an
MTD interface. That MTD interface may then by use by higher level logic MTD interface. That MTD interface may then be used by higher level logic
to control access to the memory device. to control access to the memory device.
See include/nuttx/mtd/mtd.h for additional information. See include/nuttx/mtd/mtd.h for additional information.
+99
View File
@@ -0,0 +1,99 @@
/****************************************************************************
* include/nuttx/eeprom/m25xx.h
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Sebastien Lorquet <sebastien@lorquet.fr>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_EEPROM_M25XX_H
#define __INCLUDE_NUTTX_EEPROM_M25XX_H 1
/****************************************************************************
* Public Types
****************************************************************************/
/* DO NOT CHANGE ORDER, IT MACHES CODE IN drivers/eeprom/spieeprom.c */
enum eeprom_25xx_e
{
/* Microchip geometries */
EEPROM_25xx010,
EEPROM_25xx020,
EEPROM_25xx040,
EEPROM_25xx080A, /* 16 bytes pages */
EEPROM_25xx080B, /* 32 bytes pages */
EEPROM_25xx160A, /* 16 bytes pages */
EEPROM_25xx160B, /* 32 bytes pages */
EEPROM_25xx320,
EEPROM_25xx640,
EEPROM_25xx128,
EEPROM_25xx256,
EEPROM_25xx512,
EEPROM_25xx1024,
/* Atmel geometries */
EEPROM_AT25010B,
EEPROM_AT25020B,
EEPROM_AT25040B,
/* Aliases (devices similar to previously defined ones)*/
EEPROM_AT25080B = EEPROM_25xx080B,
EEPROM_AT25160B = EEPROM_25xx160B,
EEPROM_AT25320B = EEPROM_25xx320,
EEPROM_AT25640B = EEPROM_25xx640,
EEPROM_AT25128B = EEPROM_25xx128,
EEPROM_AT225256B = EEPROM_25xx256,
EEPROM_AT25512 = EEPROM_25xx512,
EEPROM_AT25M02 = EEPROM_25xx1024,
};
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: ee25xx_initialize
*
* Description: Bind a EEPROM driver to an SPI bus. The user MUST provide
* a description of the device geometry, since it is not possible to read
* this information from the device (contrary to the SPI flash devices).
*
****************************************************************************/
struct spi_dev_s;
int ee25xx_initialize(FAR struct spi_dev_s *dev, FAR char *devname,
int devtype, int readonly);
#endif /* __INCLUDE__NUTTX_EEPROM_M25XX_H */
+2 -1
View File
@@ -360,7 +360,8 @@ enum spi_dev_e
SPIDEV_EXPANDER, /* Select SPI I/O expander device */ SPIDEV_EXPANDER, /* Select SPI I/O expander device */
SPIDEV_MUX, /* Select SPI multiplexer device */ SPIDEV_MUX, /* Select SPI multiplexer device */
SPIDEV_AUDIO_DATA, /* Select SPI audio codec device data port */ SPIDEV_AUDIO_DATA, /* Select SPI audio codec device data port */
SPIDEV_AUDIO_CTRL /* Select SPI audio codec device control port */ SPIDEV_AUDIO_CTRL, /* Select SPI audio codec device control port */
SPIDEV_EEPROM /* Select SPI EEPROM device */
}; };
/* Certain SPI devices may required differnt clocking modes */ /* Certain SPI devices may required differnt clocking modes */