From patchwork Mon Sep 12 13:24:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 668773 X-Patchwork-Delegate: hdegoede@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3sXpSc2Zf1z9s9x for ; Mon, 12 Sep 2016 23:24:48 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AB97D4BD3D; Mon, 12 Sep 2016 15:24:43 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FUZHT_Vh24CB; Mon, 12 Sep 2016 15:24:43 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 312984BA3B; Mon, 12 Sep 2016 15:24:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1722EA753A for ; Mon, 12 Sep 2016 15:24:41 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZY9gT53gwqNM for ; Mon, 12 Sep 2016 15:24:41 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by theia.denx.de (Postfix) with ESMTPS id A49C2A7534 for ; Mon, 12 Sep 2016 15:24:40 +0200 (CEST) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2FA36C05678E; Mon, 12 Sep 2016 13:24:39 +0000 (UTC) Received: from shalem.localdomain.com (vpn1-5-109.ams2.redhat.com [10.36.5.109]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8CDOb1i029805; Mon, 12 Sep 2016 09:24:37 -0400 From: Hans de Goede To: Ian Campbell Date: Mon, 12 Sep 2016 15:24:35 +0200 Message-Id: <20160912132435.9274-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 12 Sep 2016 13:24:39 +0000 (UTC) Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2] sunxi: axp2xx: disable ldoio0/1 at boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When cold-booting the ldoio0/1 regulators are always off / the gpios are always at tristate. But when re-booting from android these are sometimes on. Disable them at axp_init time (iow as early as possible) to remove this difference between a cold boot and a reboot. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- Changes in v2: -Do not or pmic_bus_write results together --- drivers/power/axp209.c | 16 ++++++++++++++++ drivers/power/axp221.c | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c index fc162a1..731b75e 100644 --- a/drivers/power/axp209.c +++ b/drivers/power/axp209.c @@ -167,6 +167,22 @@ int axp_init(void) return rc; } + /* + * Turn off LDOIO regulators / tri-state GPIO pins, when rebooting + * from android these are sometimes on. + */ + rc = pmic_bus_write(AXP_GPIO0_CTRL, AXP_GPIO_CTRL_INPUT); + if (rc) + return rc; + + rc = pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT); + if (rc) + return rc; + + rc = pmic_bus_write(AXP_GPIO2_CTRL, AXP_GPIO_CTRL_INPUT); + if (rc) + return rc; + return 0; } diff --git a/drivers/power/axp221.c b/drivers/power/axp221.c index 727ab09..109d3f4 100644 --- a/drivers/power/axp221.c +++ b/drivers/power/axp221.c @@ -223,6 +223,18 @@ int axp_init(void) if (!(axp_chip_id == 0x6 || axp_chip_id == 0x7 || axp_chip_id == 0x17)) return -ENODEV; + /* + * Turn off LDOIO regulators / tri-state GPIO pins, when rebooting + * from android these are sometimes on. + */ + ret = pmic_bus_write(AXP_GPIO0_CTRL, AXP_GPIO_CTRL_INPUT); + if (ret) + return ret; + + ret = pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT); + if (ret) + return ret; + return 0; }