diff options
| -rw-r--r-- | Documentation/blockdev/00-INDEX | 2 | ||||
| -rw-r--r-- | Documentation/blockdev/mflash.txt | 84 | ||||
| -rw-r--r-- | drivers/block/Kconfig | 17 | ||||
| -rw-r--r-- | drivers/block/Makefile | 1 | ||||
| -rw-r--r-- | drivers/block/mg_disk.c | 1005 | ||||
| -rw-r--r-- | include/linux/mg_disk.h | 206 |
6 files changed, 1315 insertions, 0 deletions
diff --git a/Documentation/blockdev/00-INDEX b/Documentation/blockdev/00-INDEX index 86f054c47013..c08df56dd91b 100644 --- a/Documentation/blockdev/00-INDEX +++ b/Documentation/blockdev/00-INDEX | |||
| @@ -8,6 +8,8 @@ cpqarray.txt | |||
| 8 | - info on using Compaq's SMART2 Intelligent Disk Array Controllers. | 8 | - info on using Compaq's SMART2 Intelligent Disk Array Controllers. |
| 9 | floppy.txt | 9 | floppy.txt |
| 10 | - notes and driver options for the floppy disk driver. | 10 | - notes and driver options for the floppy disk driver. |
| 11 | mflash.txt | ||
| 12 | - info on mGine m(g)flash driver for linux. | ||
| 11 | nbd.txt | 13 | nbd.txt |
| 12 | - info on a TCP implementation of a network block device. | 14 | - info on a TCP implementation of a network block device. |
| 13 | paride.txt | 15 | paride.txt |
diff --git a/Documentation/blockdev/mflash.txt b/Documentation/blockdev/mflash.txt new file mode 100644 index 000000000000..1f610ecf698a --- /dev/null +++ b/Documentation/blockdev/mflash.txt | |||
| @@ -0,0 +1,84 @@ | |||
| 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); | ||
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index e7b8aa0cb47c..ddea8e485cc9 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
| @@ -410,6 +410,23 @@ config ATA_OVER_ETH | |||
| 410 | This driver provides Support for ATA over Ethernet block | 410 | This driver provides Support for ATA over Ethernet block |
| 411 | devices like the Coraid EtherDrive (R) Storage Blade. | 411 | devices like the Coraid EtherDrive (R) Storage Blade. |
| 412 | 412 | ||
| 413 | config MG_DISK | ||
| 414 | tristate "mGine mflash, gflash support" | ||
| 415 | depends on ARM && ATA && GPIOLIB | ||
| 416 | help | ||
| 417 | mGine mFlash(gFlash) block device driver | ||
| 418 | |||
| 419 | config MG_DISK_RES | ||
| 420 | int "Size of reserved area before MBR" | ||
| 421 | depends on MG_DISK | ||
| 422 | default 0 | ||
| 423 | help | ||
| 424 | Define size of reserved area that usually used for boot. Unit is KB. | ||
| 425 | All of the block device operation will be taken this value as start | ||
| 426 | offset | ||
| 427 | Examples: | ||
| 428 | 1024 => 1 MB | ||
| 429 | |||
| 413 | config SUNVDC | 430 | config SUNVDC |
| 414 | tristate "Sun Virtual Disk Client support" | 431 | tristate "Sun Virtual Disk Client support" |
| 415 | depends on SUN_LDOMS | 432 | depends on SUN_LDOMS |
diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 3145141cef72..7755a5e2a85e 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile | |||
| @@ -21,6 +21,7 @@ obj-$(CONFIG_BLK_CPQ_CISS_DA) += cciss.o | |||
| 21 | obj-$(CONFIG_BLK_DEV_DAC960) += DAC960.o | 21 | obj-$(CONFIG_BLK_DEV_DAC960) += DAC960.o |
| 22 | obj-$(CONFIG_XILINX_SYSACE) += xsysace.o | 22 | obj-$(CONFIG_XILINX_SYSACE) += xsysace.o |
| 23 | obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o | 23 | obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o |
| 24 | obj-$(CONFIG_MG_DISK) += mg_disk.o | ||
| 24 | obj-$(CONFIG_SUNVDC) += sunvdc.o | 25 | obj-$(CONFIG_SUNVDC) += sunvdc.o |
| 25 | 26 | ||
| 26 | obj-$(CONFIG_BLK_DEV_UMEM) += umem.o | 27 | obj-$(CONFIG_BLK_DEV_UMEM) += umem.o |
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c new file mode 100644 index 000000000000..fb39d9aa3cdc --- /dev/null +++ b/drivers/block/mg_disk.c | |||
| @@ -0,0 +1,1005 @@ | |||
| 1 | /* | ||
| 2 | * drivers/block/mg_disk.c | ||
| 3 | * | ||
| 4 | * Support for the mGine m[g]flash IO mode. | ||
| 5 | * Based on legacy hd.c | ||
| 6 | * | ||
| 7 | * (c) 2008 mGine Co.,LTD | ||
| 8 | * (c) 2008 unsik Kim <donari75@gmail.com> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License version 2 as | ||
| 12 | * published by the Free Software Foundation. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <linux/kernel.h> | ||
| 16 | #include <linux/module.h> | ||
| 17 | #include <linux/fs.h> | ||
| 18 | #include <linux/blkdev.h> | ||
| 19 | #include <linux/hdreg.h> | ||
| 20 | #include <linux/libata.h> | ||
| 21 | #include <linux/interrupt.h> | ||
| 22 | #include <linux/delay.h> | ||
| 23 | #include <linux/platform_device.h> | ||
| 24 | #include <linux/gpio.h> | ||
| 25 | #include <linux/mg_disk.h> | ||
| 26 | |||
| 27 | #define MG_RES_SEC (CONFIG_MG_DISK_RES << 1) | ||
| 28 | |||
| 29 | static void mg_request(struct request_queue *); | ||
| 30 | |||
| 31 | static void mg_dump_status(const char *msg, unsigned int stat, | ||
| 32 | struct mg_host *host) | ||
| 33 | { | ||
| 34 | char *name = MG_DISK_NAME; | ||
| 35 | struct request *req; | ||
| 36 | |||
| 37 | if (host->breq) { | ||
| 38 | req = elv_next_request(host->breq); | ||
| 39 | if (req) | ||
| 40 | name = req->rq_disk->disk_name; | ||
| 41 | } | ||
| 42 | |||
| 43 | printk(KERN_ERR "%s: %s: status=0x%02x { ", name, msg, stat & 0xff); | ||
| 44 | if (stat & MG_REG_STATUS_BIT_BUSY) | ||
| 45 | printk("Busy "); | ||
| 46 | if (stat & MG_REG_STATUS_BIT_READY) | ||
| 47 | printk("DriveReady "); | ||
| 48 | if (stat & MG_REG_STATUS_BIT_WRITE_FAULT) | ||
| 49 | printk("WriteFault "); | ||
| 50 | if (stat & MG_REG_STATUS_BIT_SEEK_DONE) | ||
| 51 | printk("SeekComplete "); | ||
| 52 | if (stat & MG_REG_STATUS_BIT_DATA_REQ) | ||
| 53 | printk("DataRequest "); | ||
