2 * Bifferboard RDC321x platform devices
4 * Copyright (C) 2010 bifferos@yahoo.co.uk
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #include <linux/init.h>
24 #include <linux/mtd/physmap.h>
25 #include <linux/input.h>
27 #include <asm/rdc_boards.h>
29 static int __init
parse_bifferboard_partitions(struct mtd_info
*master
, struct mtd_partition
**pparts
, unsigned long plat_data
)
33 struct mtd_partition
*rdc_flash_parts
;
37 if (master
->size
== 0x100000)
38 kernel_len
= master
->size
- 0x10000;
40 res
= master
->read(master
, 0x4000 + 1036, 2, &len
, (char *) &tmp
);
43 kernel_len
= tmp
* master
->erasesize
;
46 rdc_flash_parts
= kzalloc(sizeof(struct mtd_partition
) * 4, GFP_KERNEL
);
48 *pparts
= rdc_flash_parts
;
50 rdc_flash_parts
[0].name
= "biffboot";
51 rdc_flash_parts
[0].offset
= master
->size
- 0x10000;
52 rdc_flash_parts
[0].size
= 0x10000;
53 rdc_flash_parts
[0].mask_flags
= MTD_WRITEABLE
;
54 rdc_flash_parts
[1].name
= "firmware";
55 rdc_flash_parts
[1].offset
= 0;
56 rdc_flash_parts
[1].size
= rdc_flash_parts
[0].offset
;
57 rdc_flash_parts
[2].name
= "kernel";
58 rdc_flash_parts
[2].offset
= 0x00000000;
59 rdc_flash_parts
[2].size
= kernel_len
;
61 if (master
->size
== 0x100000)
64 rdc_flash_parts
[3].name
= "rootfs";
65 rdc_flash_parts
[3].offset
= MTDPART_OFS_APPEND
;
66 rdc_flash_parts
[3].size
= rdc_flash_parts
[1].size
- rdc_flash_parts
[2].size
;
71 struct mtd_part_parser __initdata bifferboard_parser
= {
73 .parse_fn
= parse_bifferboard_partitions
,
74 .name
= "Bifferboard",
77 static int __init
bifferboard_setup(void)
79 return register_mtd_parser(&bifferboard_parser
);
82 arch_initcall(bifferboard_setup
);