blob: 5bbaecace4e308ed1a33a10d47a0634f94faac49 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Ying Zhang8876a512014-10-31 18:06:18 +08002/*
3 * Copyright 2014 Freescale Semiconductor, Inc.
Meenakshi Aggarwal8a03b0d2020-12-04 20:17:28 +05304 * Copyright 2020 NXP
Ying Zhang8876a512014-10-31 18:06:18 +08005 */
6
7#ifndef __VID_H_
8#define __VID_H_
9
10#define IR36021_LOOP1_MANUAL_ID_OFFSET 0x6A
11#define IR36021_LOOP1_VOUT_OFFSET 0x9A
12#define IR36021_MFR_ID_OFFSET 0x92
13#define IR36021_MFR_ID 0x43
Ying Zhang7ad5eff2016-01-22 12:15:12 +080014#define IR36021_INTEL_MODE_OOFSET 0x14
15#define IR36021_MODE_MASK 0x20
16#define IR36021_INTEL_MODE 0x00
17#define IR36021_AMD_MODE 0x20
Ying Zhang8876a512014-10-31 18:06:18 +080018
19/* step the IR regulator in 5mV increments */
20#define IR_VDD_STEP_DOWN 5
21#define IR_VDD_STEP_UP 5
Biwen Li71ecd382020-10-12 20:07:35 +080022
23/* LTC3882 */
24#define PMBUS_CMD_WRITE_PROTECT 0x10
25/*
26 * WRITE_PROTECT command supported values
27 * 0x80: Disable all writes except WRITE_PROTECT, PAGE,
28 * STORE_USER_ALL and MFR_EE_UNLOCK commands.
29 * 0x40: Disable all writes except WRITE_PROTECT, PAGE, STORE_USER_ALL,
30 * MFR_EE_UNLOCK, OPERATION, CLEAR_PEAKS and CLEAR_FAULTS commands.
31 * Individual faults can also be cleared by writing a 1 to the
32 * respective status bit.
33 * 0x20: Disable all writes except WRITE_PROTECT, PAGE, STORE_USER_ ALL,
34 * MFR_EE_UNLOCK, OPERATION, CLEAR_PEAKS, CLEAR_FAULTS, ON_OFF_CONFIG
35 * and VOUT_COMMAND commands. Individual faults can be cleared by
36 * writing a 1 to the respective status bit.
37 * 0x00: Enables write to all commands
38 */
39#define EN_WRITE_ALL_CMD (0)
40
Meenakshi Aggarwal8a03b0d2020-12-04 20:17:28 +053041#ifdef CONFIG_TARGET_LX2160ARDB
42/* The lowest and highest voltage allowed*/
43#define VDD_MV_MIN 775
44#define VDD_MV_MAX 855
45#endif
46
47#if defined(CONFIG_TARGET_LX2160AQDS) || defined(CONFIG_TARGET_LX2162AQDS)
48/* The lowest and highest voltage allowed*/
49#define VDD_MV_MIN 775
50#define VDD_MV_MAX 925
51#endif
52
53#if defined(CONFIG_TARGET_LX2160AQDS) || defined(CONFIG_TARGET_LX2162AQDS) || \
54defined(CONFIG_TARGET_LX2160ARDB)
55/* PM Bus commands code for LTC3882*/
56#define PWM_CHANNEL0 0x0
57#define PMBUS_CMD_PAGE 0x0
58#define PMBUS_CMD_READ_VOUT 0x8B
59#define PMBUS_CMD_VOUT_COMMAND 0x21
60#define PMBUS_CMD_PAGE_PLUS_WRITE 0x05
61
62/* Voltage monitor on channel 2*/
63#define I2C_VOL_MONITOR_BUS_V_OFFSET 0x2
64#define I2C_VOL_MONITOR_BUS_V_OVF 0x1
65#define I2C_VOL_MONITOR_BUS_V_SHIFT 3
66#define I2C_VOL_MONITOR_ADDR 0x63
67#define I2C_MUX_CH_VOL_MONITOR 0xA
68#endif
69
Ying Zhang8876a512014-10-31 18:06:18 +080070int adjust_vdd(ulong vdd_override);
71
72#endif /* __VID_H_ */