mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
drivers/mtd/mx25rxx.c: add support for 512B sectors
- Fix for mx25rxx driver as it does not work properly - Add mx25rxx memory chip & smartfs support in b-l475e-iot01a/nsh config - Update smartfs smart_scan() function
This commit is contained in:
committed by
Gregory Nutt
parent
08460ba5b1
commit
780d4d41e8
@@ -1182,7 +1182,7 @@ if STM32L4_QSPI
|
|||||||
config STM32L4_QSPI_FLASH_SIZE
|
config STM32L4_QSPI_FLASH_SIZE
|
||||||
int "Size of attached serial flash, bytes"
|
int "Size of attached serial flash, bytes"
|
||||||
default 16777216
|
default 16777216
|
||||||
range 1 2147483648
|
range 1 2147483647
|
||||||
---help---
|
---help---
|
||||||
The STM32L4 QSPI peripheral requires the size of the Flash be specified
|
The STM32L4 QSPI peripheral requires the size of the Flash be specified
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
if ARCH_BOARD_B_L475E_IOT01A
|
if ARCH_BOARD_B_L475E_IOT01A
|
||||||
|
|
||||||
config B_L475E_IOT01A_MTD_FLASH
|
config B_L475E_IOT01A_MTD_FLASH
|
||||||
bool "MTD driver for external 64Mbytes flash memory"
|
bool "MTD driver for external 64Mbits flash memory"
|
||||||
default n
|
default n
|
||||||
select STM32L4_DMA1
|
select STM32L4_DMA1
|
||||||
select STM32L4_QSPI
|
select STM32L4_QSPI
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ CONFIG_ARCH_CHIP_STM32L4=y
|
|||||||
CONFIG_ARCH_STACKDUMP=y
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
CONFIG_BOARD_LOOPSPERMSEC=8025
|
CONFIG_BOARD_LOOPSPERMSEC=8025
|
||||||
CONFIG_BUILTIN=y
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_B_L475E_IOT01A_MTD_FLASH=y
|
||||||
|
CONFIG_B_L475E_IOT01A_MTD_PART=y
|
||||||
|
CONFIG_B_L475E_IOT01A_MTD_PART_LIST="16,64,128,128"
|
||||||
CONFIG_FS_PROCFS=y
|
CONFIG_FS_PROCFS=y
|
||||||
CONFIG_HAVE_CXX=y
|
CONFIG_HAVE_CXX=y
|
||||||
CONFIG_HAVE_CXXINITIALIZE=y
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
@@ -23,10 +26,13 @@ CONFIG_INTELHEX_BINARY=y
|
|||||||
CONFIG_MAX_TASKS=16
|
CONFIG_MAX_TASKS=16
|
||||||
CONFIG_MAX_WDOGPARMS=2
|
CONFIG_MAX_WDOGPARMS=2
|
||||||
CONFIG_MM_REGIONS=2
|
CONFIG_MM_REGIONS=2
|
||||||
|
CONFIG_MTD_SMART_SECTOR_SIZE=512
|
||||||
|
CONFIG_MX25RXX_SECTOR512=y
|
||||||
CONFIG_NFILE_DESCRIPTORS=8
|
CONFIG_NFILE_DESCRIPTORS=8
|
||||||
CONFIG_NFILE_STREAMS=8
|
CONFIG_NFILE_STREAMS=8
|
||||||
CONFIG_NSH_ARCHINIT=y
|
CONFIG_NSH_ARCHINIT=y
|
||||||
CONFIG_NSH_BUILTIN_APPS=y
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_DISABLE_LOSMART=y
|
||||||
CONFIG_NSH_FILEIOSIZE=512
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
CONFIG_NSH_LINELEN=64
|
CONFIG_NSH_LINELEN=64
|
||||||
CONFIG_NSH_READLINE=y
|
CONFIG_NSH_READLINE=y
|
||||||
@@ -42,6 +48,7 @@ CONFIG_SDCLONE_DISABLE=y
|
|||||||
CONFIG_START_DAY=6
|
CONFIG_START_DAY=6
|
||||||
CONFIG_START_MONTH=12
|
CONFIG_START_MONTH=12
|
||||||
CONFIG_START_YEAR=2011
|
CONFIG_START_YEAR=2011
|
||||||
|
CONFIG_STM32L4_QSPI_FLASH_SIZE=8388608
|
||||||
CONFIG_STM32L4_USART1=y
|
CONFIG_STM32L4_USART1=y
|
||||||
CONFIG_SYSTEM_NSH=y
|
CONFIG_SYSTEM_NSH=y
|
||||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* config/b-l475e-iot01a/src/stm32_bringup.c
|
* config/b-l475e-iot01a/src/stm32_bringup.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017-2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2017-2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Simon Piriou <spiriou31@gmail.com>
|
* Author: Simon Piriou <spiriou31@gmail.com>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -182,8 +182,15 @@ int stm32l4_bringup(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mtd_part = mtd_partition(g_mtd_fs, partoffset,
|
mtd_part = mtd_partition(g_mtd_fs, partoffset,
|
||||||
partszbytes / erasesize);
|
partszbytes / geo.blocksize);
|
||||||
partoffset += partszbytes / erasesize;
|
partoffset += partszbytes / geo.blocksize;
|
||||||
|
|
||||||
|
if (!mtd_part)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "Failed to create part %d, size=%d\n",
|
||||||
|
partno, partsize);
|
||||||
|
goto process_next_part;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
|
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
|
||||||
/* Now initialize a SMART Flash block device and bind it to the MTD
|
/* Now initialize a SMART Flash block device and bind it to the MTD
|
||||||
|
|||||||
@@ -641,6 +641,10 @@ config MX25RXX_QSPI_READ_FREQUENCY
|
|||||||
Clock frequency for read data command.
|
Clock frequency for read data command.
|
||||||
Only Quad read is supported in this driver.
|
Only Quad read is supported in this driver.
|
||||||
|
|
||||||
|
config MX25RXX_SECTOR512
|
||||||
|
bool "Simulate 512 byte Erase Blocks"
|
||||||
|
default n
|
||||||
|
|
||||||
endif # MTD_MX25RXX
|
endif # MTD_MX25RXX
|
||||||
|
|
||||||
config MTD_SMART
|
config MTD_SMART
|
||||||
|
|||||||
+355
-25
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1879,7 +1879,7 @@ static int smart_scan(FAR struct smart_struct_s *dev)
|
|||||||
{
|
{
|
||||||
/* Read the next sector from the device */
|
/* Read the next sector from the device */
|
||||||
|
|
||||||
ret = MTD_READ(dev->mtd, 0, sizeof(struct smart_sect_header_s),
|
ret = MTD_READ(dev->mtd, readaddress, sizeof(struct smart_sect_header_s),
|
||||||
(FAR uint8_t *) &header);
|
(FAR uint8_t *) &header);
|
||||||
if (ret != sizeof(struct smart_sect_header_s))
|
if (ret != sizeof(struct smart_sect_header_s))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user