diff options
author | Guodong Xu <guodong.xu@linaro.org> | 2013-02-01 06:11:08 +0800 |
---|---|---|
committer | Guodong Xu <guodong.xu@linaro.org> | 2013-02-21 16:12:37 +0800 |
commit | 2a80cddf306f4486a98db08811dafe7b84f41c75 (patch) | |
tree | 4f55f0f3289fa7f569dacd40f0fa8be70220d0e1 /include | |
parent | 6bdd0b0cd106c8e267df840ca40d1f16f6e5d74e (diff) |
mfd: hi6421: add mfd core driver
Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mfd/hi6421-pmic.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/include/linux/mfd/hi6421-pmic.h b/include/linux/mfd/hi6421-pmic.h new file mode 100644 index 00000000000..51ddd6ac8bd --- /dev/null +++ b/include/linux/mfd/hi6421-pmic.h @@ -0,0 +1,55 @@ +/* + * Header file for device driver Hi6421 PMIC + * + * Copyright (c) 2013 Linaro Ltd. + * Copyright (C) 2011 Hisilicon. + * + * Guodong Xu <guodong.xu@linaro.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 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. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#define OCP_DEB_CTRL_REG (0x51) +#define OCP_DEB_SEL_MASK (0x0C) +#define OCP_DEB_SEL_8MS (0x00) +#define OCP_DEB_SEL_16MS (0x04) +#define OCP_DEB_SEL_32MS (0x08) +#define OCP_DEB_SEL_64MS (0x0C) +#define OCP_EN_DEBOUNCE_MASK (0x02) +#define OCP_EN_DEBOUNCE_ENABLE (0x02) +#define OCP_AUTO_STOP_MASK (0x01) +#define OCP_AUTO_STOP_ENABLE (0x01) +#define HI6421_REGS_ENA_PROTECT_TIME (100) /* in microseconds */ +#define HI6421_ECO_MODE_ENABLE (1) +#define HI6421_ECO_MODE_DISABLE (0) + +struct hi6421_pmic { + struct resource *res; + struct device *dev; + void __iomem *regs; + spinlock_t lock; +}; + +/* Register Access Helpers */ +static inline u32 hi6421_pmic_read(struct hi6421_pmic *pmic, int reg) +{ + return readl(pmic->regs + (reg << 2)); +} + +static inline void hi6421_pmic_write(struct hi6421_pmic *pmic, int reg, u32 val) +{ + writel(val, pmic->regs + (reg << 2)); +} + +void hi6421_pmic_rmw(struct hi6421_pmic *pmic, int reg, u32 mask, u32 bits); |