Path: blob/master/Documentation/blockdev/mflash.txt
10821 views
This document describes m[g]flash support in linux.12Contents31. Overview42. Reserved area configuration53. Example of mflash platform driver registration671. Overview89Mflash and gflash are embedded flash drive. The only difference is mflash is10MCP(Multi Chip Package) device. These two device operate exactly same way.11So the rest mflash repersents mflash and gflash altogether.1213Internally, mflash has nand flash and other hardware logics and supports142 different operation (ATA, IO) modes. ATA mode doesn't need any new15driver and currently works well under standard IDE subsystem. Actually it's16one chip SSD. IO mode is ATA-like custom mode for the host that doesn't have17IDE interface.1819Followings are brief descriptions about IO mode.20A. IO mode based on ATA protocol and uses some custom command. (read confirm,21write confirm)22B. IO mode uses SRAM bus interface.23C. IO mode supports 4kB boot area, so host can boot from mflash.24252. Reserved area configuration26If host boot from mflash, usually needs raw area for boot loader image. All of27the mflash's block device operation will be taken this value as start offset.28Note that boot loader's size of reserved area and kernel configuration value29must be same.30313. Example of mflash platform driver registration32Working mflash is very straight forward. Adding platform device stuff to board33configuration file is all. Here is some pseudo example.3435static struct mg_drv_data mflash_drv_data = {36/* If you want to polling driver set to 1 */37.use_polling = 0,38/* device attribution */39.dev_attr = MG_BOOT_DEV40};4142static struct resource mg_mflash_rsc[] = {43/* Base address of mflash */44[0] = {45.start = 0x08000000,46.end = 0x08000000 + SZ_64K - 1,47.flags = IORESOURCE_MEM48},49/* mflash interrupt pin */50[1] = {51.start = IRQ_GPIO(84),52.end = IRQ_GPIO(84),53.flags = IORESOURCE_IRQ54},55/* mflash reset pin */56[2] = {57.start = 43,58.end = 43,59.name = MG_RST_PIN,60.flags = IORESOURCE_IO61},62/* mflash reset-out pin63* If you use mflash as storage device (i.e. other than MG_BOOT_DEV),64* should assign this */65[3] = {66.start = 51,67.end = 51,68.name = MG_RSTOUT_PIN,69.flags = IORESOURCE_IO70}71};7273static struct platform_device mflash_dev = {74.name = MG_DEV_NAME,75.id = -1,76.dev = {77.platform_data = &mflash_drv_data,78},79.num_resources = ARRAY_SIZE(mg_mflash_rsc),80.resource = mg_mflash_rsc81};8283platform_device_register(&mflash_dev);848586