Renesas ARM Based SoC Fixes for v4.8

* Correct R-Car Gen2 regulator quirk
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXz72KAAoJENfPZGlqN0++ECUP/RFROs0QgOHB+aSU0jHJ5WOX
 Uqt/TQLLGZ2I/8tLtNfdSvSZU8hR/guj9HdbYFd7I0rpH9oI+ZlHby3Qwxsy6VnK
 +5AJlslk77NICFYDNGInD0t2dVCMBybhHJ3UU6rOaZDrd2Jn9MRahgIiIRderc6i
 qj4UX4PX9s8VnnUNFvC59s2fo+QozLF84+kk2UgBjVgTRhfKQMWpJAAyq8o9BN3z
 fQrEGeGd1HxYq/yAYoCpYysV1S1K+hWe51kjwmaIaS15nr9PgcsBTz/DVYVIEyg/
 4IUiVSEEZ9RgN91P79ZICji9RCfa4zokNOI1KcFofC+XxyFEtCUfNo+XvPe0Bkfk
 sVm02iNEwj8nq5mAkeGN5PErJBYYV+Hi8s6OIu/FyvgXayLAbuQEhkv9h7Lm0nNF
 iScWKtWmu6mCf6Xl4atKGpT/OKCC57Or3hw+ra25LmxzD8NIFAM6weB+ne34WBcF
 4Uj42W2gPm8mIloy58g3BJQhiJTPec32sspmApAVYJgEpt7xz8+EZdm4nuS3GLQ5
 fI1m4tE6yIddaCvwclUPS3x1bNMTGqZip9ERky1qHHSbt/PwBJGG54pfsa8SxVdI
 eotX5eckedhb77bHJhu9SORHVLhV6MUcEnYfpLJNqou1B5Iuk6IrIs0spqze4Vyg
 ta+LVpHmbjrq4ajhVBZh
 =Eu0+
 -----END PGP SIGNATURE-----

Merge tag 'renesas-fixes-for-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into fixes

Merge "Renesas ARM Based SoC Fixes for v4.8" from Simon Horman:

* Correct R-Car Gen2 regulator quirk

* tag 'renesas-fixes-for-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas:
  ARM: shmobile: fix regulator quirk for Gen2
This commit is contained in:
Arnd Bergmann 2016-09-09 17:56:40 +02:00
commit d31449a59a
1 changed files with 26 additions and 36 deletions

View File

@ -41,40 +41,27 @@
#define REGULATOR_IRQ_MASK BIT(2) /* IRQ2, active low */
/* start of DA9210 System Control and Event Registers */
#define DA9210_REG_MASK_A 0x54
static void __iomem *irqc;
static const u8 da9063_mask_regs[] = {
DA9063_REG_IRQ_MASK_A,
DA9063_REG_IRQ_MASK_B,
DA9063_REG_IRQ_MASK_C,
DA9063_REG_IRQ_MASK_D,
/* first byte sets the memory pointer, following are consecutive reg values */
static u8 da9063_irq_clr[] = { DA9063_REG_IRQ_MASK_A, 0xff, 0xff, 0xff, 0xff };
static u8 da9210_irq_clr[] = { DA9210_REG_MASK_A, 0xff, 0xff };
static struct i2c_msg da9xxx_msgs[2] = {
{
.addr = 0x58,
.len = ARRAY_SIZE(da9063_irq_clr),
.buf = da9063_irq_clr,
}, {
.addr = 0x68,
.len = ARRAY_SIZE(da9210_irq_clr),
.buf = da9210_irq_clr,
},
};
/* DA9210 System Control and Event Registers */
#define DA9210_REG_MASK_A 0x54
#define DA9210_REG_MASK_B 0x55
static const u8 da9210_mask_regs[] = {
DA9210_REG_MASK_A,
DA9210_REG_MASK_B,
};
static void da9xxx_mask_irqs(struct i2c_client *client, const u8 regs[],
unsigned int nregs)
{
unsigned int i;
dev_info(&client->dev, "Masking %s interrupt sources\n", client->name);
for (i = 0; i < nregs; i++) {
int error = i2c_smbus_write_byte_data(client, regs[i], ~0);
if (error) {
dev_err(&client->dev, "i2c error %d\n", error);
return;
}
}
}
static int regulator_quirk_notify(struct notifier_block *nb,
unsigned long action, void *data)
{
@ -93,12 +80,15 @@ static int regulator_quirk_notify(struct notifier_block *nb,
client = to_i2c_client(dev);
dev_dbg(dev, "Detected %s\n", client->name);
if ((client->addr == 0x58 && !strcmp(client->name, "da9063")))
da9xxx_mask_irqs(client, da9063_mask_regs,
ARRAY_SIZE(da9063_mask_regs));
else if (client->addr == 0x68 && !strcmp(client->name, "da9210"))
da9xxx_mask_irqs(client, da9210_mask_regs,
ARRAY_SIZE(da9210_mask_regs));
if ((client->addr == 0x58 && !strcmp(client->name, "da9063")) ||
(client->addr == 0x68 && !strcmp(client->name, "da9210"))) {
int ret;
dev_info(&client->dev, "clearing da9063/da9210 interrupts\n");
ret = i2c_transfer(client->adapter, da9xxx_msgs, ARRAY_SIZE(da9xxx_msgs));
if (ret != ARRAY_SIZE(da9xxx_msgs))
dev_err(&client->dev, "i2c error %d\n", ret);
}
mon = ioread32(irqc + IRQC_MONITOR);
if (mon & REGULATOR_IRQ_MASK)