| Todd Poynor | 9c517e6 | 2005-09-14 20:14:17 +0100 | [diff] [blame] | 1 | /* | 
 | 2 |  * drivers/mtd/maps/pq2fads.c | 
 | 3 |  * | 
 | 4 |  * Mapping for the flash SIMM on 8272ADS and PQ2FADS board | 
 | 5 |  * | 
 | 6 |  * Author: Vitaly Bordug <vbordug@ru.mvista.com> | 
 | 7 |  * | 
 | 8 |  * 2005 (c) MontaVista Software, Inc. This file is licensed under | 
 | 9 |  * the terms of the GNU General Public License version 2. This program | 
 | 10 |  * is licensed "as is" without any warranty of any kind, whether express | 
 | 11 |  * or implied. | 
 | 12 |  */ | 
 | 13 |  | 
 | 14 | #include <linux/module.h> | 
 | 15 | #include <linux/types.h> | 
 | 16 | #include <linux/kernel.h> | 
 | 17 | #include <linux/init.h> | 
 | 18 | #include <asm/io.h> | 
 | 19 | #include <asm/ppcboot.h> | 
 | 20 | #include <linux/mtd/mtd.h> | 
 | 21 | #include <linux/mtd/map.h> | 
 | 22 | #include <linux/mtd/partitions.h> | 
 | 23 | #include <linux/mtd/physmap.h> | 
 | 24 |  | 
 | 25 | /* | 
| Thomas Gleixner | 69f34c9 | 2005-11-07 11:15:40 +0000 | [diff] [blame] | 26 |   NOTE: bank width and interleave relative to the installed flash | 
| Todd Poynor | 9c517e6 | 2005-09-14 20:14:17 +0100 | [diff] [blame] | 27 |   should have been chosen within MTD_CFI_GEOMETRY options. | 
 | 28 |   */ | 
 | 29 | #define PQ2FADS_BANK_WIDTH 4 | 
 | 30 |  | 
 | 31 | static struct mtd_partition pq2fads_partitions[] = { | 
 | 32 | 	{ | 
 | 33 | #ifdef CONFIG_ADS8272 | 
 | 34 | 		.name		= "HRCW", | 
 | 35 | 		.size		= 0x40000, | 
 | 36 | 		.offset 	= 0, | 
 | 37 | 		.mask_flags	= MTD_WRITEABLE,  /* force read-only */ | 
| Thomas Gleixner | 69f34c9 | 2005-11-07 11:15:40 +0000 | [diff] [blame] | 38 | 	}, { | 
| Todd Poynor | 9c517e6 | 2005-09-14 20:14:17 +0100 | [diff] [blame] | 39 | 		.name		= "User FS", | 
 | 40 | 		.size		= 0x5c0000, | 
 | 41 | 		.offset 	= 0x40000, | 
 | 42 | #else | 
 | 43 | 		.name		= "User FS", | 
 | 44 | 		.size		= 0x600000, | 
 | 45 | 		.offset 	= 0, | 
 | 46 | #endif | 
| Thomas Gleixner | 69f34c9 | 2005-11-07 11:15:40 +0000 | [diff] [blame] | 47 | 	}, { | 
| Todd Poynor | 9c517e6 | 2005-09-14 20:14:17 +0100 | [diff] [blame] | 48 | 		.name		= "uImage", | 
 | 49 | 		.size		= 0x100000, | 
 | 50 | 		.offset 	= 0x600000, | 
 | 51 | 		.mask_flags	= MTD_WRITEABLE,  /* force read-only */ | 
| Thomas Gleixner | 69f34c9 | 2005-11-07 11:15:40 +0000 | [diff] [blame] | 52 | 	}, { | 
| Todd Poynor | 9c517e6 | 2005-09-14 20:14:17 +0100 | [diff] [blame] | 53 | 		.name		= "bootloader", | 
 | 54 | 		.size		= 0x40000, | 
 | 55 | 		.offset		= 0x700000, | 
 | 56 | 		.mask_flags	= MTD_WRITEABLE,  /* force read-only */ | 
| Thomas Gleixner | 69f34c9 | 2005-11-07 11:15:40 +0000 | [diff] [blame] | 57 | 	}, { | 
| Todd Poynor | 9c517e6 | 2005-09-14 20:14:17 +0100 | [diff] [blame] | 58 | 		.name		= "bootloader env", | 
 | 59 | 		.size		= 0x40000, | 
 | 60 | 		.offset		= 0x740000, | 
 | 61 | 		.mask_flags	= MTD_WRITEABLE,  /* force read-only */ | 
 | 62 | 	} | 
 | 63 | }; | 
 | 64 |  | 
 | 65 |  | 
 | 66 | /* pointer to MPC885ADS board info data */ | 
 | 67 | extern unsigned char __res[]; | 
 | 68 |  | 
 | 69 | static int __init init_pq2fads_mtd(void) | 
 | 70 | { | 
 | 71 | 	bd_t *bd = (bd_t *)__res; | 
 | 72 | 	physmap_configure(bd->bi_flashstart, bd->bi_flashsize, PQ2FADS_BANK_WIDTH, NULL); | 
 | 73 |  | 
 | 74 | 	physmap_set_partitions(pq2fads_partitions, | 
 | 75 | 				sizeof (pq2fads_partitions) / | 
 | 76 | 				sizeof (pq2fads_partitions[0])); | 
 | 77 | 	return 0; | 
 | 78 | } | 
 | 79 |  | 
 | 80 | static void __exit cleanup_pq2fads_mtd(void) | 
 | 81 | { | 
 | 82 | } | 
| Thomas Gleixner | 69f34c9 | 2005-11-07 11:15:40 +0000 | [diff] [blame] | 83 |  | 
| Todd Poynor | 9c517e6 | 2005-09-14 20:14:17 +0100 | [diff] [blame] | 84 | module_init(init_pq2fads_mtd); | 
 | 85 | module_exit(cleanup_pq2fads_mtd); | 
| Thomas Gleixner | 69f34c9 | 2005-11-07 11:15:40 +0000 | [diff] [blame] | 86 |  | 
| Todd Poynor | 9c517e6 | 2005-09-14 20:14:17 +0100 | [diff] [blame] | 87 | MODULE_LICENSE("GPL"); | 
 | 88 | MODULE_DESCRIPTION("MTD map and partitions for MPC8272ADS boards"); |