]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - drivers/power/twl4030.c
TWL4030 Add power reset button
[karo-tx-uboot.git] / drivers / power / twl4030.c
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  * Derived from code on omapzoom, git://git.omapzoom.com/repo/u-boot.git
21  *
22  * Copyright (C) 2007-2009 Texas Instruments, Inc.
23  */
24
25 #include <twl4030.h>
26
27 /*
28  * Power Reset
29  */
30 void twl4030_power_reset_init(void)
31 {
32         u8 val = 0;
33         if (twl4030_i2c_read_u8(TWL4030_CHIP_PM_MASTER, &val,
34                                 TWL4030_PM_MASTER_P1_SW_EVENTS)) {
35                 printf("Error:TWL4030: failed to read the power register\n");
36                 printf("Could not initialize hardware reset\n");
37         } else {
38                 val |= TWL4030_PM_MASTER_SW_EVENTS_STOPON_PWRON;
39                 if (twl4030_i2c_write_u8(TWL4030_CHIP_PM_MASTER, val,
40                                          TWL4030_PM_MASTER_P1_SW_EVENTS)) {
41                         printf("Error:TWL4030: failed to write the power register\n");
42                         printf("Could not initialize hardware reset\n");
43                 }
44         }
45 }
46
47