Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
[platform/kernel/u-boot.git] / include / power / mp5416.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Copyright (C) 2020 Gateworks Corporation */
3
4 #ifndef MP5416_H_
5 #define MP5416_H_
6
7 #define MP6416_REGULATOR_DRIVER "mp5416_regulator"
8
9 enum {
10         MP5416_CTL0             = 0x00,
11         MP5416_CTL1             = 0x01,
12         MP5416_CTL2             = 0x02,
13         MP5416_ILIMIT           = 0x03,
14         MP5416_VSET_SW1         = 0x04,
15         MP5416_VSET_SW2         = 0x05,
16         MP5416_VSET_SW3         = 0x06,
17         MP5416_VSET_SW4         = 0x07,
18         MP5416_VSET_LDO2        = 0x08,
19         MP5416_VSET_LDO3        = 0x09,
20         MP5416_VSET_LDO4        = 0x0a,
21         MP5416_VSET_LDO5        = 0x0b,
22         MP5416_STATUS1          = 0x0d,
23         MP5416_STATUS2          = 0x0e,
24         MP5416_STATUS3          = 0x0f,
25         MP5416_ID2              = 0x11,
26         MP5416_NUM_OF_REGS      = 0x12,
27 };
28
29 #define MP5416_VSET_EN          BIT(7)
30 #define MP5416_VSET_SW1_GVAL(x) ((((x) & 0x7f) * 12500) + 600000)
31 #define MP5416_VSET_SW2_GVAL(x) ((((x) & 0x7f) * 25000) + 800000)
32 #define MP5416_VSET_SW3_GVAL(x) ((((x) & 0x7f) * 12500) + 600000)
33 #define MP5416_VSET_SW4_GVAL(x) ((((x) & 0x7f) * 25000) + 800000)
34 #define MP5416_VSET_LDO_GVAL(x) ((((x) & 0x7f) * 25000) + 800000)
35 #define MP5416_VSET_LDO_SVAL(x) ((((x) & 0x7f) * 25000) + 800000)
36 #define MP5416_VSET_SW1_SVAL(x) (((x) - 600000) / 12500)
37 #define MP5416_VSET_SW2_SVAL(x) (((x) - 800000) / 25000)
38 #define MP5416_VSET_SW3_SVAL(x) (((x) - 600000) / 12500)
39 #define MP5416_VSET_SW4_SVAL(x) (((x) - 800000) / 25000)
40
41 #endif