1This document describes m[g]flash support in linux. 2 3Contents 4 1. Overview 5 2. Reserved area configuration 6 3. Example of mflash platform driver registration 7 81. Overview 9 10Mflash and gflash are embedded flash drive. The only difference is mflash is 11MCP(Multi Chip Package) device. These two device operate exactly same way. 12So the rest mflash repersents mflash and gflash altogether. 13 14Internally, mflash has nand flash and other hardware logics and supports 152 different operation (ATA, IO) modes. ATA mode doesn't need any new 16driver and currently works well under standard IDE subsystem. Actually it's 17one chip SSD. IO mode is ATA-like custom mode for the host that doesn't have 18IDE interface. 19 20Followings are brief descriptions about IO mode. 21A. IO mode based on ATA protocol and uses some custom command. (read confirm, 22write confirm) 23B. IO mode uses SRAM bus interface. 24C. IO mode supports 4kB boot area, so host can boot from mflash. 25 262. Reserved area configuration 27If host boot from mflash, usually needs raw area for boot loader image. All of 28the mflash's block device operation will be taken this value as start offset. 29Note that boot loader's size of reserved area and kernel configuration value 30must be same. 31 323. Example of mflash platform driver registration 33Working mflash is very straight forward. Adding platform device stuff to board 34configuration file is all. Here is some pseudo example. 35 36static struct mg_drv_data mflash_drv_data = { 37 /* If you want to polling driver set to 1 */ 38 .use_polling = 0, 39 /* device attribution */ 40 .dev_attr = MG_BOOT_DEV 41}; 42 43static struct resource mg_mflash_rsc[] = { 44 /* Base address of mflash */ 45 [0] = { 46 .start = 0x08000000, 47 .end = 0x08000000 + SZ_64K - 1, 48 .flags = IORESOURCE_MEM 49 }, 50 /* mflash interrupt pin */ 51 [1] = { 52 .start = IRQ_GPIO(84), 53 .end = IRQ_GPIO(84), 54 .flags = IORESOURCE_IRQ 55 }, 56 /* mflash reset pin */ 57 [2] = { 58 .start = 43, 59 .end = 43, 60 .name = MG_RST_PIN, 61 .flags = IORESOURCE_IO 62 }, 63 /* mflash reset-out pin 64 * If you use mflash as storage device (i.e. other than MG_BOOT_DEV), 65 * should assign this */ 66 [3] = { 67 .start = 51, 68 .end = 51, 69 .name = MG_RSTOUT_PIN, 70 .flags = IORESOURCE_IO 71 } 72}; 73 74static struct platform_device mflash_dev = { 75 .name = MG_DEV_NAME, 76 .id = -1, 77 .dev = { 78 .platform_data = &mflash_drv_data, 79 }, 80 .num_resources = ARRAY_SIZE(mg_mflash_rsc), 81 .resource = mg_mflash_rsc 82}; 83 84platform_device_register(&mflash_dev); 85