Ralf Baechle | 61e84f9 | 2006-12-12 11:52:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is subject to the terms and conditions of the GNU General Public |
| 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. |
| 5 | * |
| 6 | * Copyright (C) 2006 MIPS Technologies, Inc. |
| 7 | * written by Ralf Baechle <ralf@linux-mips.org> |
| 8 | */ |
| 9 | |
| 10 | #include <linux/init.h> |
| 11 | #include <linux/platform_device.h> |
| 12 | #include <linux/mtd/partitions.h> |
| 13 | #include <linux/mtd/physmap.h> |
| 14 | #include <mtd/mtd-abi.h> |
| 15 | |
| 16 | static struct mtd_partition malta_mtd_partitions[] = { |
| 17 | { |
| 18 | .name = "YAMON", |
| 19 | .offset = 0x0, |
| 20 | .size = 0x100000, |
| 21 | .mask_flags = MTD_WRITEABLE |
| 22 | }, { |
| 23 | .name = "User FS", |
| 24 | .offset = 0x100000, |
| 25 | .size = 0x2e0000 |
| 26 | }, { |
| 27 | .name = "Board Config", |
| 28 | .offset = 0x3e0000, |
| 29 | .size = 0x020000, |
| 30 | .mask_flags = MTD_WRITEABLE |
| 31 | } |
| 32 | }; |
| 33 | |
| 34 | static struct physmap_flash_data malta_flash_data = { |
| 35 | .width = 4, |
| 36 | .nr_parts = ARRAY_SIZE(malta_mtd_partitions), |
| 37 | .parts = malta_mtd_partitions |
| 38 | }; |
| 39 | |
| 40 | static struct resource malta_flash_resource = { |
| 41 | .start = 0x1e000000, |
| 42 | .end = 0x1e3fffff, |
| 43 | .flags = IORESOURCE_MEM |
| 44 | }; |
| 45 | |
| 46 | static struct platform_device malta_flash = { |
| 47 | .name = "physmap-flash", |
| 48 | .id = 0, |
| 49 | .dev = { |
| 50 | .platform_data = &malta_flash_data, |
| 51 | }, |
| 52 | .num_resources = 1, |
| 53 | .resource = &malta_flash_resource, |
| 54 | }; |
| 55 | |
| 56 | static int __init malta_mtd_init(void) |
| 57 | { |
| 58 | platform_device_register(&malta_flash); |
| 59 | |
| 60 | return 0; |
| 61 | } |
| 62 | |
| 63 | module_init(malta_mtd_init) |