Commit Graph

575 Commits

Author SHA1 Message Date
dongjiuzhu1
917728bad9 driver/ftl: pass the number of eraseblock for ftl_get_cblock
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-31 22:22:25 -07:00
Michal Lenc
1fb65e18d2 w25.c: enable support for W25QxxxJV NOR flash memories
W25QxxxJV NOR memories are backward compatible with older Winbond´s
generations and thus can also be supported here. This essentially brings
the support for generic SPI to W25QxxxJV memories as w25qxxxjv.c file only
supports QSPI communication.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-07-31 05:46:57 -07:00
chenrun1
c267791f06 driver/mtd/ftl: Modify erasure result processing error issue
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2023-07-30 12:40:30 -07:00
dongjiuzhu1
dcf3f9de75 driver/mtd/ftl: support to skip bad block for earse/bread/bwrite
1.support to use dd commond to burn romfs image to nand flash
2.support bare-write nand flash device without file system

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-29 17:46:14 -03:00
Xiang Xiao
abfe082a6f Kconfig: Simplify the conditional default statement
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-16 14:39:20 -03:00
chao an
f10b54a081 cmake: fix CMake build break
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-15 23:32:36 +08:00
chao an
6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Beat Küng
cbbeec3183 ramtron.c: add FM25V02A-DGQ 2023-07-04 08:19:56 +08:00
wangbowen6
940bbfc720 rpmsg: support the fdsan feature for rpmsg dev/mtd/blk
Directly return -ENOTTY in rpmsgxxx_ioctl() when the command is
not supported to avoid fdsan command FIOC_SETTAG and FIOC_GETTAG
pass to the rpmsg dev/mtd/blk server with CONFIG_FDSAN enabled.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-06-17 19:34:39 +08:00
Sebastien Lorquet
d36e2a8394 is25xp: Enable usage of several chips on the same spi bus 2023-06-10 02:14:23 +08:00
xucheng5
f4e3f23945 driver/mtd : mtd_config name len max changed to NAME_MAX
Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2023-06-07 09:40:02 -03:00
wanggang26
01348b70a9 mtd: fix a typo 2023-06-02 19:57:15 +03:00
xucheng5
484d349fe3 driver/mtd : check args for nvs read
mtd_config_fs: check configdata before use

Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2023-05-31 15:24:14 +08:00
Michal Lenc
5f5ffa9380 fix compile warnings caused by incorrect variable format in print
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-05-27 18:52:01 +08:00
TimJTi
3cb168b177 GD25 Flash memory - performance enhancements 2023-05-23 01:32:58 +08:00
Xiang Xiao
7990f90915 Indent the define statement by two spaces
follow the code style convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-21 09:52:08 -03:00
Petro Karashchenko
1e86682feb drivers/mtd: fix C89 compatibility of w25qxxxjv
Correct various style issues

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-05-19 02:40:38 +08:00
Michal Lenc
cf04f2e555 w25qxxxjv: add dual die support for 1 Gbit flash
1 Gbit W25Q01JV flash uses two 512 Mbit dies. This requires specific
operations in the driver in order to support the entire 1 Gbit region.
This commit adds dual die support for W25Q01JV flash.

Generally the driver has to switch active dies when die specific read from
status register is required (therefore before read, write, erase and when
checking if write status register was successful).

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-05-18 01:10:55 +08:00
Michal Lenc
482cbc4363 w25qxxxjv: fix STATUS2_QE_ENABLED bitfield write
W25QXXXJV_WRITE_STATUS_2 register uses just first byte therefore all
operations has to be done in priv->cmdbuf[0]. Previous priv->cmdbuf[1]
caused QuadSPI mode not being enabled.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-05-15 10:43:55 +08:00
Alan Carvalho de Assis
54d92d1a0f Fix typo -EACESS -> -EACCES 2023-05-12 06:29:35 +03:00
Xiang Xiao
6f6fce95a2 Replace all sprintf with snprintf
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Xiang Xiao
a514c0a13e mtd/nand: Implement isbad and markbad callback
these new callbacks are added by:
https://github.com/apache/nuttx/pull/8683

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-03 17:40:18 +03:00
Xiang Xiao
3e1ddb3de9 mtd/nand: Return -EUCLEAN when the bit error happen but fixed by ecc
follow how Linux report the correction information from ecc:
http://www.infradead.org/pipermail/linux-mtd/2012-March/040305.html
since this information is very useful to file system(e.g. yaffs, ubi/buifs)
which is specially designed for nand flash.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-03 17:40:18 +03:00
Xiang Xiao
7a725019bc mtd/nand: Add nand_raw_initialize to skip the probing
Since not all nand devices follow ONFI spec, nand_raw_initialize could be used to skip ONFI special action

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-02 15:02:38 +02:00
Xiang Xiao
b4814811f5 mtd/nand: Implement MTDIOC_ERASESECTORS ioctl
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-02 12:15:56 +02:00
Xiang Xiao
3fc882df9e mtd/nand: Implement MTDIOC_ERASESTATE ioctl
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-02 12:15:56 +02:00
Xiang Xiao
3c54e66683 mtd/nand: Fix the comment and remove the uneeded inclusion
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-01 22:47:00 +03:00
Xiang Xiao
25a1191763 mtd/nand: Correct the check of erasing bad blocks
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-01 22:47:00 +03:00
Xiang Xiao
c1680d2f03 mtd/nand: Call nandmodel_getdevpagesize directly to get the page number
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-01 22:47:00 +03:00
Michal Lenc
02aa7bcefe mtd: add support for MTDIOC_ERASESECTORS ioctl
Current driver supports MTDIOC_BULKERASE ioctl that erases the entire
device. The added ioctl MTDIOC_ERASESECTORS adds possibility to erase
just sectors defined by the user.

