diff --git a/ChangeLog b/ChangeLog index 79e590904a..1d8d2664df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5534,4 +5534,7 @@ definition file (2013-9-11). * arch/arm/src/sama5/sam_twi.c and .h: Framework for a SAMA5 TWI driver (not much present in initial checkin) (2013-9-11). + * fs/nxffs: Clean up some compilation warnings (2013-9-12) + * drivers/mtd/at24xx.c: Add support for the AT 24C512 part + (2013-9-12). diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig index 01d488cd6c..ffe7ac06e1 100644 --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig @@ -67,22 +67,28 @@ config RAMMTD_FLASHSIM endif config MTD_AT24XX - bool "I2C-based AT24XX eeprom" + bool "I2C-based AT24xx eeprom" default n select I2C ---help--- - Build support for I2C-based at24cxx EEPROM(at24c32, at24c64, + Build support for I2C-based AT24CXX EEPROM(at24c32, at24c64, at24c128, at24c256) if MTD_AT24XX config AT24XX_SIZE - int "at24xx size(kByte)" + int "AT24xx size (kbit)" default 64 + ---help--- + This is the XX in the AT24Cxx part number. For example, if you have a + AT 24C512, then the correct value is 512. This value is also the capacity + of the part in kilobits. For example, the 24C512 supports 512 Kbits or + 512 /8 = 64 KiB. config AT24XX_ADDR - hex "at24xx i2c address" + hex "AT24XX I2C address" default 0x50 + range 0x50 0x57 endif diff --git a/drivers/mtd/at24xx.c b/drivers/mtd/at24xx.c index 2eb7c9af08..326c6f86b2 100644 --- a/drivers/mtd/at24xx.c +++ b/drivers/mtd/at24xx.c @@ -1,6 +1,6 @@ /************************************************************************************ * drivers/mtd/at24xx.c - * Driver for I2C-based at24cxx EEPROM(at24c32,at24c64,at24c128,at24c256) + * Driver for I2C-based at24cxx EEPROM(at24c32,at24c64,at24c128,at24c256,at24c512) * * Copyright (C) 2011 Li Zhuoyi. All rights reserved. * Author: Li Zhuoyi @@ -81,21 +81,24 @@ /* Get the part configuration based on the size configuration */ -#if CONFIG_AT24XX_SIZE == 32 +#if CONFIG_AT24XX_SIZE == 32 /* AT24C32: 32Kbits = 4KiB; 128 * 32 = 4096 */ # define AT24XX_NPAGES 128 # define AT24XX_PAGESIZE 32 -#elif CONFIG_AT24XX_SIZE == 48 +#elif CONFIG_AT24XX_SIZE == 48 /* AT24C48: 48Kbits = 6KiB; 192 * 32 = 6144 */ # define AT24XX_NPAGES 192 # define AT24XX_PAGESIZE 32 -#elif CONFIG_AT24XX_SIZE == 64 +#elif CONFIG_AT24XX_SIZE == 64 /* AT24C64: 64Kbits = 8KiB; 256 * 32 = 8192 */ # define AT24XX_NPAGES 256 # define AT24XX_PAGESIZE 32 -#elif CONFIG_AT24XX_SIZE == 128 +#elif CONFIG_AT24XX_SIZE == 128 /* AT24C128: 128Kbits = 16KiB; 256 * 64 = 16384 */ # define AT24XX_NPAGES 256 # define AT24XX_PAGESIZE 64 -#elif CONFIG_AT24XX_SIZE == 256 +#elif CONFIG_AT24XX_SIZE == 256 /* AT24C256: 256Kbits = 32KiB; 512 * 64 = 32768 */ # define AT24XX_NPAGES 512 # define AT24XX_PAGESIZE 64 +#elif CONFIG_AT24XX_SIZE == 512 /* AT24C512: 512Kbits = 64KiB; 512 * 128 = 65536 */ +# define AT24XX_NPAGES 512 +# define AT24XX_PAGESIZE 128 #endif /* For applications where a file system is used on the AT24, the tiny page sizes @@ -139,8 +142,10 @@ static ssize_t at24c_bread(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, FAR uint8_t *buf); static ssize_t at24c_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, FAR const uint8_t *buf); +#if 0 /* Not implemented */ static ssize_t at24c_read(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes,FAR uint8_t *buffer); +#endif static int at24c_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg); /************************************************************************************