flash.c 724 B

12345678910111213141516171819202122232425262728293031323334
  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. #include <plat/flash.h>
  13. void omap1_set_vpp(struct platform_device *pdev, int enable)
  14. {
  15. static int count;
  16. u32 l;
  17. if (enable) {
  18. if (count++ == 0) {
  19. l = omap_readl(EMIFS_CONFIG);
  20. l |= OMAP_EMIFS_CONFIG_WP;
  21. omap_writel(l, EMIFS_CONFIG);
  22. }
  23. } else {
  24. if (count && (--count == 0)) {
  25. l = omap_readl(EMIFS_CONFIG);
  26. l &= ~OMAP_EMIFS_CONFIG_WP;
  27. omap_writel(l, EMIFS_CONFIG);
  28. }
  29. }
  30. }