Merge tag 'u-boot-atmel-fixes-2021.01-b' of https://gitlab.denx.de/u-boot/custodians...
[platform/kernel/u-boot.git] / board / freescale / common / vid.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2014 Freescale Semiconductor, Inc.
4  * Copyright 2020 NXP
5  */
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
14 #define IR36021_INTEL_MODE_OOFSET       0x14
15 #define IR36021_MODE_MASK               0x20
16 #define IR36021_INTEL_MODE              0x00
17 #define IR36021_AMD_MODE                0x20
18
19 /* step the IR regulator in 5mV increments */
20 #define IR_VDD_STEP_DOWN                5
21 #define IR_VDD_STEP_UP                  5
22
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
41 #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) || \
54 defined(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
70 int adjust_vdd(ulong vdd_override);
71
72 #endif  /* __VID_H_ */