aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/sibyte/patches/001-rhone_physmap.patch
blob: e724a419ebd298d780ad2c7dd4ef3e081e8e3747 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--- a/arch/mips/sibyte/swarm/platform.c
+++ b/arch/mips/sibyte/swarm/platform.c
@@ -83,3 +83,61 @@ static int __init swarm_pata_init(void)
 device_initcall(swarm_pata_init);
 
 #endif /* defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_LITTLESUR) */
+
+#ifdef CONFIG_SIBYTE_RHONE
+
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
+
+static struct mtd_partition flash_parts[] = {
+	{
+		.name           = "cfe",
+		.offset         = 0x00000000,
+		.size           = 0x00200000,
+		.mask_flags     = MTD_WRITEABLE,
+	},
+	{
+		.name           = "os",
+		.offset         = 0x00200000,
+		.size           = 0x00d00000,
+	},
+	{
+		.name           = "environment",
+		.offset         = 0x00f00000,
+		.size           = 0x00100000,
+		.mask_flags     = MTD_WRITEABLE,
+	},
+};
+
+static struct physmap_flash_data flash_data = {
+	.width		= 1,
+	.nr_parts	= ARRAY_SIZE(flash_parts),
+	.parts		= flash_parts,
+};
+
+static struct resource flash_resource = {
+	.start		= 0x1fc00000,
+	.end		= 0x20bfffff,
+	.flags		= IORESOURCE_MEM,
+};
+
+static struct platform_device flash_device = {
+	.name		= "physmap-flash",
+	.id		= 0,
+	.resource	= &flash_resource,
+	.num_resources	= 1,
+	.dev		= {
+		.platform_data = &flash_data,
+	},
+};
+
+static int __init flash_setup(void)
+{
+	platform_device_register(&flash_device);
+
+	return 0;
+};
+
+device_initcall(flash_setup);
+
+#endif /* CONFIG_SIBYTE_RHONE */