board-nand.c 749 B

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-License-Identifier: GPL-2.0-only
  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 ([email protected]) or [email protected]
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/io.h>
  15. #include <linux/mtd/mtd.h>
  16. #include <linux/mtd/rawnand.h>
  17. #include "common.h"
  18. void omap1_nand_cmd_ctl(struct nand_chip *this, int cmd, unsigned int ctrl)
  19. {
  20. unsigned long mask;
  21. if (cmd == NAND_CMD_NONE)
  22. return;
  23. mask = (ctrl & NAND_CLE) ? 0x02 : 0;
  24. if (ctrl & NAND_ALE)
  25. mask |= 0x04;
  26. writeb(cmd, this->legacy.IO_ADDR_W + mask);
  27. }