aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2009-05-30 11:55:29 -0400
committerBen Dooks <ben-linux@fluff.org>2009-05-30 11:55:29 -0400
commitec0482e6cfbd460bc69a9073ffbef4c2f3422fdf (patch)
tree37b9d743b20468e5918caa1f89180d04c83e374a /drivers/mtd
parent3218911f839b6c85acbf872ad264ea69aa4d89ad (diff)
[MTD] [NAND] S3C2410: Move to using platform device table
Commit 57fee4a58fe802272742caae248872c392a60670 added an method to specify the platform device compatibility by using an id-table instead of registering multiple drivers. Move the S3C24XX NAND driver to using this ID table. Signed-off-by: Ben Dooks <ben-linux@fluff.org> CC: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/s3c2410.c78
1 files changed, 26 insertions, 52 deletions
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 8e375d5fe231..b7f0740d842f 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -593,7 +593,7 @@ static inline void s3c2410_nand_cpufreq_deregister(struct s3c2410_nand_info *inf
593 593
594/* device management functions */ 594/* device management functions */
595 595
596static int s3c2410_nand_remove(struct platform_device *pdev) 596static int s3c24xx_nand_remove(struct platform_device *pdev)
597{ 597{
598 struct s3c2410_nand_info *info = to_nand_info(pdev); 598 struct s3c2410_nand_info *info = to_nand_info(pdev);
599 599
@@ -788,18 +788,17 @@ static void s3c2410_nand_update_chip(struct s3c2410_nand_info *info,
788 } 788 }
789} 789}
790 790
791/* s3c2410_nand_probe 791/* s3c24xx_nand_probe
792 * 792 *
793 * called by device layer when it finds a device matching 793 * called by device layer when it finds a device matching
794 * one our driver can handled. This code checks to see if 794 * one our driver can handled. This code checks to see if
795 * it can allocate all necessary resources then calls the 795 * it can allocate all necessary resources then calls the
796 * nand layer to look for devices 796 * nand layer to look for devices
797*/ 797*/
798 798static int s3c24xx_nand_probe(struct platform_device *pdev)
799static int s3c24xx_nand_probe(struct platform_device *pdev,
800 enum s3c_cpu_type cpu_type)
801{ 799{
802 struct s3c2410_platform_nand *plat = to_nand_plat(pdev); 800 struct s3c2410_platform_nand *plat = to_nand_plat(pdev);
801 enum s3c_cpu_type cpu_type;
803 struct s3c2410_nand_info *info; 802 struct s3c2410_nand_info *info;
804 struct s3c2410_nand_mtd *nmtd; 803 struct s3c2410_nand_mtd *nmtd;
805 struct s3c2410_nand_set *sets; 804 struct s3c2410_nand_set *sets;
@@ -809,6 +808,8 @@ static int s3c24xx_nand_probe(struct platform_device *pdev,
809 int nr_sets; 808 int nr_sets;
810 int setno; 809 int setno;
811 810
811 cpu_type = platform_get_device_id(pdev)->driver_data;
812
812 pr_debug("s3c2410_nand_probe(%p)\n", pdev); 813 pr_debug("s3c2410_nand_probe(%p)\n", pdev);
813 814
814 info = kmalloc(sizeof(*info), GFP_KERNEL); 815 info = kmalloc(sizeof(*info), GFP_KERNEL);
@@ -922,7 +923,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev,
922 return 0; 923 return 0;
923 924
924 exit_error: 925 exit_error:
925 s3c2410_nand_remove(pdev); 926 s3c24xx_nand_remove(pdev);
926 927
927 if (err == 0) 928 if (err == 0)
928 err = -EINVAL; 929 err = -EINVAL;
@@ -983,50 +984,30 @@ static int s3c24xx_nand_resume(struct platform_device *dev)
983 984
984/* driver device registration */ 985/* driver device registration */
985 986
986static int s3c2410_nand_probe(struct platform_device *dev) 987static struct platform_device_id s3c24xx_driver_ids[] = {
987{ 988 {
988 return s3c24xx_nand_probe(dev, TYPE_S3C2410); 989 .name = "s3c2410-nand",
989} 990 .driver_data = TYPE_S3C2410,
990 991 }, {
991static int s3c2440_nand_probe(struct platform_device *dev) 992 .name = "s3c2440-nand",
992{ 993 .driver_data = TYPE_S3C2440,
993 return s3c24xx_nand_probe(dev, TYPE_S3C2440); 994 }, {
994} 995 .name = "s3c2412-nand",
995 996 .driver_data = TYPE_S3C2412,
996static int s3c2412_nand_probe(struct platform_device *dev)
997{
998 return s3c24xx_nand_probe(dev, TYPE_S3C2412);
999}
1000
1001static struct platform_driver s3c2410_nand_driver = {
1002 .probe = s3c2410_nand_probe,
1003 .remove = s3c2410_nand_remove,
1004 .suspend = s3c24xx_nand_suspend,
1005 .resume = s3c24xx_nand_resume,
1006 .driver = {
1007 .name = "s3c2410-nand",
1008 .owner = THIS_MODULE,
1009 }, 997 },
998 { }
1010}; 999};
1011 1000
1012static struct platform_driver s3c2440_nand_driver = { 1001MODULE_DEVICE_TABLE(platform, s3c24xx_driver_ids);
1013 .probe = s3c2440_nand_probe,
1014 .remove = s3c2410_nand_remove,
1015 .suspend = s3c24xx_nand_suspend,
1016 .resume = s3c24xx_nand_resume,
1017 .driver = {
1018 .name = "s3c2440-nand",
1019 .owner = THIS_MODULE,
1020 },
1021};
1022 1002
1023static struct platform_driver s3c2412_nand_driver = { 1003static struct platform_driver s3c24xx_nand_driver = {
1024 .probe = s3c2412_nand_probe, 1004 .probe = s3c24xx_nand_probe,
1025 .remove = s3c2410_nand_remove, 1005 .remove = s3c24xx_nand_remove,
1026 .suspend = s3c24xx_nand_suspend, 1006 .suspend = s3c24xx_nand_suspend,
1027 .resume = s3c24xx_nand_resume, 1007 .resume = s3c24xx_nand_resume,
1008 .id_table = s3c24xx_driver_ids,
1028 .driver = { 1009 .driver = {
1029 .name = "s3c2412-nand", 1010 .name = "s3c24xx-nand",
1030 .owner = THIS_MODULE, 1011 .owner = THIS_MODULE,
1031 }, 1012 },
1032}; 1013};
@@ -1035,16 +1016,12 @@ static int __init s3c2410_nand_init(void)
1035{ 1016{
1036 printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n"); 1017 printk("S3C24XX NAND Driver, (c) 2004 Simtec Electronics\n");
1037 1018
1038 platform_driver_register(&s3c2412_nand_driver); 1019 return platform_driver_register(&s3c24xx_nand_driver);
1039 platform_driver_register(&s3c2440_nand_driver);
1040 return platform_driver_register(&s3c2410_nand_driver);
1041} 1020}
1042 1021
1043static void __exit s3c2410_nand_exit(void) 1022static void __exit s3c2410_nand_exit(void)
1044{ 1023{
1045 platform_driver_unregister(&s3c2412_nand_driver); 1024 platform_driver_unregister(&s3c24xx_nand_driver);
1046 platform_driver_unregister(&s3c2440_nand_driver);
1047 platform_driver_unregister(&s3c2410_nand_driver);
1048} 1025}
1049 1026
1050module_init(s3c2410_nand_init); 1027module_init(s3c2410_nand_init);
@@ -1053,6 +1030,3 @@ module_exit(s3c2410_nand_exit);
1053MODULE_LICENSE("GPL"); 1030MODULE_LICENSE("GPL");
1054MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 1031MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
1055MODULE_DESCRIPTION("S3C24XX MTD NAND driver"); 1032MODULE_DESCRIPTION("S3C24XX MTD NAND driver");
1056MODULE_ALIAS("platform:s3c2410-nand");
1057MODULE_ALIAS("platform:s3c2412-nand");
1058MODULE_ALIAS("platform:s3c2440-nand");