]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/karo/tx6/pmic.c
karo: tx6: include default environment in MFG U-Boot variant
[karo-tx-uboot.git] / board / karo / tx6 / pmic.c
1 /*
2  * Copyright (C) 2015 Lothar Waßmann <LW@KARO-electronics.de>
3  *
4  * See file CREDITS for list of people who contributed to this
5  * project.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * version 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  */
17
18 #include <common.h>
19 #include <i2c.h>
20
21 #include "pmic.h"
22
23 static struct {
24         uchar addr;
25         int (*init)(uchar addr);
26 } i2c_addrs[] = {
27 #ifdef CONFIG_LTC3676
28         { 0x3c, ltc3676_pmic_setup, },
29 #endif
30 #ifdef CONFIG_RN5T618
31         { 0x32, rn5t618_pmic_setup, },
32 #endif
33 #ifdef CONFIG_RN5T567
34         { 0x33, rn5t567_pmic_setup, },
35 #endif
36 };
37
38 int tx6_pmic_init(void)
39 {
40         int ret;
41         int i;
42
43         for (i = 0; i < ARRAY_SIZE(i2c_addrs); i++) {
44                 ret = i2c_probe(i2c_addrs[i].addr);
45                 if (ret == 0) {
46                         i2c_addrs[i].init(i2c_addrs[i].addr);
47                         break;
48                 }
49         }
50         return ret;
51 }