]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/arm/cpu/armv7/mx6/clock.c
arm: mx6: implement refcounting for the ocotp clock and use 'fuse_read()' rather...
[karo-tx-uboot.git] / arch / arm / cpu / armv7 / mx6 / clock.c
index c3c9c5e6512ba13ebacd96181056e915db9e14da..4f2a4b97b72ac724d1107162d113ffcd901b46ef 100644 (file)
@@ -138,6 +138,16 @@ static inline int wait_pll_lock(u32 *reg)
 void enable_ocotp_clk(unsigned char enable)
 {
        u32 reg;
+       static int enabled __attribute__((section(".data")));
+
+       if (enabled < 0) {
+               printf("ERROR: unbalanced enable/disable ocotp_clk\n");
+               hang();
+       }
+       if (enable && enabled++)
+               return;
+       if (!enable && --enabled)
+               return;
 
        reg = __raw_readl(&imx_ccm->CCGR2);
        if (enable)