board-nand.c 898 B

123456789101112131415161718192021222324252627282930313233343536
  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>
  19. #include <linux/mtd/rawnand.h>
  20. #include "common.h"
  21. void omap1_nand_cmd_ctl(struct nand_chip *this, int cmd, unsigned int ctrl)
  22. {
  23. unsigned long mask;
  24. if (cmd == NAND_CMD_NONE)
  25. return;
  26. mask = (ctrl & NAND_CLE) ? 0x02 : 0;
  27. if (ctrl & NAND_ALE)
  28. mask |= 0x04;
  29. writeb(cmd, this->legacy.IO_ADDR_W + mask);
  30. }