mflash.txt 2.4 KB

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