blob: 31b679516ff2c93547f1b5f52ddec2a246882e6d [file] [log] [blame]
Andrii Tseglytskyi28095da2013-05-20 22:42:08 +00001/*
Andrii Tseglytskyi28095da2013-05-20 22:42:08 +00002 * Adaptive Body Bias programming sequence for OMAP5 family
3 *
4 * (C) Copyright 2013
5 * Texas Instruments, <www.ti.com>
6 *
7 * Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>
8 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
Andrii Tseglytskyi28095da2013-05-20 22:42:08 +000010 */
11
12#include <common.h>
13#include <asm/omap_common.h>
14#include <asm/io.h>
15
16/*
17 * Setup LDOVBB for OMAP5.
18 * On OMAP5+ some ABB settings are fused. They are handled
19 * in the following way:
20 *
21 * 1. corresponding EFUSE register contains ABB enable bit
22 * and VSET value
23 * 2. If ABB enable bit is set to 1, than ABB should be
24 * enabled, otherwise ABB should be disabled
25 * 3. If ABB is enabled, than VSET value should be copied
26 * to corresponding MUX control register
27 */
28s8 abb_setup_ldovbb(u32 fuse, u32 ldovbb)
29{
30 u32 vset;
31
32 /*
33 * ABB parameters must be properly fused
34 * otherwise ABB should be disabled
35 */
36 vset = readl(fuse);
37 if (!(vset & OMAP5_ABB_FUSE_ENABLE_MASK))
38 return -1;
39
40 /* prepare VSET value for LDOVBB mux register */
41 vset &= OMAP5_ABB_FUSE_VSET_MASK;
42 vset >>= ffs(OMAP5_ABB_FUSE_VSET_MASK) - 1;
43 vset <<= ffs(OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK) - 1;
44 vset |= OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK;
45
46 /* setup LDOVBB using fused value */
47 clrsetbits_le32(ldovbb, OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK, vset);
48
49 return 0;
50}