twl4030.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (c) 2009 Wind River Systems, Inc.
  3. * Tom Rix <Tom.Rix at windriver.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. *
  20. * twl4030_power_reset_init is derived from code on omapzoom,
  21. * git://git.omapzoom.com/repo/u-boot.git
  22. *
  23. * Copyright (C) 2007-2009 Texas Instruments, Inc.
  24. *
  25. * twl4030_power_init is from cpu/omap3/common.c, power_init_r
  26. *
  27. * (C) Copyright 2004-2008
  28. * Texas Instruments, <www.ti.com>
  29. *
  30. * Author :
  31. * Sunil Kumar <sunilsaini05 at gmail.com>
  32. * Shashi Ranjan <shashiranjanmca05 at gmail.com>
  33. *
  34. * Derived from Beagle Board and 3430 SDP code by
  35. * Richard Woodruff <r-woodruff2 at ti.com>
  36. * Syed Mohammed Khasim <khasim at ti.com>
  37. *
  38. */
  39. #include <twl4030.h>
  40. /*
  41. * Power Reset
  42. */
  43. void twl4030_power_reset_init(void)
  44. {
  45. u8 val = 0;
  46. if (twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &val,
  47. TWL4030_PM_MASTER_P1_SW_EVENTS)) {
  48. printf("Error:TWL4030: failed to read the power register\n");
  49. printf("Could not initialize hardware reset\n");
  50. } else {
  51. val |= TWL4030_PM_MASTER_SW_EVENTS_STOPON_PWRON;
  52. if (twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, val,
  53. TWL4030_PM_MASTER_P1_SW_EVENTS)) {
  54. printf("Error:TWL4030: failed to write the power register\n");
  55. printf("Could not initialize hardware reset\n");
  56. }
  57. }
  58. }
  59. /*
  60. * Power Init
  61. */
  62. #define DEV_GRP_P1 0x20
  63. #define VAUX3_VSEL_28 0x03
  64. #define DEV_GRP_ALL 0xE0
  65. #define VPLL2_VSEL_18 0x05
  66. #define VDAC_VSEL_18 0x03
  67. void twl4030_power_init(void)
  68. {
  69. unsigned char byte;
  70. /* set VAUX3 to 2.8V */
  71. byte = DEV_GRP_P1;
  72. twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte,
  73. TWL4030_PM_RECEIVER_VAUX3_DEV_GRP);
  74. byte = VAUX3_VSEL_28;
  75. twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte,
  76. TWL4030_PM_RECEIVER_VAUX3_DEDICATED);
  77. /* set VPLL2 to 1.8V */
  78. byte = DEV_GRP_ALL;
  79. twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte,
  80. TWL4030_PM_RECEIVER_VPLL2_DEV_GRP);
  81. byte = VPLL2_VSEL_18;
  82. twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte,
  83. TWL4030_PM_RECEIVER_VPLL2_DEDICATED);
  84. /* set VDAC to 1.8V */
  85. byte = DEV_GRP_P1;
  86. twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte,
  87. TWL4030_PM_RECEIVER_VDAC_DEV_GRP);
  88. byte = VDAC_VSEL_18;
  89. twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte,
  90. TWL4030_PM_RECEIVER_VDAC_DEDICATED);
  91. }