diff options
-rw-r--r-- | drivers/mtd/nand/Kconfig | 6 | ||||
-rw-r--r-- | drivers/mtd/nand/Makefile | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/nuc900_nand.c (renamed from drivers/mtd/nand/w90p910_nand.c) | 140 |
3 files changed, 74 insertions, 74 deletions
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 7678538344f4..2dcbccb50da7 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig | |||
@@ -489,11 +489,11 @@ config MTD_NAND_SOCRATES | |||
489 | help | 489 | help |
490 | Enables support for NAND Flash chips wired onto Socrates board. | 490 | Enables support for NAND Flash chips wired onto Socrates board. |
491 | 491 | ||
492 | config MTD_NAND_W90P910 | 492 | config MTD_NAND_NUC900 |
493 | tristate "Support for NAND on w90p910 evaluation board." | 493 | tristate "Support for NAND on Nuvoton NUC9xx/w90p910 evaluation boards." |
494 | depends on ARCH_W90X900 && MTD_PARTITIONS | 494 | depends on ARCH_W90X900 && MTD_PARTITIONS |
495 | help | 495 | help |
496 | This enables the driver for the NAND Flash on evaluation board based | 496 | This enables the driver for the NAND Flash on evaluation board based |
497 | on w90p910. | 497 | on w90p910 / NUC9xx. |
498 | 498 | ||
499 | endif # MTD_NAND | 499 | endif # MTD_NAND |
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index 460a1f39a8d1..bba5addadb95 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile | |||
@@ -40,7 +40,7 @@ obj-$(CONFIG_MTD_NAND_SH_FLCTL) += sh_flctl.o | |||
40 | obj-$(CONFIG_MTD_NAND_MXC) += mxc_nand.o | 40 | obj-$(CONFIG_MTD_NAND_MXC) += mxc_nand.o |
41 | obj-$(CONFIG_MTD_NAND_SOCRATES) += socrates_nand.o | 41 | obj-$(CONFIG_MTD_NAND_SOCRATES) += socrates_nand.o |
42 | obj-$(CONFIG_MTD_NAND_TXX9NDFMC) += txx9ndfmc.o | 42 | obj-$(CONFIG_MTD_NAND_TXX9NDFMC) += txx9ndfmc.o |
43 | obj-$(CONFIG_MTD_NAND_W90P910) += w90p910_nand.o | 43 | obj-$(CONFIG_MTD_NAND_NUC900) += nuc900_nand.o |
44 | obj-$(CONFIG_MTD_NAND_NOMADIK) += nomadik_nand.o | 44 | obj-$(CONFIG_MTD_NAND_NOMADIK) += nomadik_nand.o |
45 | obj-$(CONFIG_MTD_NAND_BCM_UMI) += bcm_umi_nand.o nand_bcm_umi.o | 45 | obj-$(CONFIG_MTD_NAND_BCM_UMI) += bcm_umi_nand.o nand_bcm_umi.o |
46 | 46 | ||
diff --git a/drivers/mtd/nand/w90p910_nand.c b/drivers/mtd/nand/nuc900_nand.c index c2e9b68e4ff7..6eddf7361ed7 100644 --- a/drivers/mtd/nand/w90p910_nand.c +++ b/drivers/mtd/nand/nuc900_nand.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2009 Nuvoton technology corporation. | 2 | * Copyright © 2009 Nuvoton technology corporation. |
3 | * | 3 | * |
4 | * Wan ZongShun <mcuos.com@gmail.com> | 4 | * Wan ZongShun <mcuos.com@gmail.com> |
5 | * | 5 | * |
@@ -55,7 +55,7 @@ | |||
55 | #define write_addr_reg(dev, val) \ | 55 | #define write_addr_reg(dev, val) \ |
56 | __raw_writel((val), (dev)->reg + REG_SMADDR) | 56 | __raw_writel((val), (dev)->reg + REG_SMADDR) |
57 | 57 | ||
58 | struct w90p910_nand { | 58 | struct nuc900_nand { |
59 | struct mtd_info mtd; | 59 | struct mtd_info mtd; |
60 | struct nand_chip chip; | 60 | struct nand_chip chip; |
61 | void __iomem *reg; | 61 | void __iomem *reg; |
@@ -76,49 +76,49 @@ static const struct mtd_partition partitions[] = { | |||
76 | } | 76 | } |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static unsigned char w90p910_nand_read_byte(struct mtd_info *mtd) | 79 | static unsigned char nuc900_nand_read_byte(struct mtd_info *mtd) |
80 | { | 80 | { |
81 | unsigned char ret; | 81 | unsigned char ret; |
82 | struct w90p910_nand *nand; | 82 | struct nuc900_nand *nand; |
83 | 83 | ||
84 | nand = container_of(mtd, struct w90p910_nand, mtd); | 84 | nand = container_of(mtd, struct nuc900_nand, mtd); |
85 | 85 | ||
86 | ret = (unsigned char)read_data_reg(nand); | 86 | ret = (unsigned char)read_data_reg(nand); |
87 | 87 | ||
88 | return ret; | 88 | return ret; |
89 | } | 89 | } |
90 | 90 | ||
91 | static void w90p910_nand_read_buf(struct mtd_info *mtd, | 91 | static void nuc900_nand_read_buf(struct mtd_info *mtd, |
92 | unsigned char *buf, int len) | 92 | unsigned char *buf, int len) |
93 | { | 93 | { |
94 | int i; | 94 | int i; |
95 | struct w90p910_nand *nand; | 95 | struct nuc900_nand *nand; |
96 | 96 | ||
97 | nand = container_of(mtd, struct w90p910_nand, mtd); | 97 | nand = container_of(mtd, struct nuc900_nand, mtd); |
98 | 98 | ||
99 | for (i = 0; i < len; i++) | 99 | for (i = 0; i < len; i++) |
100 | buf[i] = (unsigned char)read_data_reg(nand); | 100 | buf[i] = (unsigned char)read_data_reg(nand); |
101 | } | 101 | } |
102 | 102 | ||
103 | static void w90p910_nand_write_buf(struct mtd_info *mtd, | 103 | static void nuc900_nand_write_buf(struct mtd_info *mtd, |
104 | const unsigned char *buf, int len) | 104 | const unsigned char *buf, int len) |
105 | { | 105 | { |
106 | int i; | 106 | int i; |
107 | struct w90p910_nand *nand; | 107 | struct nuc900_nand *nand; |
108 | 108 | ||
109 | nand = container_of(mtd, struct w90p910_nand, mtd); | 109 | nand = container_of(mtd, struct nuc900_nand, mtd); |
110 | 110 | ||
111 | for (i = 0; i < len; i++) | 111 | for (i = 0; i < len; i++) |
112 | write_data_reg(nand, buf[i]); | 112 | write_data_reg(nand, buf[i]); |
113 | } | 113 | } |
114 | 114 | ||
115 | static int w90p910_verify_buf(struct mtd_info *mtd, | 115 | static int nuc900_verify_buf(struct mtd_info *mtd, |
116 | const unsigned char *buf, int len) | 116 | const unsigned char *buf, int len) |
117 | { | 117 | { |
118 | int i; | 118 | int i; |
119 | struct w90p910_nand *nand; | 119 | struct nuc900_nand *nand; |
120 | 120 | ||
121 | nand = container_of(mtd, struct w90p910_nand, mtd); | 121 | nand = container_of(mtd, struct nuc900_nand, mtd); |
122 | 122 | ||
123 | for (i = 0; i < len; i++) { | 123 | for (i = 0; i < len; i++) { |
124 | if (buf[i] != (unsigned char)read_data_reg(nand)) | 124 | if (buf[i] != (unsigned char)read_data_reg(nand)) |
@@ -128,7 +128,7 @@ static int w90p910_verify_buf(struct mtd_info *mtd, | |||
128 | return 0; | 128 | return 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | static int w90p910_check_rb(struct w90p910_nand *nand) | 131 | static int nuc900_check_rb(struct nuc900_nand *nand) |
132 | { | 132 | { |
133 | unsigned int val; | 133 | unsigned int val; |
134 | spin_lock(&nand->lock); | 134 | spin_lock(&nand->lock); |
@@ -139,24 +139,24 @@ static int w90p910_check_rb(struct w90p910_nand *nand) | |||
139 | return val; | 139 | return val; |
140 | } | 140 | } |
141 | 141 | ||
142 | static int w90p910_nand_devready(struct mtd_info *mtd) | 142 | static int nuc900_nand_devready(struct mtd_info *mtd) |
143 | { | 143 | { |
144 | struct w90p910_nand *nand; | 144 | struct nuc900_nand *nand; |
145 | int ready; | 145 | int ready; |
146 | 146 | ||
147 | nand = container_of(mtd, struct w90p910_nand, mtd); | 147 | nand = container_of(mtd, struct nuc900_nand, mtd); |
148 | 148 | ||
149 | ready = (w90p910_check_rb(nand)) ? 1 : 0; | 149 | ready = (nuc900_check_rb(nand)) ? 1 : 0; |
150 | return ready; | 150 | return ready; |
151 | } | 151 | } |
152 | 152 | ||
153 | static void w90p910_nand_command_lp(struct mtd_info *mtd, | 153 | static void nuc900_nand_command_lp(struct mtd_info *mtd, unsigned int command, |
154 | unsigned int command, int column, int page_addr) | 154 | int column, int page_addr) |
155 | { | 155 | { |
156 | register struct nand_chip *chip = mtd->priv; | 156 | register struct nand_chip *chip = mtd->priv; |
157 | struct w90p910_nand *nand; | 157 | struct nuc900_nand *nand; |
158 | 158 | ||
159 | nand = container_of(mtd, struct w90p910_nand, mtd); | 159 | nand = container_of(mtd, struct nuc900_nand, mtd); |
160 | 160 | ||
161 | if (command == NAND_CMD_READOOB) { | 161 | if (command == NAND_CMD_READOOB) { |
162 | column += mtd->writesize; | 162 | column += mtd->writesize; |
@@ -212,7 +212,7 @@ static void w90p910_nand_command_lp(struct mtd_info *mtd, | |||
212 | write_cmd_reg(nand, NAND_CMD_STATUS); | 212 | write_cmd_reg(nand, NAND_CMD_STATUS); |
213 | write_cmd_reg(nand, command); | 213 | write_cmd_reg(nand, command); |
214 | 214 | ||
215 | while (!w90p910_check_rb(nand)) | 215 | while (!nuc900_check_rb(nand)) |
216 | ; | 216 | ; |
217 | 217 | ||
218 | return; | 218 | return; |
@@ -241,7 +241,7 @@ static void w90p910_nand_command_lp(struct mtd_info *mtd, | |||
241 | } | 241 | } |
242 | 242 | ||
243 | 243 | ||
244 | static void w90p910_nand_enable(struct w90p910_nand *nand) | 244 | static void nuc900_nand_enable(struct nuc900_nand *nand) |
245 | { | 245 | { |
246 | unsigned int val; | 246 | unsigned int val; |
247 | spin_lock(&nand->lock); | 247 | spin_lock(&nand->lock); |
@@ -262,37 +262,37 @@ static void w90p910_nand_enable(struct w90p910_nand *nand) | |||
262 | spin_unlock(&nand->lock); | 262 | spin_unlock(&nand->lock); |
263 | } | 263 | } |
264 | 264 | ||
265 | static int __devinit w90p910_nand_probe(struct platform_device *pdev) | 265 | static int __devinit nuc900_nand_probe(struct platform_device *pdev) |
266 | { | 266 | { |
267 | struct w90p910_nand *w90p910_nand; | 267 | struct nuc900_nand *nuc900_nand; |
268 | struct nand_chip *chip; | 268 | struct nand_chip *chip; |
269 | int retval; | 269 | int retval; |
270 | struct resource *res; | 270 | struct resource *res; |
271 | 271 | ||
272 | retval = 0; | 272 | retval = 0; |
273 | 273 | ||
274 | w90p910_nand = kzalloc(sizeof(struct w90p910_nand), GFP_KERNEL); | 274 | nuc900_nand = kzalloc(sizeof(struct nuc900_nand), GFP_KERNEL); |
275 | if (!w90p910_nand) | 275 | if (!nuc900_nand) |
276 | return -ENOMEM; | 276 | return -ENOMEM; |
277 | chip = &(w90p910_nand->chip); | 277 | chip = &(nuc900_nand->chip); |
278 | 278 | ||
279 | w90p910_nand->mtd.priv = chip; | 279 | nuc900_nand->mtd.priv = chip; |
280 | w90p910_nand->mtd.owner = THIS_MODULE; | 280 | nuc900_nand->mtd.owner = THIS_MODULE; |
281 | spin_lock_init(&w90p910_nand->lock); | 281 | spin_lock_init(&nuc900_nand->lock); |
282 | 282 | ||
283 | w90p910_nand->clk = clk_get(&pdev->dev, NULL); | 283 | nuc900_nand->clk = clk_get(&pdev->dev, NULL); |
284 | if (IS_ERR(w90p910_nand->clk)) { | 284 | if (IS_ERR(nuc900_nand->clk)) { |
285 | retval = -ENOENT; | 285 | retval = -ENOENT; |
286 | goto fail1; | 286 | goto fail1; |
287 | } | 287 | } |
288 | clk_enable(w90p910_nand->clk); | 288 | clk_enable(nuc900_nand->clk); |
289 | 289 | ||
290 | chip->cmdfunc = w90p910_nand_command_lp; | 290 | chip->cmdfunc = nuc900_nand_command_lp; |
291 | chip->dev_ready = w90p910_nand_devready; | 291 | chip->dev_ready = nuc900_nand_devready; |
292 | chip->read_byte = w90p910_nand_read_byte; | 292 | chip->read_byte = nuc900_nand_read_byte; |
293 | chip->write_buf = w90p910_nand_write_buf; | 293 | chip->write_buf = nuc900_nand_write_buf; |
294 | chip->read_buf = w90p910_nand_read_buf; | 294 | chip->read_buf = nuc900_nand_read_buf; |
295 | chip->verify_buf = w90p910_verify_buf; | 295 | chip->verify_buf = nuc900_verify_buf; |
296 | chip->chip_delay = 50; | 296 | chip->chip_delay = 50; |
297 | chip->options = 0; | 297 | chip->options = 0; |
298 | chip->ecc.mode = NAND_ECC_SOFT; | 298 | chip->ecc.mode = NAND_ECC_SOFT; |
@@ -308,75 +308,75 @@ static int __devinit w90p910_nand_probe(struct platform_device *pdev) | |||
308 | goto fail1; | 308 | goto fail1; |
309 | } | 309 | } |
310 | 310 | ||
311 | w90p910_nand->reg = ioremap(res->start, resource_size(res)); | 311 | nuc900_nand->reg = ioremap(res->start, resource_size(res)); |
312 | if (!w90p910_nand->reg) { | 312 | if (!nuc900_nand->reg) { |
313 | retval = -ENOMEM; | 313 | retval = -ENOMEM; |
314 | goto fail2; | 314 | goto fail2; |
315 | } | 315 | } |
316 | 316 | ||
317 | w90p910_nand_enable(w90p910_nand); | 317 | nuc900_nand_enable(nuc900_nand); |
318 | 318 | ||
319 | if (nand_scan(&(w90p910_nand->mtd), 1)) { | 319 | if (nand_scan(&(nuc900_nand->mtd), 1)) { |
320 | retval = -ENXIO; | 320 | retval = -ENXIO; |
321 | goto fail3; | 321 | goto fail3; |
322 | } | 322 | } |
323 | 323 | ||
324 | add_mtd_partitions(&(w90p910_nand->mtd), partitions, | 324 | add_mtd_partitions(&(nuc900_nand->mtd), partitions, |
325 | ARRAY_SIZE(partitions)); | 325 | ARRAY_SIZE(partitions)); |
326 | 326 | ||
327 | platform_set_drvdata(pdev, w90p910_nand); | 327 | platform_set_drvdata(pdev, nuc900_nand); |
328 | 328 | ||
329 | return retval; | 329 | return retval; |
330 | 330 | ||
331 | fail3: iounmap(w90p910_nand->reg); | 331 | fail3: iounmap(nuc900_nand->reg); |
332 | fail2: release_mem_region(res->start, resource_size(res)); | 332 | fail2: release_mem_region(res->start, resource_size(res)); |
333 | fail1: kfree(w90p910_nand); | 333 | fail1: kfree(nuc900_nand); |
334 | return retval; | 334 | return retval; |
335 | } | 335 | } |
336 | 336 | ||
337 | static int __devexit w90p910_nand_remove(struct platform_device *pdev) | 337 | static int __devexit nuc900_nand_remove(struct platform_device *pdev) |
338 | { | 338 | { |
339 | struct w90p910_nand *w90p910_nand = platform_get_drvdata(pdev); | 339 | struct nuc900_nand *nuc900_nand = platform_get_drvdata(pdev); |
340 | struct resource *res; | 340 | struct resource *res; |
341 | 341 | ||
342 | iounmap(w90p910_nand->reg); | 342 | iounmap(nuc900_nand->reg); |
343 | 343 | ||
344 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 344 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
345 | release_mem_region(res->start, resource_size(res)); | 345 | release_mem_region(res->start, resource_size(res)); |
346 | 346 | ||
347 | clk_disable(w90p910_nand->clk); | 347 | clk_disable(nuc900_nand->clk); |
348 | clk_put(w90p910_nand->clk); | 348 | clk_put(nuc900_nand->clk); |
349 | 349 | ||
350 | kfree(w90p910_nand); | 350 | kfree(nuc900_nand); |
351 | 351 | ||
352 | platform_set_drvdata(pdev, NULL); | 352 | platform_set_drvdata(pdev, NULL); |
353 | 353 | ||
354 | return 0; | 354 | return 0; |
355 | } | 355 | } |
356 | 356 | ||
357 | static struct platform_driver w90p910_nand_driver = { | 357 | static struct platform_driver nuc900_nand_driver = { |
358 | .probe = w90p910_nand_probe, | 358 | .probe = nuc900_nand_probe, |
359 | .remove = __devexit_p(w90p910_nand_remove), | 359 | .remove = __devexit_p(nuc900_nand_remove), |
360 | .driver = { | 360 | .driver = { |
361 | .name = "nuc900-fmi", | 361 | .name = "nuc900-fmi", |
362 | .owner = THIS_MODULE, | 362 | .owner = THIS_MODULE, |
363 | }, | 363 | }, |
364 | }; | 364 | }; |
365 | 365 | ||
366 | static int __init w90p910_nand_init(void) | 366 | static int __init nuc900_nand_init(void) |
367 | { | 367 | { |
368 | return platform_driver_register(&w90p910_nand_driver); | 368 | return platform_driver_register(&nuc900_nand_driver); |
369 | } | 369 | } |
370 | 370 | ||
371 | static void __exit w90p910_nand_exit(void) | 371 | static void __exit nuc900_nand_exit(void) |
372 | { | 372 | { |
373 | platform_driver_unregister(&w90p910_nand_driver); | 373 | platform_driver_unregister(&nuc900_nand_driver); |
374 | } | 374 | } |
375 | 375 | ||
376 | module_init(w90p910_nand_init); | 376 | module_init(nuc900_nand_init); |
377 | module_exit(w90p910_nand_exit); | 377 | module_exit(nuc900_nand_exit); |
378 | 378 | ||
379 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); | 379 | MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); |
380 | MODULE_DESCRIPTION("w90p910 nand driver!"); | 380 | MODULE_DESCRIPTION("w90p910/NUC9xx nand driver!"); |
381 | MODULE_LICENSE("GPL"); | 381 | MODULE_LICENSE("GPL"); |
382 | MODULE_ALIAS("platform:nuc900-fmi"); | 382 | MODULE_ALIAS("platform:nuc900-fmi"); |