blob: c6956ff9f5827694813a8be77bbb77deb9107433 [file] [log] [blame]
Svyatoslav Ryhel32128792023-02-14 19:35:34 +02001// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * (C) Copyright 2010-2013
4 * NVIDIA Corporation <www.nvidia.com>
5 *
6 * (C) Copyright 2021
7 * Svyatoslav Ryhel <clamor95@gmail.com>
8 */
9
Svyatoslav Ryhel32128792023-02-14 19:35:34 +020010#include <asm/arch-tegra/tegra_i2c.h>
11#include <linux/delay.h>
12
13/* I2C addr is in 8 bit */
14#define TPS65911_I2C_ADDR 0x5A
15#define TPS65911_VDDCTRL_OP_REG 0x28
16#define TPS65911_VDDCTRL_SR_REG 0x27
17#define TPS65911_VDDCTRL_OP_DATA (0x2400 | TPS65911_VDDCTRL_OP_REG)
18#define TPS65911_VDDCTRL_SR_DATA (0x0100 | TPS65911_VDDCTRL_SR_REG)
19
20#define TPS62366A_I2C_ADDR 0xC0
21#define TPS62366A_SET1_REG 0x01
22#define TPS62366A_SET1_DATA (0x4600 | TPS62366A_SET1_REG)
23
24void pmic_enable_cpu_vdd(void)
25{
26 /* Set VDD_CORE to 1.200V. */
27 tegra_i2c_ll_write(TPS62366A_I2C_ADDR,
28 TPS62366A_SET1_DATA);
29
30 udelay(1000);
31
32 /*
33 * Bring up CPU VDD via the TPS65911x PMIC on the DVC I2C bus.
34 * First set VDD to 1.0125V, then enable the VDD regulator.
35 */
36 tegra_i2c_ll_write(TPS65911_I2C_ADDR,
37 TPS65911_VDDCTRL_OP_DATA);
38 udelay(1000);
39 tegra_i2c_ll_write(TPS65911_I2C_ADDR,
40 TPS65911_VDDCTRL_SR_DATA);
41 udelay(10 * 1000);
42}