This is similar to MEMERASE call in Linux kernel.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-04-29 21:23:08 +08:00
Xiang Xiao
51dc67ad5f fs: Add g_ prefix for all global file_operations instances
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 16:13:29 +02:00
Xiang Xiao
c6d210289f procfs: remove procfs_ from procfs_operations variables
to aglin the naming style with other implementation

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
Xiang Xiao
149cafe450 procfs: Add g_ prefix to all procfs_operations
to conform the coding style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
XinStellaris
a4546f35d2 drivers/mtd:fix uninit data in mtd_config_fs
Signed-off-by: XinStellaris <tianxin7@xiaomi.com>
2023-04-19 02:45:46 +08:00
Petro Karashchenko
4581a84064 nuttx: fix indentation issue
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-03-09 16:27:07 -03:00
huxiandong
266455f01c mtd: Extend isbad and markbad func for mtd_dev_s
Signed-off-by: huxiandong <huxiandong@xiaomi.com>
2023-03-01 10:06:56 -03:00
lilei19
38f64f559d change strcpy to strlcpy
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-02-24 12:15:40 +08:00
Xiang Xiao
c54c9395a5 Revert "drivrs/mtd/filemtd.c: add block device MTD interface. Block MTD interface allows using block device directly as MTD instead of having to use file-system in between. NOTE that this provides the opposite capability of FTL which will let you use an MTD interface directly as a block device."
since filemtd can handle not only char device, but also block device.
This reverts commit 5ef548677a.
2023-02-22 16:38:29 +08:00
Oreh
9902f39d92 Add MTD loop driver (use filemtd) 2023-02-19 19:46:48 +08:00
Igor Mišić
8e4d461d61 drivers/mtd/ramtron: change nsectors size to uint32 2023-02-17 11:19:46 -03:00
chao an
3a0fdb019d nuttx: replace all ARRAY_SIZE()/ARRAYSIZE() to nitems()
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:05:44 +08:00
Igor Mišić
0a4fbcd123 drivers/mtd: add Kconfig options for RAMTRON emulated page & sector size 2023-02-08 01:44:51 +08:00
Gustavo Henrique Nihei
e6b204f438 nuttx: Use MIN/MAX definitions from "sys/param.h"
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-01 23:47:44 +08:00
Xiang Xiao
9f027208d4 fs: Add model field to geometry and mtd_geometry_s
the model is very useful to track the device info

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-31 11:50:28 -03:00
Oleksandr Oryshchenko
28f92e8238 [MTD/SmartFS] Extract register_driver call to own function 2023-01-30 11:09:40 +08:00
Petro Karashchenko
e3a8e1e3ef drivers/mtd/mtd_config: switch from semaphore to mutex for exclusive access
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-26 10:24:05 +08:00
Sebastien Lorquet
af6c990498 add support for more is25 mtd devices 2023-01-06 11:52:37 +08:00
Xiang Xiao
b0a0ba3ad7 fs: Move mmap callback before truncate in [file|mountpt]_operations
since mmap may exist in block_operations, but truncate may not,
moving mmap beforee truncate could make three struct more compatible

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 17:43:59 +02:00
Xiang Xiao
779a610ca3 Remove the unnecessary NULL fields in global instance definition of file_operations
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:32:13 +02:00
Jukka Laitinen
f33dc4df3f Change FIOC_MMAP into file operation call
- Add mmap into file_operations and remove it from ioctl definitions.
- Add mm_map structure definitions to support future unmapping
- Modify all drivers to initialize the operations struct accordingly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00