From patchwork Thu Feb 15 11:33:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10220927 X-Patchwork-Delegate: horms@verge.net.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3B0A66055C for ; Thu, 15 Feb 2018 11:34:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DFD9290F3 for ; Thu, 15 Feb 2018 11:34:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 229AC290F9; Thu, 15 Feb 2018 11:34:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB3CF290F7 for ; Thu, 15 Feb 2018 11:34:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967265AbeBOLeD (ORCPT ); Thu, 15 Feb 2018 06:34:03 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:32770 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967763AbeBOLeC (ORCPT ); Thu, 15 Feb 2018 06:34:02 -0500 Received: by mail-wr0-f196.google.com with SMTP id s5so3021067wra.0 for ; Thu, 15 Feb 2018 03:34:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=M6ZgJIMt27PzdtFCtGq0AYqB9vPz2UL2R/ynDtH6L6A=; b=We7FB3cRvRHqvIRqLBnAcmNZCtVhJ2wHDXgyZRpzAPODZ685tN2lPfFiTI8qgDKUSZ 3H6GSlRx2KsIUHTL9c20AbPUMya5UynrP/WCdPc0gYV9IO6JQA/30YCQ+ki9butTQHTN rUhoT8EZjyY9W+v2vhMw0HQGqyn7kjkRCvua29ZaQIZssuf1rbacouKjkkZdT/kdDkmi vhK1HWjgBJNlUTRoMXjGNkOQ1Fdhh79DhoAPP83m12DhdLjZXLn7tO10zi/cxwMd3MkO AuMMySTYcBzodURfU1xOcxEUemKzX+cCPV+4wly77U07mWF/2fV9ij2KFMk2xV/uR/qY vSkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=M6ZgJIMt27PzdtFCtGq0AYqB9vPz2UL2R/ynDtH6L6A=; b=dDFb14ExIYjj1OZ6fOv4AQ9zOaWCmdQNzAvCwSZ4xMg+DNMJsvpX7ABh4ijk2WyzhA o0uSqMN8MOuHX8V654cNj89yR/SVmHJCI3RWDSEX5Plq6H9U+zIl2nsdLsYg+HKR2Kz+ GcaY7ic2KPDobE59XIebCdid6Ak4kCo+HxitQtdnHD9Ab/pPn0I7bC1ej+G6ggOwPJFe WOrZZvrgC+UEvIY/+b+WQILkvPpgV5S/uRRxYxInHRst0ATqnx+5ISNMYpk6Mqsz06Fh FPyMlZSKnitVGWBQCVGHPxWzH98p/y4n+qiWDunq8/SzYmdyaetl8CyJSdZeWjabYTB+ la9w== X-Gm-Message-State: APf1xPBmGTEG0AnvlUW6PAp7H8RVbyHWJHNCZIvjo9I/Ovyf12dSyhQd V1MW0Iyoid6LT6V8Y9UOcTzkgjwE X-Google-Smtp-Source: AH8x227papyB3x2QXI3r2MvIP+WjFBWkTmwJl5FEzn5cz4tArWHReJUJ6aUldH5XdeE3lv1DfgIJgw== X-Received: by 10.223.144.163 with SMTP id i32mr2320641wri.73.1518694440761; Thu, 15 Feb 2018 03:34:00 -0800 (PST) Received: from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id b30sm4868871wra.34.2018.02.15.03.33.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 03:33:59 -0800 (PST) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-renesas-soc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Marek Vasut , Geert Uytterhoeven , Kuninori Morimoto , Simon Horman , Wolfram Sang Subject: [PATCH V3] ARM: shmobile: stout: enable R-Car Gen2 regulator quirk Date: Thu, 15 Feb 2018 12:33:50 +0100 Message-Id: <20180215113350.9613-1-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.15.1 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Regulator setup is suboptimal on H2 Stout too. The Stout newly has two DA9210 regulators, so the quirk is extended to handle another DA9210 at i2c address 0x70. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Kuninori Morimoto Cc: Simon Horman Cc: Wolfram Sang --- V2: - Handle another DA9210 at 0x70 - Drop explicit board list from the leading comment in the file V3: - Correct da9xxx_msgs[] array size - Send messages to all three regulators on Stout only --- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c index 44438f344dc8..27fb3a5ec73e 100644 --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c @@ -1,9 +1,9 @@ /* * R-Car Generation 2 da9063/da9210 regulator quirk * - * The r8a7790/lager and r8a7791/koelsch development boards have da9063 and - * da9210 regulators. Both regulators have their interrupt request lines tied - * to the same interrupt pin (IRQ2) on the SoC. + * Certain Gen2 development boards have an da9063 and one or more da9210 + * regulators. All of these regulators have their interrupt request lines + * tied to the same interrupt pin (IRQ2) on the SoC. * * After cold boot or da9063-induced restart, both the da9063 and da9210 seem * to assert their interrupt request lines. Hence as soon as one driver @@ -50,7 +50,7 @@ static void __iomem *irqc; 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] = { +static struct i2c_msg da9xxx_msgs[3] = { { .addr = 0x58, .len = ARRAY_SIZE(da9063_irq_clr), @@ -59,6 +59,10 @@ static struct i2c_msg da9xxx_msgs[2] = { .addr = 0x68, .len = ARRAY_SIZE(da9210_irq_clr), .buf = da9210_irq_clr, + }, { + .addr = 0x70, + .len = ARRAY_SIZE(da9210_irq_clr), + .buf = da9210_irq_clr, }, }; @@ -85,11 +89,15 @@ static int regulator_quirk_notify(struct notifier_block *nb, dev_dbg(dev, "Detected %s\n", client->name); if ((client->addr == 0x58 && !strcmp(client->name, "da9063")) || - (client->addr == 0x68 && !strcmp(client->name, "da9210"))) { - int ret; + (client->addr == 0x68 && !strcmp(client->name, "da9210")) || + (client->addr == 0x70 && !strcmp(client->name, "da9210"))) { + int ret, len; + + /* There are two DA9210 on Stout, one on the other boards. */ + len = of_machine_is_compatible("renesas,stout") ? 3 : 2; dev_info(&client->dev, "clearing da9063/da9210 interrupts\n"); - ret = i2c_transfer(client->adapter, da9xxx_msgs, ARRAY_SIZE(da9xxx_msgs)); + ret = i2c_transfer(client->adapter, da9xxx_msgs, len); if (ret != ARRAY_SIZE(da9xxx_msgs)) dev_err(&client->dev, "i2c error %d\n", ret); } @@ -118,6 +126,7 @@ static int __init rcar_gen2_regulator_quirk(void) if (!of_machine_is_compatible("renesas,koelsch") && !of_machine_is_compatible("renesas,lager") && + !of_machine_is_compatible("renesas,stout") && !of_machine_is_compatible("renesas,gose")) return -ENODEV;