delta.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * (C) Copyright 2002
  3. * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
  4. *
  5. * (C) Copyright 2002
  6. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  7. * Marius Groeger <mgroeger@sysgo.de>
  8. *
  9. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  25. * MA 02111-1307 USA
  26. */
  27. #include <common.h>
  28. #include <i2c.h>
  29. #include <da9030.h>
  30. #include <asm/arch/pxa-regs.h>
  31. DECLARE_GLOBAL_DATA_PTR;
  32. /* ------------------------------------------------------------------------- */
  33. static void init_DA9030(void);
  34. /*
  35. * Miscelaneous platform dependent initialisations
  36. */
  37. int board_init (void)
  38. {
  39. /* memory and cpu-speed are setup before relocation */
  40. /* so we do _nothing_ here */
  41. /* arch number of Lubbock-Board mk@tbd: fix this! */
  42. gd->bd->bi_arch_number = MACH_TYPE_LUBBOCK;
  43. /* adress of boot parameters */
  44. gd->bd->bi_boot_params = 0xa0000100;
  45. return 0;
  46. }
  47. int board_late_init(void)
  48. {
  49. setenv("stdout", "serial");
  50. setenv("stderr", "serial");
  51. init_DA9030();
  52. return 0;
  53. }
  54. int dram_init (void)
  55. {
  56. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  57. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  58. gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
  59. gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
  60. gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
  61. gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
  62. gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
  63. gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
  64. return 0;
  65. }
  66. /* initialize the DA9030 Power Controller */
  67. static void init_DA9030()
  68. {
  69. uchar addr = (uchar) DA9030_I2C_ADDR, val = 0;
  70. /* setup I2C GPIO's */
  71. GPIO32 = 0x801; /* SCL = Alt. Fkt. 1 */
  72. GPIO33 = 0x801; /* SDA = Alt. Fkt. 1 */
  73. /* rising Edge on EXTON */
  74. GPIO17 = 0x8800;
  75. udelay(5);
  76. GPIO17 = 0xc800;
  77. udelay(100000); /* wait for DA9030 */
  78. /* reset the watchdog and go active (0xec) */
  79. val = (SYS_CONTROL_A_HWRES_ENABLE |
  80. (0x6<<4) |
  81. SYS_CONTROL_A_WDOG_ACTION |
  82. SYS_CONTROL_A_WATCHDOG);
  83. i2c_reg_write(addr, SYS_CONTROL_A, val);
  84. i2c_reg_write(addr, REG_CONTROL_1_97, 0xfd); /* disable LDO1, enable LDO6 */
  85. i2c_reg_write(addr, LDO2_3, 0xd1); /* LDO2 =1,9V, LDO3=3,1V */
  86. i2c_reg_write(addr, LDO4_5, 0xcc); /* LDO2 =1,9V, LDO3=3,1V */
  87. i2c_reg_write(addr, LDO6_SIMCP, 0x3e); /* LDO6=3,2V, SIMCP = 5V support */
  88. i2c_reg_write(addr, LDO7_8, 0xc9); /* LDO7=2,7V, LDO8=3,0V */
  89. i2c_reg_write(addr, LDO9_12, 0xec); /* LDO9=3,0V, LDO12=3,2V */
  90. i2c_reg_write(addr, BUCK, 0x0c); /* Buck=1.2V */
  91. i2c_reg_write(addr, REG_CONTROL_2_98, 0x7f); /* All LDO'S on 8,9,10,11,12,14 */
  92. i2c_reg_write(addr, LDO_10_11, 0xcc); /* LDO10=3.0V LDO11=3.0V */
  93. i2c_reg_write(addr, LDO_15, 0xae); /* LDO15=1.8V, dislock first 3bit */
  94. i2c_reg_write(addr, LDO_14_16, 0x05); /* LDO14=2.8V, LDO16=NB */
  95. i2c_reg_write(addr, LDO_18_19, 0x9c); /* LDO18=3.0V, LDO19=2.7V */
  96. i2c_reg_write(addr, LDO_17_SIMCP0, 0x2c); /* LDO17=3.0V, SIMCP=3V support */
  97. i2c_reg_write(addr, BUCK2_DVC1, 0x9a); /* Buck2=1.5V plus Update support of 520 MHz */
  98. i2c_reg_write(addr, REG_CONTROL_2_18, 0x43); /* Ball on */
  99. i2c_reg_write(addr, MISC_CONTROLB, 0x08); /* session valid enable */
  100. i2c_reg_write(addr, USBPUMP, 0xc1); /* start pump, ignore HW signals */
  101. val = i2c_reg_read(addr, STATUS);
  102. if(val & STATUS_CHDET)
  103. printf("Charger detected, turning on LED.\n");
  104. else {
  105. printf("No charger detetected.\n");
  106. /* undervoltage? print error and power down */
  107. }
  108. }
  109. #if 0
  110. /* reset the DA9030 watchdog */
  111. void hw_watchdog_reset(void)
  112. {
  113. uchar addr = (uchar) DA9030_I2C_ADDR, val = 0;
  114. val = i2c_reg_read(addr, SYS_CONTROL_A);
  115. val |= SYS_CONTROL_A_WATCHDOG;
  116. i2c_reg_write(addr, SYS_CONTROL_A, val);
  117. }
  118. #endif