flash.c 692 B

123456789101112131415161718192021222324252627282930313233
  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/mtd/mtd.h>
  9. #include <linux/mtd/map.h>
  10. #include <plat/io.h>
  11. #include <plat/tc.h>
  12. void omap1_set_vpp(struct map_info *map, int enable)
  13. {
  14. static int count;
  15. u32 l;
  16. if (enable) {
  17. if (count++ == 0) {
  18. l = omap_readl(EMIFS_CONFIG);
  19. l |= OMAP_EMIFS_CONFIG_WP;
  20. omap_writel(l, EMIFS_CONFIG);
  21. }
  22. } else {
  23. if (count && (--count == 0)) {
  24. l = omap_readl(EMIFS_CONFIG);
  25. l &= ~OMAP_EMIFS_CONFIG_WP;
  26. omap_writel(l, EMIFS_CONFIG);
  27. }
  28. }
  29. }