aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/sa1100-flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps/sa1100-flash.c')
-rw-r--r--drivers/mtd/maps/sa1100-flash.c130
1 files changed, 15 insertions, 115 deletions
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 502821997707..a675bdbcb0fe 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -23,106 +23,6 @@
23#include <asm/sizes.h> 23#include <asm/sizes.h>
24#include <asm/mach/flash.h> 24#include <asm/mach/flash.h>
25 25
26#if 0
27/*
28 * This is here for documentation purposes only - until these people
29 * submit their machine types. It will be gone January 2005.
30 */
31static struct mtd_partition consus_partitions[] = {
32 {
33 .name = "Consus boot firmware",
34 .offset = 0,
35 .size = 0x00040000,
36 .mask_flags = MTD_WRITABLE, /* force read-only */
37 }, {
38 .name = "Consus kernel",
39 .offset = 0x00040000,
40 .size = 0x00100000,
41 .mask_flags = 0,
42 }, {
43 .name = "Consus disk",
44 .offset = 0x00140000,
45 /* The rest (up to 16M) for jffs. We could put 0 and
46 make it find the size automatically, but right now
47 i have 32 megs. jffs will use all 32 megs if given
48 the chance, and this leads to horrible problems
49 when you try to re-flash the image because blob
50 won't erase the whole partition. */
51 .size = 0x01000000 - 0x00140000,
52 .mask_flags = 0,
53 }, {
54 /* this disk is a secondary disk, which can be used as
55 needed, for simplicity, make it the size of the other
56 consus partition, although realistically it could be
57 the remainder of the disk (depending on the file
58 system used) */
59 .name = "Consus disk2",
60 .offset = 0x01000000,
61 .size = 0x01000000 - 0x00140000,
62 .mask_flags = 0,
63 }
64};
65
66/* Frodo has 2 x 16M 28F128J3A flash chips in bank 0: */
67static struct mtd_partition frodo_partitions[] =
68{
69 {
70 .name = "bootloader",
71 .size = 0x00040000,
72 .offset = 0x00000000,
73 .mask_flags = MTD_WRITEABLE
74 }, {
75 .name = "bootloader params",
76 .size = 0x00040000,
77 .offset = MTDPART_OFS_APPEND,
78 .mask_flags = MTD_WRITEABLE
79 }, {
80 .name = "kernel",
81 .size = 0x00100000,
82 .offset = MTDPART_OFS_APPEND,
83 .mask_flags = MTD_WRITEABLE
84 }, {
85 .name = "ramdisk",
86 .size = 0x00400000,
87 .offset = MTDPART_OFS_APPEND,
88 .mask_flags = MTD_WRITEABLE
89 }, {
90 .name = "file system",
91 .size = MTDPART_SIZ_FULL,
92 .offset = MTDPART_OFS_APPEND
93 }
94};
95
96static struct mtd_partition jornada56x_partitions[] = {
97 {
98 .name = "bootldr",
99 .size = 0x00040000,
100 .offset = 0,
101 .mask_flags = MTD_WRITEABLE,
102 }, {
103 .name = "rootfs",
104 .size = MTDPART_SIZ_FULL,
105 .offset = MTDPART_OFS_APPEND,
106 }
107};
108
109static void jornada56x_set_vpp(int vpp)
110{
111 if (vpp)
112 GPSR = GPIO_GPIO26;
113 else
114 GPCR = GPIO_GPIO26;
115 GPDR |= GPIO_GPIO26;
116}
117
118/*
119 * Machine Phys Size set_vpp
120 * Consus : SA1100_CS0_PHYS SZ_32M
121 * Frodo : SA1100_CS0_PHYS SZ_32M
122 * Jornada56x: SA1100_CS0_PHYS SZ_32M jornada56x_set_vpp
123 */
124#endif
125
126struct sa_subdev_info { 26struct sa_subdev_info {
127 char name[16]; 27 char name[16];
128 struct map_info map; 28 struct map_info map;
@@ -136,10 +36,22 @@ struct sa_info {
136 struct sa_subdev_info subdev[0]; 36 struct sa_subdev_info subdev[0];
137}; 37};
138 38
39static DEFINE_SPINLOCK(sa1100_vpp_lock);
40static int sa1100_vpp_refcnt;
139static void sa1100_set_vpp(struct map_info *map, int on) 41static void sa1100_set_vpp(struct map_info *map, int on)
140{ 42{
141 struct sa_subdev_info *subdev = container_of(map, struct sa_subdev_info, map); 43 struct sa_subdev_info *subdev = container_of(map, struct sa_subdev_info, map);
142 subdev->plat->set_vpp(on); 44 unsigned long flags;
45
46 spin_lock_irqsave(&sa1100_vpp_lock, flags);
47 if (on) {
48 if (++sa1100_vpp_refcnt == 1) /* first nested 'on' */
49 subdev->plat->set_vpp(1);
50 } else {
51 if (--sa1100_vpp_refcnt == 0) /* last nested 'off' */
52 subdev->plat->set_vpp(0);
53 }
54 spin_unlock_irqrestore(&sa1100_vpp_lock, flags);
143} 55}
144 56
145static void sa1100_destroy_subdev(struct sa_subdev_info *subdev) 57static void sa1100_destroy_subdev(struct sa_subdev_info *subdev)
@@ -352,8 +264,8 @@ static int __devinit sa1100_mtd_probe(struct platform_device *pdev)
352 /* 264 /*
353 * Partition selection stuff. 265 * Partition selection stuff.
354 */ 266 */
355 mtd_device_parse_register(info->mtd, part_probes, 0, 267 mtd_device_parse_register(info->mtd, part_probes, NULL, plat->parts,
356 plat->parts, plat->nr_parts); 268 plat->nr_parts);
357 269
358 platform_set_drvdata(pdev, info); 270 platform_set_drvdata(pdev, info);
359 err = 0; 271 err = 0;
@@ -373,21 +285,9 @@ static int __exit sa1100_mtd_remove(struct platform_device *pdev)
373 return 0; 285 return 0;
374} 286}
375 287
376#ifdef CONFIG_PM
377static void sa1100_mtd_shutdown(struct platform_device *dev)
378{
379 struct sa_info *info = platform_get_drvdata(dev);
380 if (info && mtd_suspend(info->mtd) == 0)
381 mtd_resume(info->mtd);
382}
383#else
384#define sa1100_mtd_shutdown NULL
385#endif
386
387static struct platform_driver sa1100_mtd_driver = { 288static struct platform_driver sa1100_mtd_driver = {
388 .probe = sa1100_mtd_probe, 289 .probe = sa1100_mtd_probe,
389 .remove = __exit_p(sa1100_mtd_remove), 290 .remove = __exit_p(sa1100_mtd_remove),
390 .shutdown = sa1100_mtd_shutdown,
391 .driver = { 291 .driver = {
392 .name = "sa1100-mtd", 292 .name = "sa1100-mtd",
393 .owner = THIS_MODULE, 293 .owner = THIS_MODULE,