]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/nvidia/nyan-big/nyan-big.c
ae8874bbd25e2f76dee0af909f00b004ef18104e
[karo-tx-uboot.git] / board / nvidia / nyan-big / nyan-big.c
1 /*
2  * (C) Copyright 2014
3  * NVIDIA Corporation <www.nvidia.com>
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 #include <common.h>
9 #include <errno.h>
10 #include <asm/gpio.h>
11 #include <asm/arch/pinmux.h>
12 #include <power/as3722.h>
13 #include <power/pmic.h>
14 #include "pinmux-config-nyan-big.h"
15
16 /*
17  * Routine: pinmux_init
18  * Description: Do individual peripheral pinmux configs
19  */
20 void pinmux_init(void)
21 {
22         gpio_config_table(nyan_big_gpio_inits,
23                           ARRAY_SIZE(nyan_big_gpio_inits));
24
25         pinmux_config_pingrp_table(nyan_big_pingrps,
26                                    ARRAY_SIZE(nyan_big_pingrps));
27
28         pinmux_config_drvgrp_table(nyan_big_drvgrps,
29                                    ARRAY_SIZE(nyan_big_drvgrps));
30 }
31
32 int tegra_board_id(void)
33 {
34         static const int vector[] = {GPIO_PQ3, GPIO_PT1, GPIO_PX1,
35                                         GPIO_PX4, -1};
36
37         gpio_claim_vector(vector, "board_id%d");
38         return gpio_get_values_as_int(vector);
39 }
40
41 int tegra_lcd_pmic_init(int board_id)
42 {
43         struct udevice *pmic;
44         int ret;
45
46         ret = as3722_get(&pmic);
47         if (ret)
48                 return -ENOENT;
49
50         if (board_id == 0)
51                 as3722_write(pmic, 0x00, 0x3c);
52         else
53                 as3722_write(pmic, 0x00, 0x50);
54         as3722_write(pmic, 0x12, 0x10);
55         as3722_write(pmic, 0x0c, 0x07);
56         as3722_write(pmic, 0x20, 0x10);
57
58         return 0;
59 }