blob: 479ab9be784db8511ccb9200b1956221b71c308f [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001// SPDX-License-Identifier: GPL-2.0-only
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * linux/arch/arm/mach-omap1/board-nand.c
4 *
5 * Common OMAP1 board NAND code
6 *
7 * Copyright (C) 2004, 2012 Texas Instruments, Inc.
8 * Copyright (C) 2002 MontaVista Software, Inc.
9 * Copyright (C) 2001 RidgeRun, Inc.
10 * Author: RidgeRun, Inc.
11 * Greg Lonnon (glonnon@ridgerun.com) or info@ridgerun.com
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000012 */
13#include <linux/kernel.h>
14#include <linux/io.h>
15#include <linux/mtd/mtd.h>
16#include <linux/mtd/rawnand.h>
17
18#include "common.h"
19
David Brazdil0f672f62019-12-10 10:32:29 +000020void omap1_nand_cmd_ctl(struct nand_chip *this, int cmd, unsigned int ctrl)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000021{
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000022 unsigned long mask;
23
24 if (cmd == NAND_CMD_NONE)
25 return;
26
27 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
28 if (ctrl & NAND_ALE)
29 mask |= 0x04;
30
David Brazdil0f672f62019-12-10 10:32:29 +000031 writeb(cmd, this->legacy.IO_ADDR_W + mask);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000032}
33