board-nand.c 933 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 mtd_info *mtd, int cmd, unsigned int ctrl)
  22. {
  23. struct nand_chip *this = mtd_to_nand(mtd);
  24. unsigned long mask;
  25. if (cmd == NAND_CMD_NONE)
  26. return;
  27. mask = (ctrl & NAND_CLE) ? 0x02 : 0;
  28. if (ctrl & NAND_ALE)
  29. mask |= 0x04;
  30. writeb(cmd, this->IO_ADDR_W + mask);
  31. }