About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

Documentation / blockdev / mflash.txt


Based on kernel version 4.10.8. Page generated on 2017-04-01 14:42 EST.

1	This document describes m[g]flash support in linux.
2	
3	Contents
4	  1. Overview
5	  2. Reserved area configuration
6	  3. Example of mflash platform driver registration
7	
8	1. Overview
9	
10	Mflash and gflash are embedded flash drive. The only difference is mflash is
11	MCP(Multi Chip Package) device. These two device operate exactly same way.
12	So the rest mflash repersents mflash and gflash altogether.
13	
14	Internally, mflash has nand flash and other hardware logics and supports
15	2 different operation (ATA, IO) modes. ATA mode doesn't need any new
16	driver and currently works well under standard IDE subsystem. Actually it's
17	one chip SSD. IO mode is ATA-like custom mode for the host that doesn't have
18	IDE interface.
19	
20	Followings are brief descriptions about IO mode.
21	A. IO mode based on ATA protocol and uses some custom command. (read confirm,
22	write confirm)
23	B. IO mode uses SRAM bus interface.
24	C. IO mode supports 4kB boot area, so host can boot from mflash.
25	
26	2. Reserved area configuration
27	If host boot from mflash, usually needs raw area for boot loader image. All of
28	the mflash's block device operation will be taken this value as start offset.
29	Note that boot loader's size of reserved area and kernel configuration value
30	must be same.
31	
32	3. Example of mflash platform driver registration
33	Working mflash is very straight forward. Adding platform device stuff to board
34	configuration file is all. Here is some pseudo example.
35	
36	static 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	
43	static 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	
74	static 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	
84	platform_device_register(&mflash_dev);
Hide Line Numbers


About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog