From 0bb292e384ba540f9b0c4901f75a9bf2db1413ec Mon Sep 17 00:00:00 2001 From: "henryc.chen" Date: Wed, 2 Mar 2016 15:51:44 +0800 Subject: mediatek/mt8173: Add da9212 driver Add secondary PMIC for external buck control on Oak rev0/1/2/5 BRANCH=none BUG=none TEST=verified on Oak rev4/rev5 Change-Id: Ia000b0c7d61e8396856656247f9627e33b21b19b Signed-off-by: Patrick Georgi Original-Commit-Id: 241508e7d781fac8ee085ee81962043dd654c52d Original-Change-Id: I6c75e2462363a5523bf1ebb03af7a36740293624 Original-Signed-off-by: henryc.chen Original-Reviewed-on: https://chromium-review.googlesource.com/332342 Original-Commit-Ready: Yidi Lin Original-Tested-by: Yidi Lin Original-Reviewed-by: Julius Werner Reviewed-on: https://review.coreboot.org/14122 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/soc/mediatek/mt8173/include/soc/da9212.h | 85 ++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/soc/mediatek/mt8173/include/soc/da9212.h (limited to 'src/soc/mediatek/mt8173/include') diff --git a/src/soc/mediatek/mt8173/include/soc/da9212.h b/src/soc/mediatek/mt8173/include/soc/da9212.h new file mode 100644 index 0000000000..388958d92b --- /dev/null +++ b/src/soc/mediatek/mt8173/include/soc/da9212.h @@ -0,0 +1,85 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2015 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __SOC_DA9212_H_ +#define __SOC_DA9212_H_ + +void da9212_probe(uint8_t i2c_num); + +enum { + /* Page selection */ + DA9212_REG_PAGE_CON = 0x0, + + /* Regulator Registers */ + DA9212_REG_BUCKA_CONT = 0x5D, + DA9212_REG_BUCKB_CONT = 0x5E, + DA9212_REG_BUCKA_CONF = 0xD1, + DA9212_REG_BUCKB_CONF = 0xD2, +}; + +/* DA9212_REG_PAGE_CON (addr=0x0) */ +enum { + DA9212_REG_PAGE_SHIFT = 0, + DA9212_REG_PAGE_MASK = 0xf +}; + +enum { + DA9212_REG_PAGE0 = 0, + DA9212_REG_PAGE2 = 2, + DA9212_REG_PAGE4 = 4, + DA9212_PAGE_WRITE_MODE = 0x0, + DA9212_REPEAT_WRITE_MODE = 0x40, + DA9212_PAGE_REVERT = 0x80 +}; + +/* DA9212_REG_BUCKA/B_CONT (addr=0x5D/0x5E) */ +enum { + DA9212_BUCK_EN_SHIFT = 0, + DA9212_BUCK_OFF = 0x0, + DA9212_BUCK_ON = 0x1, + DA9212_BUCK_GPI_SHIFT = 1, + DA9212_BUCK_GPI_MASK = 0x3, + DA9212_BUCK_GPI_OFF = 0x0, + DA9212_BUCK_GPI_GPIO0 = 0x1, + DA9212_BUCK_GPI_GPIO1 = 0x2, + DA9212_BUCK_GPI_GPIO4 = 0x3, + DA9212_VBUCK_SEL_SHIFT = 4, + DA9212_VBUCK_SEL_MASK = 0x1, + DA9212_VBUCK_SEL_A = 0x0, + DA9212_VBUCK_SEL_B = 0x1, +}; + +/* DA9212_REG_BUCKA/B_CONF (addr=0xD1/0xD2) */ +enum { + DA9212_BUCK_MODE_SHIFT = 0, + DA9212_BUCK_MODE_MASK = 0x3, + DA9212_BUCK_MODE_MANUAL = 0x0, + DA9212_BUCK_MODE_PFM = 0x1, + DA9212_BUCK_MODE_PWM = 0x2, + DA9212_BUCK_MODE_AUTO = 0x3, +}; + +/* DA9212_REG_CONFIG_E (addr=0x147) */ +enum { + /* DEVICE IDs */ + DA9212_REG_DEVICE_ID = 0x1, + DA9212_ID = 0x22, + DA9213_ID = 0x23, + DA9212_REG_VARIANT_ID = 0x2, + DA9212_VARIANT_ID_AB = 0x10, + DA9212_VARIANT_ID_AC = 0x20 +}; + +#endif -- cgit v1.2.3