Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
resources:tools-software:linuxdsp:docs:linux-kernel-and-drivers:mtd:mtd [21 Jul 2020 07:54] cathy fangresources:tools-software:linuxdsp:docs:linux-kernel-and-drivers:mtd:mtd [24 Sep 2020 05:39] (current) – [Configure Linux Kernel] cathy fang
Line 1: Line 1:
-Introduction+====== Linux MTD Driver ====== 
 +===== Introduction =====
 This section describes the steps required to build and use MTD(Memory Technology Device) subsystem on Linux using an ADSP-SC5xx board. This section describes the steps required to build and use MTD(Memory Technology Device) subsystem on Linux using an ADSP-SC5xx board.
 The MTD software stack looks like below: The MTD software stack looks like below:
- +<code> 
-<blockquote>         MTD+         MTD
 ------------------------ ------------------------
     SPI NOR framework     SPI NOR framework
Line 11: Line 12:
      SPI bus driver      SPI bus driver
 ------------------------ ------------------------
-      SPI NOR chip</blockquote+      SPI NOR chip 
-       +</code
-Hardware Required +===== Hardware Setup ===== 
-An ADSP-SC5xx EZ-Board: + An ADSP-SC5xx EZ-Board: 
-ADSP-SC589 Ezkit v1.1 and above, or, +   *ADSP-SC589 Ezkit v1.1 and above, or, 
-ADSP-SC584 Ezkit v1.0 and above, or, +   *ADSP-SC584 Ezkit v1.0 and above, or, 
-ADSP-SC573 Ezkit v1.2 (BOM 1.8) and above+   *ADSP-SC573 Ezkit v1.2 (BOM 1.8) and above 
 +   *ADSP-SC589 MINI v1.4 and above 
 + 
 +===== Software Configuration ===== 
 +==== Configure Linux Kernel ==== 
 +The following configuration should be done on top of the SC589-ezkit/SC584-ezkit/SC573-ezkit/SC589-mini default configuration. 
 +Run bitbake linux-adi -c menuconfig and configure the kernel as follows: 
 +Enable MTD and SPI NOR flash w25x driver.  
 +<code> 
 +Device Drivers  ---> 
 +    <*> Memory Technology Device (MTD) support  --->  
 + 
 +        <*>   Command line partition table parsing 
 +        <*>   Caching block device access to MTD devices 
 +        <*>   SPI-NOR device support  ---> 
 +        Self-contained MTD device drivers  --->  
 +            <*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...) 
 +</code> 
 +Enable JFFS2 filesystem support. 
 +<code> 
 +File systems  ---> 
 +    [*] Miscellaneous filesystems  ---> 
 +        <*>   Journalling Flash File System v2 (JFFS2) support 
 +</code> 
 +==== Enable Packages ==== 
 +Enable the mtd-utils and mtd-utils-ubifs support, it's enabled in adsp-sc5xx-full image by default. 
 +<code> 
 +vim build/conf/local.conf 
 +IMAGE_INSTALL_append = "mtd-utils mtd-utils-ubifs" 
 +</code> 
 + 
 +===== Example ===== 
 +Get the MTD device info. 
 +<code> 
 +# cat /proc/mtd  
 +dev:    size   erasesize  name  
 +mtd0: 00080000 00001000 "uboot (spi)"  
 +mtd1: 00580000 00001000 "kernel (spi)"  
 +mtd2: 00a00000 00001000 "root file system (spi)"  
 +# mtdinfo  
 +Count of MTD devices:           3  
 +Present MTD devices:            mtd0, mtd1, mtd2  
 +Sysfs interface supported:      yes  
 +# mtdinfo /dev/mtd0  
 +mtd0  
 +Name:                           uboot (spi)  
 +Type:                           nor  
 +Eraseblock size:                4096 bytes, 4.0 KiB  
 +Amount of eraseblocks:          128 (524288 bytes, 512.0 KiB)  
 +Minimum input/output unit size: 1 byte  
 +Sub-page size:                  1 byte  
 +Character device major/minor:   90:0  
 +Bad blocks are allowed:         false  
 +Device is writable:             true  
 +</code> 
 +Erase the MTD device. 
 +<code> 
 +# flash_erase -j -q /dev/mtd1 0 0 
 +</code> 
 +Mount the MTD device. 
 +<code> 
 +# mount -t jffs2 /dev/mtdblock1 /mnt 
 +</code> 
 +Read and Write data to the MTD device. 
 +<code> 
 +# echo hello > /mnt/test 
 +# cat /mnt/test  
 +hello 
 +</code>  
 +Unmount the MTD device. 
 +<code> 
 +# umount /mnt 
 +</code>
  
-Software Configuration +---- 
-The following configuration should be done on top of the SC589-ezkit/SC584-ezkit/SC573-ezkit default configuration.+**Back to** [[resources:tools-software/linuxdsp/docs/linux-kernel-and-drivers/start|Kernel Features and Device Drivers for ADSP-SC5xx Yocto Linux]]
resources/tools-software/linuxdsp/docs/linux-kernel-and-drivers/mtd/mtd.1595310875.txt.gz · Last modified: 21 Jul 2020 07:54 by cathy fang