Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
board-nand.c
Go to the documentation of this file.
1 /*
2  * linux/arch/arm/mach-omap1/board-nand.c
3  *
4  * Common OMAP1 board NAND code
5  *
6  * Copyright (C) 2004, 2012 Texas Instruments, Inc.
7  * Copyright (C) 2002 MontaVista Software, Inc.
8  * Copyright (C) 2001 RidgeRun, Inc.
9  * Author: RidgeRun, Inc.
10  * Greg Lonnon ([email protected]) or [email protected]
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License version 2 as
14  * published by the Free Software Foundation.
15  */
16 #include <linux/kernel.h>
17 #include <linux/io.h>
18 #include <linux/mtd/mtd.h>
19 #include <linux/mtd/nand.h>
20 
21 #include "common.h"
22 
23 void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
24 {
25  struct nand_chip *this = mtd->priv;
26  unsigned long mask;
27 
28  if (cmd == NAND_CMD_NONE)
29  return;
30 
31  mask = (ctrl & NAND_CLE) ? 0x02 : 0;
32  if (ctrl & NAND_ALE)
33  mask |= 0x04;
34 
35  writeb(cmd, this->IO_ADDR_W + mask);
36 }
37