Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1219327
  • 博文数量: 404
  • 博客积分: 10011
  • 博客等级: 上将
  • 技术积分: 5382
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-03 16:29
文章存档

2010年(40)

2009年(140)

2008年(224)

我的朋友

分类: LINUX

2008-09-27 10:43:02

新一版本的nand flash加入了电源管理功能,
我们也可以在需要的时候其他驱动模块增加如下函数的实现.

/* linux/drivers/mtd/nand/s3c2410.c
*
* Copyright (c) 2004,2005 Simtec Electronics
*   
*    Ben Dooks
*
* Samsung S3C2410/S3C240 NAND driver
*
* Changelog:
*    21-Sep-2004 BJD Initial version
*    23-Sep-2004 BJD Mulitple device support
*    28-Sep-2004 BJD Fixed ECC placement for Hardware mode
*    12-Oct-2004 BJD Fixed errors in use of platform data
*    18-Feb-2005 BJD Fix sparse errors
*    14-Mar-2005 BJD Applied tglx's code reduction patch
*    02-May-2005 BJD Fixed s3c2440 support
*    02-May-2005 BJD Reduced hwcontrol decode
*    20-Jun-2005 BJD Updated s3c2440 support, fixed timing bug
*    08-Jul-2005 BJD Fix OOPS when no platform data supplied
*    20-Oct-2005 BJD Fix timing calculation bug
*    14-Jan-2006 BJD Allow clock to be stopped when idle
*
* $Id: s3c2410.c,v 1.23 2006/04/01 18:06:29 bjd Exp $



/* PM Support */
#ifdef CONFIG_PM

static int s3c24xx_nand_suspend(struct platform_device *dev, pm_message_t pm)
{
    struct s3c2410_nand_info *info = platform_get_drvdata(dev);

    if (info) {
        if (!allow_clk_stop(info))
            clk_disable(info->clk);
    }

    return 0;
}

static int s3c24xx_nand_resume(struct platform_device *dev)
{
    struct s3c2410_nand_info *info = platform_get_drvdata(dev);

    if (info) {
        clk_enable(info->clk);
        s3c2410_nand_inithw(info, dev);

        if (allow_clk_stop(info))
            clk_disable(info->clk);
    }

    return 0;
}

#else
#define s3c24xx_nand_suspend NULL
#define s3c24xx_nand_resume NULL
#endif


static struct platform_driver s3c2440_nand_driver = {
    .probe        = s3c2440_nand_probe,
    .remove        = s3c2410_nand_remove,
    .suspend    = s3c24xx_nand_suspend,
    .resume        = s3c24xx_nand_resume,

    .driver        = {
        .name    = "s3c2440-nand",
        .owner    = THIS_MODULE,
    },
};
阅读(895) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~