1 /* linux/drivers/mtd/nand/s3c2410.c
3 * Copyright (c) 2004,2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/SWLINUX/
5 * Ben Dooks <ben@simtec.co.uk>
7 * Samsung S3C2410/S3C240 NAND driver
10 * 21-Sep-2004 BJD Initial version
11 * 23-Sep-2004 BJD Mulitple device support
12 * 28-Sep-2004 BJD Fixed ECC placement for Hardware mode
13 * 12-Oct-2004 BJD Fixed errors in use of platform data
14 * 18-Feb-2005 BJD Fix sparse errors
15 * 14-Mar-2005 BJD Applied tglx's code reduction patch
16 * 02-May-2005 BJD Fixed s3c2440 support
17 * 02-May-2005 BJD Reduced hwcontrol decode
18 * 20-Jun-2005 BJD Updated s3c2440 support, fixed timing bug
19 * 08-Jul-2005 BJD Fix OOPS when no platform data supplied
20 * 20-Oct-2005 BJD Fix timing calculation bug
21 * 14-Jan-2006 BJD Allow clock to be stopped when idle
23 * $Id: s3c2410.c,v 1.23 2006/04/01 18:06:29 bjd Exp $
25 * This program is free software; you can redistribute it and/or modify
26 * it under the terms of the GNU General Public License as published by
27 * the Free Software Foundation; either version 2 of the License, or
28 * (at your option) any later version.
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public License
36 * along with this program; if not, write to the Free Software
37 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
40 #ifdef CONFIG_MTD_NAND_S3C2410_DEBUG
44 #include <linux/module.h>
45 #include <linux/types.h>
46 #include <linux/init.h>
47 #include <linux/kernel.h>
48 #include <linux/string.h>
49 #include <linux/ioport.h>
50 #include <linux/platform_device.h>
51 #include <linux/delay.h>
52 #include <linux/err.h>
53 #include <linux/slab.h>
54 #include <linux/clk.h>
56 #include <linux/mtd/mtd.h>
57 #include <linux/mtd/nand.h>
58 #include <linux/mtd/nand_ecc.h>
59 #include <linux/mtd/partitions.h>
63 #include <asm/arch/regs-nand.h>
64 #include <asm/arch/nand.h>
66 #ifdef CONFIG_MTD_NAND_S3C2410_HWECC
67 static int hardware_ecc = 1;
69 static int hardware_ecc = 0;
72 #ifdef CONFIG_MTD_NAND_S3C2410_CLKSTOP
73 static int clock_stop = 1;
75 static const int clock_stop = 0;
79 /* new oob placement block for use with hardware ecc generation
82 static struct nand_ecclayout nand_hw_eccoob = {
88 /* controller and mtd information */
90 struct s3c2410_nand_info;
92 struct s3c2410_nand_mtd {
94 struct nand_chip chip;
95 struct s3c2410_nand_set *set;
96 struct s3c2410_nand_info *info;
106 /* overview of the s3c2410 nand state */
108 struct s3c2410_nand_info {
110 struct nand_hw_control controller;
111 struct s3c2410_nand_mtd *mtds;
112 struct s3c2410_platform_nand *platform;
115 struct device *device;
116 struct resource *area;
119 void __iomem *sel_reg;
123 enum s3c_cpu_type cpu_type;
126 /* conversion functions */
128 static struct s3c2410_nand_mtd *s3c2410_nand_mtd_toours(struct mtd_info *mtd)
130 return container_of(mtd, struct s3c2410_nand_mtd, mtd);
133 static struct s3c2410_nand_info *s3c2410_nand_mtd_toinfo(struct mtd_info *mtd)
135 return s3c2410_nand_mtd_toours(mtd)->info;
138 static struct s3c2410_nand_info *to_nand_info(struct platform_device *dev)
140 return platform_get_drvdata(dev);
143 static struct s3c2410_platform_nand *to_nand_plat(struct platform_device *dev)
145 return dev->dev.platform_data;
148 static inline int allow_clk_stop(struct s3c2410_nand_info *info)
153 /* timing calculations */
155 #define NS_IN_KHZ 1000000
157 static int s3c_nand_calc_rate(int wanted, unsigned long clk, int max)
161 result = (wanted * clk) / NS_IN_KHZ;
164 pr_debug("result %d from %ld, %d\n", result, clk, wanted);
167 printk("%d ns is too big for current clock rate %ld\n", wanted, clk);
177 #define to_ns(ticks,clk) (((ticks) * NS_IN_KHZ) / (unsigned int)(clk))
179 /* controller setup */
181 static int s3c2410_nand_inithw(struct s3c2410_nand_info *info,
182 struct platform_device *pdev)
184 struct s3c2410_platform_nand *plat = to_nand_plat(pdev);
185 unsigned long clkrate = clk_get_rate(info->clk);
186 int tacls_max = (info->cpu_type == TYPE_S3C2412) ? 8 : 4;
187 int tacls, twrph0, twrph1;
188 unsigned long cfg = 0;
190 /* calculate the timing information for the controller */
192 clkrate /= 1000; /* turn clock into kHz for ease of use */
195 tacls = s3c_nand_calc_rate(plat->tacls, clkrate, tacls_max);
196 twrph0 = s3c_nand_calc_rate(plat->twrph0, clkrate, 8);
197 twrph1 = s3c_nand_calc_rate(plat->twrph1, clkrate, 8);
199 /* default timings */
205 if (tacls < 0 || twrph0 < 0 || twrph1 < 0) {
206 dev_err(info->device, "cannot get suitable timings\n");
210 dev_info(info->device, "Tacls=%d, %dns Twrph0=%d %dns, Twrph1=%d %dns\n",
211 tacls, to_ns(tacls, clkrate), twrph0, to_ns(twrph0, clkrate), twrph1, to_ns(twrph1, clkrate));
213 switch (info->cpu_type) {
215 cfg = S3C2410_NFCONF_EN;
216 cfg |= S3C2410_NFCONF_TACLS(tacls - 1);
217 cfg |= S3C2410_NFCONF_TWRPH0(twrph0 - 1);
218 cfg |= S3C2410_NFCONF_TWRPH1(twrph1 - 1);
223 cfg = S3C2440_NFCONF_TACLS(tacls - 1);
224 cfg |= S3C2440_NFCONF_TWRPH0(twrph0 - 1);
225 cfg |= S3C2440_NFCONF_TWRPH1(twrph1 - 1);
227 /* enable the controller and de-assert nFCE */
229 writel(S3C2440_NFCONT_ENABLE, info->regs + S3C2440_NFCONT);
232 dev_dbg(info->device, "NF_CONF is 0x%lx\n", cfg);
234 writel(cfg, info->regs + S3C2410_NFCONF);
240 static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip)
242 struct s3c2410_nand_info *info;
243 struct s3c2410_nand_mtd *nmtd;
244 struct nand_chip *this = mtd->priv;
250 if (chip != -1 && allow_clk_stop(info))
251 clk_enable(info->clk);
253 cur = readl(info->sel_reg);
256 cur |= info->sel_bit;
258 if (nmtd->set != NULL && chip > nmtd->set->nr_chips) {
259 dev_err(info->device, "invalid chip %d\n", chip);
263 if (info->platform != NULL) {
264 if (info->platform->select_chip != NULL)
265 (info->platform->select_chip) (nmtd->set, chip);
268 cur &= ~info->sel_bit;
271 writel(cur, info->sel_reg);
273 if (chip == -1 && allow_clk_stop(info))
274 clk_disable(info->clk);
277 /* s3c2410_nand_hwcontrol
279 * Issue command and address cycles to the chip
282 static void s3c2410_nand_hwcontrol(struct mtd_info *mtd, int cmd,
285 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
287 if (cmd == NAND_CMD_NONE)
291 writeb(cmd, info->regs + S3C2410_NFCMD);
293 writeb(cmd, info->regs + S3C2410_NFADDR);
296 /* command and control functions */
298 static void s3c2440_nand_hwcontrol(struct mtd_info *mtd, int cmd,
301 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
303 if (cmd == NAND_CMD_NONE)
307 writeb(cmd, info->regs + S3C2440_NFCMD);
309 writeb(cmd, info->regs + S3C2440_NFADDR);
312 /* s3c2410_nand_devready()
314 * returns 0 if the nand is busy, 1 if it is ready
317 static int s3c2410_nand_devready(struct mtd_info *mtd)
319 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
320 return readb(info->regs + S3C2410_NFSTAT) & S3C2410_NFSTAT_BUSY;
323 static int s3c2440_nand_devready(struct mtd_info *mtd)
325 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
326 return readb(info->regs + S3C2440_NFSTAT) & S3C2440_NFSTAT_READY;
329 static int s3c2412_nand_devready(struct mtd_info *mtd)
331 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
332 return readb(info->regs + S3C2412_NFSTAT) & S3C2412_NFSTAT_READY;
335 /* ECC handling functions */
337 static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
338 u_char *read_ecc, u_char *calc_ecc)
340 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
341 unsigned int diff0, diff1, diff2;
342 unsigned int bit, byte;
344 pr_debug("%s(%p,%p,%p,%p)\n", __func__, mtd, dat, read_ecc, calc_ecc);
346 diff0 = read_ecc[0] ^ calc_ecc[0];
347 diff1 = read_ecc[1] ^ calc_ecc[1];
348 diff2 = read_ecc[2] ^ calc_ecc[2];
350 pr_debug("%s: rd %02x%02x%02x calc %02x%02x%02x diff %02x%02x%02x\n",
352 read_ecc[0], read_ecc[1], read_ecc[2],
353 calc_ecc[0], calc_ecc[1], calc_ecc[2],
354 diff0, diff1, diff2);
356 if (diff0 == 0 && diff1 == 0 && diff2 == 0)
357 return 0; /* ECC is ok */
359 /* Can we correct this ECC (ie, one row and column change).
360 * Note, this is similar to the 256 error code on smartmedia */
362 if (((diff0 ^ (diff0 >> 1)) & 0x55) == 0x55 &&
363 ((diff1 ^ (diff1 >> 1)) & 0x55) == 0x55 &&
364 ((diff2 ^ (diff2 >> 1)) & 0x55) == 0x55) {
365 /* calculate the bit position of the error */
367 bit = (diff2 >> 2) & 1;
368 bit |= (diff2 >> 3) & 2;
369 bit |= (diff2 >> 4) & 4;
371 /* calculate the byte position of the error */
373 byte = (diff1 << 1) & 0x80;
374 byte |= (diff1 << 2) & 0x40;
375 byte |= (diff1 << 3) & 0x20;
376 byte |= (diff1 << 4) & 0x10;
378 byte |= (diff0 >> 3) & 0x08;
379 byte |= (diff0 >> 2) & 0x04;
380 byte |= (diff0 >> 1) & 0x02;
381 byte |= (diff0 >> 0) & 0x01;
383 byte |= (diff2 << 8) & 0x100;
385 dev_dbg(info->device, "correcting error bit %d, byte %d\n",
388 dat[byte] ^= (1 << bit);
392 /* if there is only one bit difference in the ECC, then
393 * one of only a row or column parity has changed, which
394 * means the error is most probably in the ECC itself */
396 diff0 |= (diff1 << 8);
397 diff0 |= (diff2 << 16);
399 if ((diff0 & ~(1<<fls(diff0))) == 0)
407 * These allow the s3c2410 and s3c2440 to use the controller's ECC
408 * generator block to ECC the data as it passes through]
411 static void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
413 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
416 ctrl = readl(info->regs + S3C2410_NFCONF);
417 ctrl |= S3C2410_NFCONF_INITECC;
418 writel(ctrl, info->regs + S3C2410_NFCONF);
421 static void s3c2412_nand_enable_hwecc(struct mtd_info *mtd, int mode)
423 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
426 ctrl = readl(info->regs + S3C2440_NFCONT);
427 writel(ctrl | S3C2412_NFCONT_INIT_MAIN_ECC, info->regs + S3C2440_NFCONT);
430 static void s3c2440_nand_enable_hwecc(struct mtd_info *mtd, int mode)
432 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
435 ctrl = readl(info->regs + S3C2440_NFCONT);
436 writel(ctrl | S3C2440_NFCONT_INITECC, info->regs + S3C2440_NFCONT);
439 static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
441 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
443 ecc_code[0] = readb(info->regs + S3C2410_NFECC + 0);
444 ecc_code[1] = readb(info->regs + S3C2410_NFECC + 1);
445 ecc_code[2] = readb(info->regs + S3C2410_NFECC + 2);
447 pr_debug("%s: returning ecc %02x%02x%02x\n", __func__,
448 ecc_code[0], ecc_code[1], ecc_code[2]);
453 static int s3c2412_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
455 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
456 unsigned long ecc = readl(info->regs + S3C2412_NFMECC0);
459 ecc_code[1] = ecc >> 8;
460 ecc_code[2] = ecc >> 16;
462 pr_debug("calculate_ecc: returning ecc %02x,%02x,%02x\n", ecc_code[0], ecc_code[1], ecc_code[2]);
467 static int s3c2440_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
469 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
470 unsigned long ecc = readl(info->regs + S3C2440_NFMECC0);
473 ecc_code[1] = ecc >> 8;
474 ecc_code[2] = ecc >> 16;
476 pr_debug("%s: returning ecc %06lx\n", __func__, ecc);
481 /* over-ride the standard functions for a little more speed. We can
482 * use read/write block to move the data buffers to/from the controller
485 static void s3c2410_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
487 struct nand_chip *this = mtd->priv;
488 readsb(this->IO_ADDR_R, buf, len);
491 static void s3c2410_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
493 struct nand_chip *this = mtd->priv;
494 writesb(this->IO_ADDR_W, buf, len);
497 /* device management functions */
499 static int s3c2410_nand_remove(struct platform_device *pdev)
501 struct s3c2410_nand_info *info = to_nand_info(pdev);
503 platform_set_drvdata(pdev, NULL);
508 /* first thing we need to do is release all our mtds
509 * and their partitions, then go through freeing the
513 if (info->mtds != NULL) {
514 struct s3c2410_nand_mtd *ptr = info->mtds;
517 for (mtdno = 0; mtdno < info->mtd_count; mtdno++, ptr++) {
518 pr_debug("releasing mtd %d (%p)\n", mtdno, ptr);
519 nand_release(&ptr->mtd);
525 /* free the common resources */
527 if (info->clk != NULL && !IS_ERR(info->clk)) {
528 if (!allow_clk_stop(info))
529 clk_disable(info->clk);
533 if (info->regs != NULL) {
538 if (info->area != NULL) {
539 release_resource(info->area);
549 #ifdef CONFIG_MTD_PARTITIONS
550 static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info,
551 struct s3c2410_nand_mtd *mtd,
552 struct s3c2410_nand_set *set)
555 return add_mtd_device(&mtd->mtd);
557 if (set->nr_partitions > 0 && set->partitions != NULL) {
558 return add_mtd_partitions(&mtd->mtd, set->partitions, set->nr_partitions);
561 return add_mtd_device(&mtd->mtd);
564 static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info,
565 struct s3c2410_nand_mtd *mtd,
566 struct s3c2410_nand_set *set)
568 return add_mtd_device(&mtd->mtd);
572 /* s3c2410_nand_init_chip
574 * init a single instance of an chip
577 static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
578 struct s3c2410_nand_mtd *nmtd,
579 struct s3c2410_nand_set *set)
581 struct nand_chip *chip = &nmtd->chip;
582 void __iomem *regs = info->regs;
584 chip->write_buf = s3c2410_nand_write_buf;
585 chip->read_buf = s3c2410_nand_read_buf;
586 chip->select_chip = s3c2410_nand_select_chip;
587 chip->chip_delay = 50;
590 chip->controller = &info->controller;
592 switch (info->cpu_type) {
594 chip->IO_ADDR_W = regs + S3C2410_NFDATA;
595 info->sel_reg = regs + S3C2410_NFCONF;
596 info->sel_bit = S3C2410_NFCONF_nFCE;
597 chip->cmd_ctrl = s3c2410_nand_hwcontrol;
598 chip->dev_ready = s3c2410_nand_devready;
602 chip->IO_ADDR_W = regs + S3C2440_NFDATA;
603 info->sel_reg = regs + S3C2440_NFCONT;
604 info->sel_bit = S3C2440_NFCONT_nFCE;
605 chip->cmd_ctrl = s3c2440_nand_hwcontrol;
606 chip->dev_ready = s3c2440_nand_devready;
610 chip->IO_ADDR_W = regs + S3C2440_NFDATA;
611 info->sel_reg = regs + S3C2440_NFCONT;
612 info->sel_bit = S3C2412_NFCONT_nFCE0;
613 chip->cmd_ctrl = s3c2440_nand_hwcontrol;
614 chip->dev_ready = s3c2412_nand_devready;
616 if (readl(regs + S3C2410_NFCONF) & S3C2412_NFCONF_NANDBOOT)
617 dev_info(info->device, "System booted from NAND\n");
622 chip->IO_ADDR_R = chip->IO_ADDR_W;
625 nmtd->mtd.priv = chip;
626 nmtd->mtd.owner = THIS_MODULE;
630 chip->ecc.calculate = s3c2410_nand_calculate_ecc;
631 chip->ecc.correct = s3c2410_nand_correct_data;
632 chip->ecc.mode = NAND_ECC_HW;
633 chip->ecc.size = 512;
635 chip->ecc.layout = &nand_hw_eccoob;
637 switch (info->cpu_type) {
639 chip->ecc.hwctl = s3c2410_nand_enable_hwecc;
640 chip->ecc.calculate = s3c2410_nand_calculate_ecc;
644 chip->ecc.hwctl = s3c2412_nand_enable_hwecc;
645 chip->ecc.calculate = s3c2412_nand_calculate_ecc;
649 chip->ecc.hwctl = s3c2440_nand_enable_hwecc;
650 chip->ecc.calculate = s3c2440_nand_calculate_ecc;
655 chip->ecc.mode = NAND_ECC_SOFT;
659 /* s3c2410_nand_probe
661 * called by device layer when it finds a device matching
662 * one our driver can handled. This code checks to see if
663 * it can allocate all necessary resources then calls the
664 * nand layer to look for devices
667 static int s3c24xx_nand_probe(struct platform_device *pdev,
668 enum s3c_cpu_type cpu_type)
670 struct s3c2410_platform_nand *plat = to_nand_plat(pdev);
671 struct s3c2410_nand_info *info;
672 struct s3c2410_nand_mtd *nmtd;
673 struct s3c2410_nand_set *sets;
674 struct resource *res;
680 pr_debug("s3c2410_nand_probe(%p)\n", pdev);
682 info = kmalloc(sizeof(*info), GFP_KERNEL);
684 dev_err(&pdev->dev, "no memory for flash info\n");
689 memzero(info, sizeof(*info));
690 platform_set_drvdata(pdev, info);
692 spin_lock_init(&info->controller.lock);
693 init_waitqueue_head(&info->controller.wq);
695 /* get the clock source and enable it */
697 info->clk = clk_get(&pdev->dev, "nand");
698 if (IS_ERR(info->clk)) {
699 dev_err(&pdev->dev, "failed to get clock");
704 clk_enable(info->clk);
706 /* allocate and map the resource */
708 /* currently we assume we have the one resource */
709 res = pdev->resource;
710 size = res->end - res->start + 1;
712 info->area = request_mem_region(res->start, size, pdev->name);
714 if (info->area == NULL) {
715 dev_err(&pdev->dev, "cannot reserve register region\n");
720 info->device = &pdev->dev;
721 info->platform = plat;
722 info->regs = ioremap(res->start, size);
723 info->cpu_type = cpu_type;
725 if (info->regs == NULL) {
726 dev_err(&pdev->dev, "cannot reserve register region\n");
731 dev_dbg(&pdev->dev, "mapped registers at %p\n", info->regs);
733 /* initialise the hardware */
735 err = s3c2410_nand_inithw(info, pdev);
739 sets = (plat != NULL) ? plat->sets : NULL;
740 nr_sets = (plat != NULL) ? plat->nr_sets : 1;
742 info->mtd_count = nr_sets;
744 /* allocate our information */
746 size = nr_sets * sizeof(*info->mtds);
747 info->mtds = kmalloc(size, GFP_KERNEL);
748 if (info->mtds == NULL) {
749 dev_err(&pdev->dev, "failed to allocate mtd storage\n");
754 memzero(info->mtds, size);
756 /* initialise all possible chips */
760 for (setno = 0; setno < nr_sets; setno++, nmtd++) {
761 pr_debug("initialising set %d (%p, info %p)\n", setno, nmtd, info);
763 s3c2410_nand_init_chip(info, nmtd, sets);
765 nmtd->scan_res = nand_scan(&nmtd->mtd, (sets) ? sets->nr_chips : 1);
767 if (nmtd->scan_res == 0) {
768 s3c2410_nand_add_partition(info, nmtd, sets);
775 if (allow_clk_stop(info)) {
776 dev_info(&pdev->dev, "clock idle support enabled\n");
777 clk_disable(info->clk);
780 pr_debug("initialised ok\n");
784 s3c2410_nand_remove(pdev);
794 static int s3c24xx_nand_suspend(struct platform_device *dev, pm_message_t pm)
796 struct s3c2410_nand_info *info = platform_get_drvdata(dev);
799 if (!allow_clk_stop(info))
800 clk_disable(info->clk);
806 static int s3c24xx_nand_resume(struct platform_device *dev)
808 struct s3c2410_nand_info *info = platform_get_drvdata(dev);
811 clk_enable(info->clk);
812 s3c2410_nand_inithw(info, dev);
814 if (allow_clk_stop(info))
815 clk_disable(info->clk);
822 #define s3c24xx_nand_suspend NULL
823 #define s3c24xx_nand_resume NULL
826 /* driver device registration */
828 static int s3c2410_nand_probe(struct platform_device *dev)
830 return s3c24xx_nand_probe(dev, TYPE_S3C2410);
833 static int s3c2440_nand_probe(struct platform_device *dev)
835 return s3c24xx_nand_probe(dev, TYPE_S3C2440);
838 static int s3c2412_nand_probe(struct platform_device *dev)
840 return s3c24xx_nand_probe(dev, TYPE_S3C2412);
843 static struct platform_driver s3c2410_nand_driver = {
844 .probe = s3c2410_nand_probe,
845 .remove = s3c2410_nand_remove,
846 .suspend = s3c24xx_nand_suspend,
847 .resume = s3c24xx_nand_resume,
849 .name = "s3c2410-nand",
850 .owner = THIS_MODULE,
854 static struct platform_driver s3c2440_nand_driver = {
855 .probe = s3c2440_nand_probe,
856 .remove = s3c2410_nand_remove,
857 .suspend = s3c24xx_nand_suspend,
858 .resume = s3c24xx_nand_resume,
860 .name = "s3c2440-nand",
861 .owner = THIS_MODULE,
865 static struct platform_driver s3c2412_nand_driver = {
866 .probe = s3c2412_nand_probe,
867 .remove = s3c2410_nand_remove,
868 .suspend = s3c24xx_nand_suspend,
869 .resume = s3c24xx_nand_resume,
871 .name = "s3c2412-nand",
872 .owner = THIS_MODULE,
876 static int __init s3c2410_nand_init(void)
878 printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n");
880 platform_driver_register(&s3c2412_nand_driver);
881 platform_driver_register(&s3c2440_nand_driver);
882 return platform_driver_register(&s3c2410_nand_driver);
885 static void __exit s3c2410_nand_exit(void)
887 platform_driver_unregister(&s3c2412_nand_driver);
888 platform_driver_unregister(&s3c2440_nand_driver);
889 platform_driver_unregister(&s3c2410_nand_driver);
892 module_init(s3c2410_nand_init);
893 module_exit(s3c2410_nand_exit);
895 MODULE_LICENSE("GPL");
896 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
897 MODULE_DESCRIPTION("S3C24XX MTD NAND driver");