summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/nvidia-beaver/board.c
blob: bab02387793f78e5197798a8d66e164c5e9b6e07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * Copyright (C) 2014 Lucas Stach <l.stach@pengutronix.de>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <common.h>
#include <dt-bindings/gpio/tegra-gpio.h>
#include <gpio.h>
#include <i2c/i2c.h>
#include <init.h>
#include <mach/tegra-bbu.h>

static int nvidia_beaver_fs_init(void)
{
	struct i2c_client client;
	u8 data;

	if (!of_machine_is_compatible("nvidia,beaver"))
		return 0;

	client.adapter = i2c_get_adapter(4);
	client.addr = 0x2d;

	/* TPS659110: LDO5_REG = 3.3v, ACTIVE to SDMMC1 */
	data = 0x65;
	i2c_write_reg(&client, 0x32, &data, 1);

	/* TPS659110: LDO1_REG = 1.05v, ACTIVE to PEX */
	data = 0x15;
	i2c_write_reg(&client, 0x30, &data, 1);

	/* enable SYS_3V3_PEXS */
	gpio_direction_output(TEGRA_GPIO(L, 7), 1);

	return 0;
}
fs_initcall(nvidia_beaver_fs_init);

static int nvidia_beaver_device_init(void)
{
	if (!of_machine_is_compatible("nvidia,beaver"))
		return 0;

	barebox_set_hostname("beaver");

	tegra_bbu_register_emmc_handler("eMMC", "/dev/mmc3.boot0",
					BBU_HANDLER_FLAG_DEFAULT);

	return 0;
}
device_initcall(nvidia_beaver_device_init);