1 /* 2 * ROHM BD9571MWV-M driver 3 * 4 * Copyright (C) 2017 Marek Vasut <marek.vasut+renesas@gmail.com> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. 9 * 10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any 11 * kind, whether expressed or implied; without even the implied warranty 12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License version 2 for more details. 14 * 15 * Based on the TPS65086 driver 16 */ 17 18 #ifndef __LINUX_MFD_BD9571MWV_H 19 #define __LINUX_MFD_BD9571MWV_H 20 21 #include <linux/device.h> 22 #include <linux/regmap.h> 23 24 /* List of registers for BD9571MWV */ 25 #define BD9571MWV_VENDOR_CODE 0x00 26 #define BD9571MWV_VENDOR_CODE_VAL 0xdb 27 #define BD9571MWV_PRODUCT_CODE 0x01 28 #define BD9571MWV_PRODUCT_CODE_VAL 0x60 29 #define BD9571MWV_PRODUCT_REVISION 0x02 30 31 #define BD9571MWV_I2C_FUSA_MODE 0x10 32 #define BD9571MWV_I2C_MD2_E1_BIT_1 0x11 33 #define BD9571MWV_I2C_MD2_E1_BIT_2 0x12 34 35 #define BD9571MWV_BKUP_MODE_CNT 0x20 36 #define BD9571MWV_BKUP_MODE_STATUS 0x21 37 #define BD9571MWV_BKUP_RECOVERY_CNT 0x22 38 #define BD9571MWV_BKUP_CTRL_TIM_CNT 0x23 39 #define BD9571MWV_WAITBKUP_WDT_CNT 0x24 40 #define BD9571MWV_128H_TIM_CNT 0x26 41 #define BD9571MWV_QLLM_CNT 0x27 42 43 #define BD9571MWV_AVS_SET_MONI 0x31 44 #define BD9571MWV_AVS_SET_MONI_MASK 0x3 45 #define BD9571MWV_AVS_VD09_VID(n) (0x32 + (n)) 46 #define BD9571MWV_AVS_DVFS_VID(n) (0x36 + (n)) 47 48 #define BD9571MWV_VD18_VID 0x42 49 #define BD9571MWV_VD25_VID 0x43 50 #define BD9571MWV_VD33_VID 0x44 51 52 #define BD9571MWV_DVFS_VINIT 0x50 53 #define BD9571MWV_DVFS_SETVMAX 0x52 54 #define BD9571MWV_DVFS_BOOSTVID 0x53 55 #define BD9571MWV_DVFS_SETVID 0x54 56 #define BD9571MWV_DVFS_MONIVDAC 0x55 57 #define BD9571MWV_DVFS_PGD_CNT 0x56 58 59 #define BD9571MWV_GPIO_DIR 0x60 60 #define BD9571MWV_GPIO_OUT 0x61 61 #define BD9571MWV_GPIO_IN 0x62 62 #define BD9571MWV_GPIO_DEB 0x63 63 #define BD9571MWV_GPIO_INT_SET 0x64 64 #define BD9571MWV_GPIO_INT 0x65 65 #define BD9571MWV_GPIO_INTMASK 0x66 66 67 #define BD9571MWV_REG_KEEP(n) (0x70 + (n)) 68 69 #define BD9571MWV_PMIC_INTERNAL_STATUS 0x80 70 #define BD9571MWV_PROT_ERROR_STATUS0 0x81 71 #define BD9571MWV_PROT_ERROR_STATUS1 0x82 72 #define BD9571MWV_PROT_ERROR_STATUS2 0x83 73 #define BD9571MWV_PROT_ERROR_STATUS3 0x84 74 #define BD9571MWV_PROT_ERROR_STATUS4 0x85 75 76 #define BD9571MWV_INT_INTREQ 0x90 77 #define BD9571MWV_INT_INTREQ_MD1_INT BIT(0) 78 #define BD9571MWV_INT_INTREQ_MD2_E1_INT BIT(1) 79 #define BD9571MWV_INT_INTREQ_MD2_E2_INT BIT(2) 80 #define BD9571MWV_INT_INTREQ_PROT_ERR_INT BIT(3) 81 #define BD9571MWV_INT_INTREQ_GP_INT BIT(4) 82 #define BD9571MWV_INT_INTREQ_128H_OF_INT BIT(5) 83 #define BD9571MWV_INT_INTREQ_WDT_OF_INT BIT(6) 84 #define BD9571MWV_INT_INTREQ_BKUP_TRG_INT BIT(7) 85 #define BD9571MWV_INT_INTMASK 0x91 86 87 #define BD9571MWV_ACCESS_KEY 0xff 88 89 /* Define the BD9571MWV IRQ numbers */ 90 enum bd9571mwv_irqs { 91 BD9571MWV_IRQ_MD1, 92 BD9571MWV_IRQ_MD2_E1, 93 BD9571MWV_IRQ_MD2_E2, 94 BD9571MWV_IRQ_PROT_ERR, 95 BD9571MWV_IRQ_GP, 96 BD9571MWV_IRQ_128H_OF, 97 BD9571MWV_IRQ_WDT_OF, 98 BD9571MWV_IRQ_BKUP_TRG, 99 }; 100 101 /** 102 * struct bd9571mwv - state holder for the bd9571mwv driver 103 * 104 * Device data may be used to access the BD9571MWV chip 105 */ 106 struct bd9571mwv { 107 struct device *dev; 108 struct regmap *regmap; 109 110 /* IRQ Data */ 111 int irq; 112 struct regmap_irq_chip_data *irq_data; 113 }; 114 115 #endif /* __LINUX_MFD_BD9571MWV_H */ 116