2018-05-06 22:27:01 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
|
2018-03-12 09:46:12 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
|
|
|
*/
|
|
|
|
|
2019-02-04 10:26:17 +00:00
|
|
|
#ifndef __PMIC_STPMIC1_H_
|
|
|
|
#define __PMIC_STPMIC1_H_
|
|
|
|
|
2020-05-10 17:40:13 +00:00
|
|
|
#include <linux/bitops.h>
|
2019-02-04 10:26:18 +00:00
|
|
|
#define STPMIC1_MAIN_CR 0x10
|
|
|
|
#define STPMIC1_BUCKS_MRST_CR 0x18
|
|
|
|
#define STPMIC1_LDOS_MRST_CR 0x1a
|
|
|
|
#define STPMIC1_BUCKX_MAIN_CR(buck) (0x20 + (buck))
|
|
|
|
#define STPMIC1_REFDDR_MAIN_CR 0x24
|
|
|
|
#define STPMIC1_LDOX_MAIN_CR(ldo) (0x25 + (ldo))
|
|
|
|
#define STPMIC1_BST_SW_CR 0x40
|
|
|
|
#define STPMIC1_NVM_SR 0xb8
|
|
|
|
#define STPMIC1_NVM_CR 0xb9
|
|
|
|
|
|
|
|
/* Main PMIC Control Register (MAIN_CR) */
|
|
|
|
#define STPMIC1_SWOFF BIT(0)
|
|
|
|
#define STPMIC1_RREQ_EN BIT(1)
|
|
|
|
|
|
|
|
/* BUCKS_MRST_CR */
|
|
|
|
#define STPMIC1_MRST_BUCK(buck) BIT(buck)
|
2019-07-30 17:16:20 +00:00
|
|
|
#define STPMIC1_MRST_BUCK_DEBUG (STPMIC1_MRST_BUCK(STPMIC1_BUCK1) | \
|
|
|
|
STPMIC1_MRST_BUCK(STPMIC1_BUCK3))
|
2019-02-04 10:26:18 +00:00
|
|
|
|
|
|
|
/* LDOS_MRST_CR */
|
|
|
|
#define STPMIC1_MRST_LDO(ldo) BIT(ldo)
|
2019-07-30 17:16:20 +00:00
|
|
|
#define STPMIC1_MRST_LDO_DEBUG 0
|
2019-02-04 10:26:18 +00:00
|
|
|
|
|
|
|
/* BUCKx_MAIN_CR (x=1...4) */
|
|
|
|
#define STPMIC1_BUCK_ENA BIT(0)
|
|
|
|
#define STPMIC1_BUCK_PREG_MODE BIT(1)
|
|
|
|
#define STPMIC1_BUCK_VOUT_MASK GENMASK(7, 2)
|
|
|
|
#define STPMIC1_BUCK_VOUT_SHIFT 2
|
|
|
|
#define STPMIC1_BUCK_VOUT(sel) (sel << STPMIC1_BUCK_VOUT_SHIFT)
|
|
|
|
|
|
|
|
#define STPMIC1_BUCK2_1200000V STPMIC1_BUCK_VOUT(24)
|
2020-03-06 10:14:03 +00:00
|
|
|
#define STPMIC1_BUCK2_1250000V STPMIC1_BUCK_VOUT(26)
|
2019-02-04 10:26:18 +00:00
|
|
|
#define STPMIC1_BUCK2_1350000V STPMIC1_BUCK_VOUT(30)
|
|
|
|
|
|
|
|
#define STPMIC1_BUCK3_1800000V STPMIC1_BUCK_VOUT(39)
|
|
|
|
|
|
|
|
/* REFDDR_MAIN_CR */
|
|
|
|
#define STPMIC1_VREF_ENA BIT(0)
|
|
|
|
|
|
|
|
/* LDOX_MAIN_CR */
|
|
|
|
#define STPMIC1_LDO_ENA BIT(0)
|
|
|
|
#define STPMIC1_LDO12356_VOUT_MASK GENMASK(6, 2)
|
|
|
|
#define STPMIC1_LDO12356_VOUT_SHIFT 2
|
|
|
|
#define STPMIC1_LDO_VOUT(sel) (sel << STPMIC1_LDO12356_VOUT_SHIFT)
|
|
|
|
|
2019-02-04 10:26:17 +00:00
|
|
|
#define STPMIC1_LDO3_MODE BIT(7)
|
|
|
|
#define STPMIC1_LDO3_DDR_SEL 31
|
2019-02-04 10:26:18 +00:00
|
|
|
#define STPMIC1_LDO3_1800000 STPMIC1_LDO_VOUT(9)
|
|
|
|
|
2019-02-04 10:26:17 +00:00
|
|
|
#define STPMIC1_LDO4_UV 3300000
|
|
|
|
|
2019-02-04 10:26:18 +00:00
|
|
|
/* BST_SW_CR */
|
|
|
|
#define STPMIC1_BST_ON BIT(0)
|
|
|
|
#define STPMIC1_VBUSOTG_ON BIT(1)
|
|
|
|
#define STPMIC1_SWOUT_ON BIT(2)
|
|
|
|
#define STPMIC1_PWR_SW_ON (STPMIC1_VBUSOTG_ON | STPMIC1_SWOUT_ON)
|
2019-02-04 10:26:17 +00:00
|
|
|
|
2019-02-04 10:26:18 +00:00
|
|
|
/* NVM_SR */
|
|
|
|
#define STPMIC1_NVM_BUSY BIT(0)
|
2019-02-04 10:26:17 +00:00
|
|
|
|
2019-02-04 10:26:18 +00:00
|
|
|
/* NVM_CR */
|
|
|
|
#define STPMIC1_NVM_CMD_PROGRAM 1
|
|
|
|
#define STPMIC1_NVM_CMD_READ 2
|
2019-02-04 10:26:17 +00:00
|
|
|
|
2019-02-04 10:26:18 +00:00
|
|
|
/* Timeout */
|
2019-02-04 10:26:17 +00:00
|
|
|
#define STPMIC1_DEFAULT_START_UP_DELAY_MS 1
|
|
|
|
#define STPMIC1_DEFAULT_STOP_DELAY_MS 5
|
|
|
|
#define STPMIC1_USB_BOOST_START_UP_DELAY_MS 10
|
2018-03-12 09:46:12 +00:00
|
|
|
|
|
|
|
enum {
|
2019-02-04 10:26:17 +00:00
|
|
|
STPMIC1_BUCK1,
|
|
|
|
STPMIC1_BUCK2,
|
|
|
|
STPMIC1_BUCK3,
|
|
|
|
STPMIC1_BUCK4,
|
|
|
|
STPMIC1_MAX_BUCK,
|
2018-03-12 09:46:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2019-02-04 10:26:18 +00:00
|
|
|
STPMIC1_PREG_MODE_HP,
|
|
|
|
STPMIC1_PREG_MODE_LP,
|
2018-03-12 09:46:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2019-02-04 10:26:17 +00:00
|
|
|
STPMIC1_LDO1,
|
|
|
|
STPMIC1_LDO2,
|
|
|
|
STPMIC1_LDO3,
|
|
|
|
STPMIC1_LDO4,
|
|
|
|
STPMIC1_LDO5,
|
|
|
|
STPMIC1_LDO6,
|
|
|
|
STPMIC1_MAX_LDO,
|
2018-03-12 09:46:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2019-02-04 10:26:17 +00:00
|
|
|
STPMIC1_LDO_MODE_NORMAL,
|
|
|
|
STPMIC1_LDO_MODE_BYPASS,
|
|
|
|
STPMIC1_LDO_MODE_SINK_SOURCE,
|
2018-03-12 09:46:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2019-02-04 10:26:17 +00:00
|
|
|
STPMIC1_PWR_SW1,
|
|
|
|
STPMIC1_PWR_SW2,
|
|
|
|
STPMIC1_MAX_PWR_SW,
|
2018-03-12 09:46:12 +00:00
|
|
|
};
|
|
|
|
#endif
|