flash.c 753 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Flash support for OMAP1
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #include <linux/io.h>
  9. #include <linux/mtd/mtd.h>
  10. #include <linux/mtd/map.h>
  11. #include <plat/tc.h>
  12. #include <plat/flash.h>
  13. #include <mach/hardware.h>
  14. void omap1_set_vpp(struct platform_device *pdev, int enable)
  15. {
  16. static int count;
  17. u32 l;
  18. if (enable) {
  19. if (count++ == 0) {
  20. l = omap_readl(EMIFS_CONFIG);
  21. l |= OMAP_EMIFS_CONFIG_WP;
  22. omap_writel(l, EMIFS_CONFIG);
  23. }
  24. } else {
  25. if (count && (--count == 0)) {
  26. l = omap_readl(EMIFS_CONFIG);
  27. l &= ~OMAP_EMIFS_CONFIG_WP;
  28. omap_writel(l, EMIFS_CONFIG);
  29. }
  30. }
  31. }