blob: ae8874bbd25e2f76dee0af909f00b004ef18104e [file] [log] [blame]
Allen Martina6c7b462014-12-04 06:36:30 -07001/*
2 * (C) Copyright 2014
3 * NVIDIA Corporation <www.nvidia.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
Simon Glass0deba292015-04-14 21:03:29 -06009#include <errno.h>
10#include <asm/gpio.h>
Allen Martina6c7b462014-12-04 06:36:30 -070011#include <asm/arch/pinmux.h>
Simon Glass0deba292015-04-14 21:03:29 -060012#include <power/as3722.h>
13#include <power/pmic.h>
Allen Martina6c7b462014-12-04 06:36:30 -070014#include "pinmux-config-nyan-big.h"
15
16/*
17 * Routine: pinmux_init
18 * Description: Do individual peripheral pinmux configs
19 */
20void 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}
Simon Glass0deba292015-04-14 21:03:29 -060031
32int 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
41int 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}