This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
resources:tools-software:linuxdsp:docs:linux-kernel-and-drivers:mtd:mtd [21 Jul 2020 07:54] – cathy fang | resources: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 | + | ===== Hardware |
- | 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 |
+ | | ||
+ | |||
+ | ===== Software Configuration ===== | ||
+ | ==== Configure Linux Kernel ==== | ||
+ | The following configuration should be done on top of the SC589-ezkit/ | ||
+ | Run bitbake linux-adi -c menuconfig and configure the kernel as follows: | ||
+ | Enable MTD and SPI NOR flash w25x driver. | ||
+ | < | ||
+ | Device Drivers | ||
+ | <*> Memory Technology Device (MTD) support | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | Self-contained MTD device drivers | ||
+ | <*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...) | ||
+ | </ | ||
+ | Enable JFFS2 filesystem support. | ||
+ | < | ||
+ | File systems | ||
+ | [*] Miscellaneous filesystems | ||
+ | < | ||
+ | </ | ||
+ | ==== Enable Packages ==== | ||
+ | Enable the mtd-utils and mtd-utils-ubifs support, it's enabled in adsp-sc5xx-full image by default. | ||
+ | < | ||
+ | vim build/ | ||
+ | IMAGE_INSTALL_append = " | ||
+ | </ | ||
+ | |||
+ | ===== Example ===== | ||
+ | Get the MTD device info. | ||
+ | < | ||
+ | # cat /proc/mtd | ||
+ | dev: size | ||
+ | mtd0: 00080000 00001000 "uboot (spi)" | ||
+ | mtd1: 00580000 00001000 " | ||
+ | mtd2: 00a00000 00001000 "root file system (spi)" | ||
+ | # mtdinfo | ||
+ | Count of MTD devices: | ||
+ | Present MTD devices: | ||
+ | Sysfs interface supported: | ||
+ | # mtdinfo /dev/mtd0 | ||
+ | mtd0 | ||
+ | Name: uboot (spi) | ||
+ | Type: nor | ||
+ | Eraseblock size: 4096 bytes, 4.0 KiB | ||
+ | Amount of eraseblocks: | ||
+ | Minimum input/ | ||
+ | Sub-page size: 1 byte | ||
+ | Character device major/ | ||
+ | Bad blocks are allowed: | ||
+ | Device is writable: | ||
+ | </ | ||
+ | Erase the MTD device. | ||
+ | < | ||
+ | # flash_erase -j -q /dev/mtd1 0 0 | ||
+ | </ | ||
+ | Mount the MTD device. | ||
+ | < | ||
+ | # mount -t jffs2 / | ||
+ | </ | ||
+ | Read and Write data to the MTD device. | ||
+ | < | ||
+ | # echo hello > /mnt/test | ||
+ | # cat /mnt/test | ||
+ | hello | ||
+ | </ | ||
+ | Unmount the MTD device. | ||
+ | < | ||
+ | # umount /mnt | ||
+ | </ | ||
- | Software Configuration | + | ---- |
- | The following configuration should be done on top of the SC589-ezkit/SC584-ezkit/SC573-ezkit default configuration. | + | **Back to** [[resources: |