DRA7: add ABB setup for MPU voltage domain
[oweals/u-boot.git] / arch / arm / cpu / armv7 / omap5 / abb.c
index 92470becc0a7b0f29f4aa4955d5d8796a94b5d8f..3bf88979e5d62bad3a5565e8cef19e77aada065e 100644 (file)
@@ -1,5 +1,4 @@
 /*
- *
  * Adaptive Body Bias programming sequence for OMAP5 family
  *
  * (C) Copyright 2013
@@ -7,23 +6,7 @@
  *
  * Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 s8 abb_setup_ldovbb(u32 fuse, u32 ldovbb)
 {
        u32 vset;
+       u32 fuse_enable_mask = OMAP5_ABB_FUSE_ENABLE_MASK;
+       u32 fuse_vset_mask = OMAP5_ABB_FUSE_VSET_MASK;
 
+       if (!is_omap54xx()) {
+               /* DRA7 */
+               fuse_enable_mask = DRA7_ABB_FUSE_ENABLE_MASK;
+               fuse_vset_mask = DRA7_ABB_FUSE_VSET_MASK;
+       }
        /*
         * ABB parameters must be properly fused
         * otherwise ABB should be disabled
         */
        vset = readl(fuse);
-       if (!(vset & OMAP5_ABB_FUSE_ENABLE_MASK))
+       if (!(vset & fuse_enable_mask))
                return -1;
 
        /* prepare VSET value for LDOVBB mux register */
-       vset &= OMAP5_ABB_FUSE_VSET_MASK;
-       vset >>= ffs(OMAP5_ABB_FUSE_VSET_MASK) - 1;
+       vset &= fuse_vset_mask;
+       vset >>= ffs(fuse_vset_mask) - 1;
        vset <<= ffs(OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK) - 1;
        vset |= OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK;