| Paul Walmsley | 31cde04 | 2012-04-13 06:34:31 -0600 | [diff] [blame] | 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 (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> |
| Boris Brezillon | d4092d7 | 2017-08-04 17:29:10 +0200 | [diff] [blame] | 19 | #include <linux/mtd/rawnand.h> |
| Paul Walmsley | 31cde04 | 2012-04-13 06:34:31 -0600 | [diff] [blame] | 20 | |
| 21 | #include "common.h" |
| 22 | |
| Boris Brezillon | 47bd59e | 2018-09-06 14:05:13 +0200 | [diff] [blame] | 23 | 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] | 24 | { |
| Paul Walmsley | 31cde04 | 2012-04-13 06:34:31 -0600 | [diff] [blame] | 25 | unsigned long mask; |
| 26 | |
| 27 | if (cmd == NAND_CMD_NONE) |
| 28 | return; |
| 29 | |
| 30 | mask = (ctrl & NAND_CLE) ? 0x02 : 0; |
| 31 | if (ctrl & NAND_ALE) |
| 32 | mask |= 0x04; |
| 33 | |
| Boris Brezillon | 82fc509 | 2018-09-07 00:38:34 +0200 | [diff] [blame] | 34 | writeb(cmd, this->legacy.IO_ADDR_W + mask); |
| Paul Walmsley | 31cde04 | 2012-04-13 06:34:31 -0600 | [diff] [blame] | 35 | } |
| 36 | |