5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 #include <asm/arch/pxa-regs.h>
26 #define LTC1663_ADDR 0x20
28 #define LTC1663_SY 0x01 /* Sync ACK */
29 #define LTC1663_SD 0x04 /* shutdown */
30 #define LTC1663_BG 0x04 /* Internal Voltage Ref */
32 #define VOLT_1_55 18 /* DAC value for 1.55V */
34 .global initPXAvoltage
36 @ Set the voltage to 1.55V early in the boot process so we can run
37 @ at a high clock speed and boot quickly. Note that this is necessary
38 @ because the reset button does not reset the CPU voltage, so if the
39 @ voltage was low (say 0.85V) then the CPU would crash without this
42 @ This routine clobbers r0-r4
48 orr r3, r3, #CKEN15_PWRI2C
53 orr r3, r3, #PCFR_PI2C_EN
56 /* delay for about 250msec
69 bic r1, r1, #(ICR_MA | ICR_START | ICR_STOP)
82 mov r1, #(ICR_GCD | ICR_SCLE)
91 /* delay for about 1msec
122 /* take it from the top if we don't get empty after a while */
129 beq waitfortxemptyi2c
146 /* now send the real message to set the correct voltage */
147 ldr r0, =LTC1663_ADDR
150 ldr r2, =(ICR_STOP | ICR_ALDIE | ICR_ACKNAK)
157 mov r2, #(ICR_STOP | ICR_START)
165 mov r2, #(ICR_STOP | ICR_START)
179 @ delay a little for the volatage to stablize
200 orr r3, r3, #0x00010000