aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/bast-flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps/bast-flash.c')
-rw-r--r--drivers/mtd/maps/bast-flash.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/drivers/mtd/maps/bast-flash.c b/drivers/mtd/maps/bast-flash.c
index b7858eb93534..51f962dd7e31 100644
--- a/drivers/mtd/maps/bast-flash.c
+++ b/drivers/mtd/maps/bast-flash.c
@@ -63,11 +63,6 @@ struct bast_flash_info {
63 63
64static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 64static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
65 65
66static struct bast_flash_info *to_bast_info(struct device *dev)
67{
68 return (struct bast_flash_info *)dev_get_drvdata(dev);
69}
70
71static void bast_flash_setrw(int to) 66static void bast_flash_setrw(int to)
72{ 67{
73 unsigned int val; 68 unsigned int val;
@@ -87,11 +82,11 @@ static void bast_flash_setrw(int to)
87 local_irq_restore(flags); 82 local_irq_restore(flags);
88} 83}
89 84
90static int bast_flash_remove(struct device *dev) 85static int bast_flash_remove(struct platform_device *pdev)
91{ 86{
92 struct bast_flash_info *info = to_bast_info(dev); 87 struct bast_flash_info *info = platform_get_drvdata(pdev);
93 88
94 dev_set_drvdata(dev, NULL); 89 platform_set_drvdata(pdev, NULL);
95 90
96 if (info == NULL) 91 if (info == NULL)
97 return 0; 92 return 0;
@@ -116,9 +111,8 @@ static int bast_flash_remove(struct device *dev)
116 return 0; 111 return 0;
117} 112}
118 113
119static int bast_flash_probe(struct device *dev) 114static int bast_flash_probe(struct platform_device *pdev)
120{ 115{
121 struct platform_device *pdev = to_platform_device(dev);
122 struct bast_flash_info *info; 116 struct bast_flash_info *info;
123 struct resource *res; 117 struct resource *res;
124 int err = 0; 118 int err = 0;
@@ -131,13 +125,13 @@ static int bast_flash_probe(struct device *dev)
131 } 125 }
132 126
133 memzero(info, sizeof(*info)); 127 memzero(info, sizeof(*info));
134 dev_set_drvdata(dev, info); 128 platform_set_drvdata(pdev, info);
135 129
136 res = pdev->resource; /* assume that the flash has one resource */ 130 res = pdev->resource; /* assume that the flash has one resource */
137 131
138 info->map.phys = res->start; 132 info->map.phys = res->start;
139 info->map.size = res->end - res->start + 1; 133 info->map.size = res->end - res->start + 1;
140 info->map.name = dev->bus_id; 134 info->map.name = pdev->dev.bus_id;
141 info->map.bankwidth = 2; 135 info->map.bankwidth = 2;
142 136
143 if (info->map.size > AREA_MAXSIZE) 137 if (info->map.size > AREA_MAXSIZE)
@@ -199,27 +193,28 @@ static int bast_flash_probe(struct device *dev)
199 /* fall through to exit error */ 193 /* fall through to exit error */
200 194
201 exit_error: 195 exit_error:
202 bast_flash_remove(dev); 196 bast_flash_remove(pdev);
203 return err; 197 return err;
204} 198}
205 199
206static struct device_driver bast_flash_driver = { 200static struct platform_driver bast_flash_driver = {
207 .name = "bast-nor",
208 .owner = THIS_MODULE,
209 .bus = &platform_bus_type,
210 .probe = bast_flash_probe, 201 .probe = bast_flash_probe,
211 .remove = bast_flash_remove, 202 .remove = bast_flash_remove,
203 .driver = {
204 .name = "bast-nor",
205 .owner = THIS_MODULE,
206 },
212}; 207};
213 208
214static int __init bast_flash_init(void) 209static int __init bast_flash_init(void)
215{ 210{
216 printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n"); 211 printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n");
217 return driver_register(&bast_flash_driver); 212 return platform_driver_register(&bast_flash_driver);
218} 213}
219 214
220static void __exit bast_flash_exit(void) 215static void __exit bast_flash_exit(void)
221{ 216{
222 driver_unregister(&bast_flash_driver); 217 platform_driver_unregister(&bast_flash_driver);
223} 218}
224 219
225module_init(bast_flash_init); 220module_init(bast_flash_init);