blob: 7684f9203474386eafbd3d974dbcfa5a30b24989 [file] [log] [blame]
Paul Walmsley31cde042012-04-13 06:34:31 -06001/*
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 (glonnon@ridgerun.com) or info@ridgerun.com
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
23void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
24{
Boris BREZILLONc993e092015-12-01 12:02:58 +010025 struct nand_chip *this = mtd_to_nand(mtd);
Paul Walmsley31cde042012-04-13 06:34:31 -060026 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