xref: /openbmc/linux/arch/arm/mach-omap1/flash.c (revision 54525552)
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 
9 #include <linux/mtd/mtd.h>
10 #include <linux/mtd/map.h>
11 
12 #include <plat/io.h>
13 #include <plat/tc.h>
14 #include <plat/flash.h>
15 
16 void omap1_set_vpp(struct platform_device *pdev, int enable)
17 {
18 	static int count;
19 	u32 l;
20 
21 	if (enable) {
22 		if (count++ == 0) {
23 			l = omap_readl(EMIFS_CONFIG);
24 			l |= OMAP_EMIFS_CONFIG_WP;
25 			omap_writel(l, EMIFS_CONFIG);
26 		}
27 	} else {
28 		if (count && (--count == 0)) {
29 			l = omap_readl(EMIFS_CONFIG);
30 			l &= ~OMAP_EMIFS_CONFIG_WP;
31 			omap_writel(l, EMIFS_CONFIG);
32 		}
33 	}
34 }
35