Commit c0146735 authored by Andre Werner's avatar Andre Werner Committed by Lee Jones

mfd: tps65086: Read DEVICE ID register 1 from device

This commit prepares a following commit for the regulator part of the MFD.
The driver should support different device chips that differ in their
register definitions, for instance to control LDOA1 and SWB2.
So it is necessary to use a dedicated regulator description for a
specific device variant. Thus, the content from DEVICEID Register 1 is
used to choose a dedicated configuration between the different device
variants.
Signed-off-by: default avatarAndre Werner <andre.werner@systec-electronic.com>
Link: https://lore.kernel.org/r/20230818083721.29790-2-andre.werner@systec-electronic.comSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent 06c2afb8
...@@ -81,16 +81,23 @@ static int tps65086_probe(struct i2c_client *client) ...@@ -81,16 +81,23 @@ static int tps65086_probe(struct i2c_client *client)
return PTR_ERR(tps->regmap); return PTR_ERR(tps->regmap);
} }
ret = regmap_read(tps->regmap, TPS65086_DEVICEID, &version); /* Store device ID to load regulator configuration that fit to IC variant */
ret = regmap_read(tps->regmap, TPS65086_DEVICEID1, &tps->chip_id);
if (ret) { if (ret) {
dev_err(tps->dev, "Failed to read revision register\n"); dev_err(tps->dev, "Failed to read revision register 1\n");
return ret;
}
ret = regmap_read(tps->regmap, TPS65086_DEVICEID2, &version);
if (ret) {
dev_err(tps->dev, "Failed to read revision register 2\n");
return ret; return ret;
} }
dev_info(tps->dev, "Device: TPS65086%01lX, OTP: %c, Rev: %ld\n", dev_info(tps->dev, "Device: TPS65086%01lX, OTP: %c, Rev: %ld\n",
(version & TPS65086_DEVICEID_PART_MASK), (version & TPS65086_DEVICEID2_PART_MASK),
(char)((version & TPS65086_DEVICEID_OTP_MASK) >> 4) + 'A', (char)((version & TPS65086_DEVICEID2_OTP_MASK) >> 4) + 'A',
(version & TPS65086_DEVICEID_REV_MASK) >> 6); (version & TPS65086_DEVICEID2_REV_MASK) >> 6);
if (tps->irq > 0) { if (tps->irq > 0) {
ret = regmap_add_irq_chip(tps->regmap, tps->irq, IRQF_ONESHOT, 0, ret = regmap_add_irq_chip(tps->regmap, tps->irq, IRQF_ONESHOT, 0,
......
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
#include <linux/regmap.h> #include <linux/regmap.h>
/* List of registers for TPS65086 */ /* List of registers for TPS65086 */
#define TPS65086_DEVICEID 0x01 #define TPS65086_DEVICEID1 0x00
#define TPS65086_IRQ 0x02 #define TPS65086_DEVICEID2 0x01
#define TPS65086_IRQ 0x02
#define TPS65086_IRQ_MASK 0x03 #define TPS65086_IRQ_MASK 0x03
#define TPS65086_PMICSTAT 0x04 #define TPS65086_PMICSTAT 0x04
#define TPS65086_SHUTDNSRC 0x05 #define TPS65086_SHUTDNSRC 0x05
...@@ -75,10 +76,16 @@ ...@@ -75,10 +76,16 @@
#define TPS65086_IRQ_SHUTDN_MASK BIT(3) #define TPS65086_IRQ_SHUTDN_MASK BIT(3)
#define TPS65086_IRQ_FAULT_MASK BIT(7) #define TPS65086_IRQ_FAULT_MASK BIT(7)
/* DEVICEID Register field definitions */ /* DEVICEID1 Register field definitions */
#define TPS65086_DEVICEID_PART_MASK GENMASK(3, 0) #define TPS6508640_ID 0x00
#define TPS65086_DEVICEID_OTP_MASK GENMASK(5, 4) #define TPS65086401_ID 0x01
#define TPS65086_DEVICEID_REV_MASK GENMASK(7, 6) #define TPS6508641_ID 0x10
#define TPS65086470_ID 0x70
/* DEVICEID2 Register field definitions */
#define TPS65086_DEVICEID2_PART_MASK GENMASK(3, 0)
#define TPS65086_DEVICEID2_OTP_MASK GENMASK(5, 4)
#define TPS65086_DEVICEID2_REV_MASK GENMASK(7, 6)
/* VID Masks */ /* VID Masks */
#define BUCK_VID_MASK GENMASK(7, 1) #define BUCK_VID_MASK GENMASK(7, 1)
...@@ -100,6 +107,7 @@ enum tps65086_irqs { ...@@ -100,6 +107,7 @@ enum tps65086_irqs {
struct tps65086 { struct tps65086 {
struct device *dev; struct device *dev;
struct regmap *regmap; struct regmap *regmap;
unsigned int chip_id;
/* IRQ Data */ /* IRQ Data */
int irq; int irq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment