abb.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. *
  3. * Adaptive Body Bias programming sequence for OMAP5 family
  4. *
  5. * (C) Copyright 2013
  6. * Texas Instruments, <www.ti.com>
  7. *
  8. * Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>
  9. *
  10. * See file CREDITS for list of people who contributed to this
  11. * project.
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License as
  15. * published by the Free Software Foundation; either version 2 of
  16. * the License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  26. * MA 02111-1307 USA
  27. */
  28. #include <common.h>
  29. #include <asm/omap_common.h>
  30. #include <asm/io.h>
  31. /*
  32. * Setup LDOVBB for OMAP5.
  33. * On OMAP5+ some ABB settings are fused. They are handled
  34. * in the following way:
  35. *
  36. * 1. corresponding EFUSE register contains ABB enable bit
  37. * and VSET value
  38. * 2. If ABB enable bit is set to 1, than ABB should be
  39. * enabled, otherwise ABB should be disabled
  40. * 3. If ABB is enabled, than VSET value should be copied
  41. * to corresponding MUX control register
  42. */
  43. s8 abb_setup_ldovbb(u32 fuse, u32 ldovbb)
  44. {
  45. u32 vset;
  46. /*
  47. * ABB parameters must be properly fused
  48. * otherwise ABB should be disabled
  49. */
  50. vset = readl(fuse);
  51. if (!(vset & OMAP5_ABB_FUSE_ENABLE_MASK))
  52. return -1;
  53. /* prepare VSET value for LDOVBB mux register */
  54. vset &= OMAP5_ABB_FUSE_VSET_MASK;
  55. vset >>= ffs(OMAP5_ABB_FUSE_VSET_MASK) - 1;
  56. vset <<= ffs(OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK) - 1;
  57. vset |= OMAP5_ABB_LDOVBBMPU_MUX_CTRL_MASK;
  58. /* setup LDOVBB using fused value */
  59. clrsetbits_le32(ldovbb, OMAP5_ABB_LDOVBBMPU_VSET_OUT_MASK, vset);
  60. return 0;
  61. }