Commit 9d6105e1 authored by Elaine Zhang's avatar Elaine Zhang Committed by Lee Jones

mfd: rk808: Fix up the chip id get failed

the rk8xx chip id is:
((MSB << 8) | LSB) & 0xfff0
Signed-off-by: default avatarElaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: default avatarJoseph Chen <chenjh@rock-chips.com>
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 5771a8c0
...@@ -325,7 +325,7 @@ static int rk808_probe(struct i2c_client *client, ...@@ -325,7 +325,7 @@ static int rk808_probe(struct i2c_client *client,
void (*pm_pwroff_fn)(void); void (*pm_pwroff_fn)(void);
int nr_pre_init_regs; int nr_pre_init_regs;
int nr_cells; int nr_cells;
int pm_off = 0; int pm_off = 0, msb, lsb;
int ret; int ret;
int i; int i;
...@@ -333,14 +333,23 @@ static int rk808_probe(struct i2c_client *client, ...@@ -333,14 +333,23 @@ static int rk808_probe(struct i2c_client *client,
if (!rk808) if (!rk808)
return -ENOMEM; return -ENOMEM;
rk808->variant = i2c_smbus_read_word_data(client, RK808_ID_MSB); /* Read chip variant */
if (rk808->variant < 0) { msb = i2c_smbus_read_byte_data(client, RK808_ID_MSB);
dev_err(&client->dev, "Failed to read the chip id at 0x%02x\n", if (msb < 0) {
dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
RK808_ID_MSB); RK808_ID_MSB);
return rk808->variant; return msb;
} }
dev_dbg(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant); lsb = i2c_smbus_read_byte_data(client, RK808_ID_LSB);
if (lsb < 0) {
dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
RK808_ID_LSB);
return lsb;
}
rk808->variant = ((msb << 8) | lsb) & RK8XX_ID_MSK;
dev_info(&client->dev, "chip id: 0x%x\n", (unsigned int)rk808->variant);
switch (rk808->variant) { switch (rk808->variant) {
case RK808_ID: case RK808_ID:
......
...@@ -298,6 +298,7 @@ enum rk818_reg { ...@@ -298,6 +298,7 @@ enum rk818_reg {
#define VOUT_LO_INT BIT(0) #define VOUT_LO_INT BIT(0)
#define CLK32KOUT2_EN BIT(0) #define CLK32KOUT2_EN BIT(0)
#define RK8XX_ID_MSK 0xfff0
enum { enum {
BUCK_ILMIN_50MA, BUCK_ILMIN_50MA,
BUCK_ILMIN_100MA, BUCK_ILMIN_100MA,
......
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