| Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| Paul Walmsley | 31cde04 | 2012-04-13 06:34:31 -0600 | [diff] [blame] | 2 | /* |
| 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 |
| Paul Walmsley | 31cde04 | 2012-04-13 06:34:31 -0600 | [diff] [blame] | 12 | */ |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/io.h> |
| 15 | #include <linux/mtd/mtd.h> |
| Boris Brezillon | d4092d7 | 2017-08-04 17:29:10 +0200 | [diff] [blame] | 16 | #include <linux/mtd/rawnand.h> |
| Paul Walmsley | 31cde04 | 2012-04-13 06:34:31 -0600 | [diff] [blame] | 17 | |
| 18 | #include "common.h" |
| 19 | |
| Boris Brezillon | 47bd59e | 2018-09-06 14:05:13 +0200 | [diff] [blame] | 20 | void omap1_nand_cmd_ctl(struct nand_chip *this, int cmd, unsigned int ctrl) |
| Paul Walmsley | 31cde04 | 2012-04-13 06:34:31 -0600 | [diff] [blame] | 21 | { |
| Paul Walmsley | 31cde04 | 2012-04-13 06:34:31 -0600 | [diff] [blame] | 22 | 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 | |
| Boris Brezillon | 82fc509 | 2018-09-07 00:38:34 +0200 | [diff] [blame] | 31 | writeb(cmd, this->legacy.IO_ADDR_W + mask); |
| Paul Walmsley | 31cde04 | 2012-04-13 06:34:31 -0600 | [diff] [blame] | 32 | } |
| 33 | |