NUC980 添加XT25BF256BWSIG spi-nor flash

简介: NUC980 添加XT25BF256BWSIG spi-nor flash

nuc980板子更换了一个新的spi-nor flash,需要在boot和内核里注册,注册后启动挂载文件系统报错,这里简单记录一下处理方法


首先在boot上添加spi-nor的芯片id


修改文件:NUC970_U-Boot_v2016-spi/drivers/mtd/spi/sf_params.c


在spi_flash_params_table中增加一行,这里看到原来有XT系列的其他芯片,直接在其下面添加即可:

#ifdef CONFIG_SPI_FLASH_XTX   /* XTX */
  {"XT25F08BSSIGU",  0x0b4013,  0x0,  64 * 1024,   16, RD_FULL | WR_QPP | SECT_4K},
  {"XT25F16BSSIGU",  0x0b4014,  0x0,  64 * 1024,   32, RD_FULL | WR_QPP | SECT_4K},
  {"XT25F32BSSIGU",  0x0b4015,  0x0,  64 * 1024,   64, RD_FULL | WR_QPP | SECT_4K},
  {"XT25F64BSSIGU",  0x0b4016,  0x0,  64 * 1024,   128, RD_FULL | WR_QPP | SECT_4K},
  {"XT25F128BSSIGU",  0x0b4017,   0x0,  64 * 1024,   256, RD_FULL | WR_QPP | SECT_4K},
  {"XT25F256BSSIGU",  0x0b4018,   0x0,  64 * 1024,   512, RD_FULL | WR_QPP | SECT_4K},
  {"XT25BF256BWSIG",  0x0b4019,   0x0,  64 * 1024,   512, RD_FULL | WR_QPP | SECT_4K},  //新增加
#endif


配置uboot支持XT的spi-nor


页面路径:Device Drivers > SPI Flash Support


内核添加添加spi-nor的芯片id


修改文件:drivers/mtd/spi-nor/spi-nor.c


找到spi_nor_ids[] =


里面也有XT系列的参数:

  /* XTX -- XT25x "blocks" are 64K, "sectors" are 4KiB */
  { "XT25F08BSSIGU", INFO(0x0b4013, 0, 64 * 1024,  16, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
  { "XT25F16BSSIGU", INFO(0x0b4014, 0, 64 * 1024,  32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
  { "XT25F32BSSIGU", INFO(0x0b4015, 0, 64 * 1024,  64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
  { "XT25F64BSSIGU", INFO(0x0b4016, 0, 64 * 1024,  128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
  { "XT25F128BSSIGU", INFO(0x0b4017, 0, 64 * 1024,  256, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
  { "XT25F256BSSIGU", INFO(0x0b4018, 0, 64 * 1024,  512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
  { "XT25BF256BWSIG", INFO(0x0b4019, 0, 64 * 1024,  512,  SECT_4K) }, //新增加的


这里需要注意下,如何最后的flag参数那里加上SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ的话,会导致文件系统挂载错误,错误如下:

jffs2 Magic bitmask 错误
jffs2: Node at 0x00000f6c with length 0x00000144 would run over the end of the erase block
[    1.133830] jffs2: Perhaps the file system was created with the wrong erase size?
[    1.141435] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000f70: 0x0144 instead
[    1.150994] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000f74: 0x912a instead
[    1.160547] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000f78: 0x0002 instead
[    1.170127] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000f7c: 0x000d instead
[    1.180689] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000f80: 0x81a4 instead
[    1.190183] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000f84: 0x03e8 instead
[    1.199668] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000f88: 0x11d8 instead
[    1.209151] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000f8c: 0xdec2 instead
[    1.218634] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000f90: 0xdec2 instead
[    1.228102] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000f94: 0xdec2 instead
[    1.237581] jffs2: Further such events for this erase block will not be printed
[    1.245110] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001000: 0x3fb1 instead
[    1.254615] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001004: 0x1a28 instead
[    1.264102] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001008: 0x7f01 instead
[    1.273586] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000100c: 0x505d instead
[    1.283098] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001010: 0x84c8 instead
[    1.292588] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001014: 0xd8d1 instead
[    1.302072] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001018: 0x4001 instead
[    1.311555] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000101c: 0x8485 instead
[    1.321033] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001020: 0x65b1 instead
[    1.330514] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00001024: 0x5d81 instead


文件系统打包命令

mkfs.jffs2 -s 0x1000 -e 0x10000 -p --pad=0x1A00000 -d rootfs/ -o rootfs-jffs2.img


这里-s代表页大小,普通spi nor flash的页大小是256字节,即0x100,但是这里测试用0x1000(4K)也没问题;


-e表示擦除的块大小,普通spi nor flash的块大小是64K字节,即0x10000

-p表示分区大小,在生成时会擦除分区大小的flash初始化。

这里必须和uboot里指定的分区大小一致,否则会出现脏页。


目录
相关文章
|
7月前
|
存储 Linux 开发工具
Rockchip系列之浅度分析UART接口系列(1)
Rockchip系列之浅度分析UART接口系列(1)
409 1
|
7月前
|
存储 内存技术
MTK flash配置方法(转)
MTK flash配置方法(转)
95 1
|
7月前
NUC980修改内核支持spi-nand
NUC980修改内核支持spi-nand
91 2
|
存储 IDE Shell
NUC505 - HS USB
NUC505 - HS USB
|
Android开发
【Magisk模块】K40DC+90Hz_WhiteFan
【Magisk模块】K40DC+90Hz_WhiteFan
536 0
|
传感器 监控
Vibro-meter VM600 MPC4 机械保护卡 用来更新模块的固件
Vibro-meter VM600 MPC4 机械保护卡 用来更新模块的固件
126 0
Vibro-meter VM600 MPC4 机械保护卡 用来更新模块的固件
|
异构计算 SoC
Xilinx Zynq-7000系列XC7Z035/XC7Z045高性能SoC处理器评估板PS端ETH RJ45接口
本文介绍了xines DSP+FPGA异构评估板,其中Xilinx Zynq-7000系列XC7Z035/XC7Z045系列主要特性,资源框图及PS端ETHRJ45接口引脚说明
Xilinx Zynq-7000系列XC7Z035/XC7Z045高性能SoC处理器评估板PS端ETH RJ45接口
|
传感器 芯片
【Renesas RA6M4开发板之I2C读取mpu6050】
【Renesas RA6M4开发板之I2C读取mpu6050】
257 0