1 /* Flash mappings for the MB93090-MB00 motherboard
2  *
3  * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved.
4  * Written by David Howells (dhowells@redhat.com)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public Licence
8  * as published by the Free Software Foundation; either version
9  * 2 of the Licence, or (at your option) any later version.
10  */
11 
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/mtd/physmap.h>
16 
17 #define MB93090_BOOTROM_ADDR	0xFF000000	/* Boot ROM */
18 #define MB93090_BOOTROM_SIZE	(2 * 1024 * 1024)
19 #define MB93090_USERROM_ADDR	0xFF200000	/* User ROM */
20 #define MB93090_USERROM_SIZE	(2 * 1024 * 1024)
21 
22 /*
23  * default MTD partition table for both main flash devices, expected to be
24  * overridden by RedBoot
25  */
26 static struct mtd_partition mb93090_partitions[] = {
27 	{
28 		.name		= "Filesystem",
29 		.size		= MTDPART_SIZ_FULL,
30 		.offset		= 0,
31 	}
32 };
33 
34 /*
35  * Definition of the MB93090 Boot ROM (on the CPU card)
36  */
37 static struct physmap_flash_data mb93090_bootrom_data = {
38 	.width		= 2,
39 	.nr_parts	= 2,
40 	.parts		= mb93090_partitions,
41 };
42 
43 static struct resource mb93090_bootrom_resource = {
44 	.start		= MB93090_BOOTROM_ADDR,
45 	.end		= MB93090_BOOTROM_ADDR + MB93090_BOOTROM_SIZE - 1,
46 	.flags		= IORESOURCE_MEM,
47 };
48 
49 static struct platform_device mb93090_bootrom = {
50 	.name		= "physmap-flash",
51 	.id		= 0,
52 	.dev.platform_data = &mb93090_bootrom_data,
53 	.num_resources	= 1,
54 	.resource	= &mb93090_bootrom_resource,
55 };
56 
57 /*
58  * Definition of the MB93090 User ROM definition (on the motherboard)
59  */
60 static struct physmap_flash_data mb93090_userrom_data = {
61 	.width		= 2,
62 	.nr_parts	= 2,
63 	.parts		= mb93090_partitions,
64 };
65 
66 static struct resource mb93090_userrom_resource = {
67 	.start		= MB93090_USERROM_ADDR,
68 	.end		= MB93090_USERROM_ADDR + MB93090_USERROM_SIZE - 1,
69 	.flags		= IORESOURCE_MEM,
70 };
71 
72 static struct platform_device mb93090_userrom = {
73 	.name		= "physmap-flash",
74 	.id		= 1,
75 	.dev.platform_data = &mb93090_userrom_data,
76 	.num_resources	= 1,
77 	.resource	= &mb93090_userrom_resource,
78 };
79 
80 /*
81  * register the MB93090 flashes
82  */
mb93090_mtd_init(void)83 static int __init mb93090_mtd_init(void)
84 {
85 	platform_device_register(&mb93090_bootrom);
86 	platform_device_register(&mb93090_userrom);
87 	return 0;
88 }
89 
90 module_init(mb93090_mtd_init);
91