From patchwork Thu Dec 6 11:25:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Muellner X-Patchwork-Id: 1008709 X-Patchwork-Delegate: philipp.tomsich@theobroma-systems.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=theobroma-systems.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 439YJ65Br2z9s47 for ; Thu, 6 Dec 2018 22:28:22 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 598E5C225AE; Thu, 6 Dec 2018 11:27:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 779A1C22599; Thu, 6 Dec 2018 11:26:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3B757C22538; Thu, 6 Dec 2018 11:26:02 +0000 (UTC) Received: from mail.theobroma-systems.com (vegas.theobroma-systems.com [144.76.126.164]) by lists.denx.de (Postfix) with ESMTPS id 400C5C22162 for ; Thu, 6 Dec 2018 11:25:59 +0000 (UTC) Received: from [86.59.122.178] (port=40454 helo=purcell.lan) by mail.theobroma-systems.com with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1gUrn3-0003nQ-AK; Thu, 06 Dec 2018 12:25:57 +0100 From: Christoph Muellner To: Philipp Tomsich , Klaus Goger , Albert Aribaud , Jaehoon Chung , Simon Glass Date: Thu, 6 Dec 2018 12:25:42 +0100 Message-Id: <20181206112542.20143-5-christoph.muellner@theobroma-systems.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181206112542.20143-1-christoph.muellner@theobroma-systems.com> References: <20181206112542.20143-1-christoph.muellner@theobroma-systems.com> Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 4/4] rockchip: puma-rk3399: Enable vdd-log during bootup. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" On the RK3399-Q7 "Puma" module VDD_LOG is generated by an external regulator, which sets the voltage level to 900 mV, which is within the allowed range and which works quite fine. However, in specific use-cases we need to adjust VDD_LOG to maintain stable operation or to reduce power consumption. This adjustment can be done via pwm2. This patch allows to tune the VDD_LOG voltage level via DTS. To do so the following things are done: * Setup pin muxing for PWM2 (based on DTS settings) * Turn on the vdd_log regulator (based on DTS settings) Reported-by: Assaf Agmon Signed-off-by: Philipp Tomsich Signed-off-by: Christoph Muellner Reviewed-by: Philipp Tomsich --- board/theobroma-systems/puma_rk3399/puma-rk3399.c | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index 573e691457f..e2915fcca50 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -23,10 +23,34 @@ #include #include +static int setup_pinctrl(void) +{ + int ret; + struct udevice *pinctrl; + + ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); + if (ret) { + debug("%s: Cannot find pinctrl device\n", __func__); + goto out; + } + + /* Enable pwm2 for vdd_log regulator. */ + ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2); + if (ret) { + printf("%s PWM2 pinctrl init fail!\n", __func__); + goto out; + } + +out: + return 0; +} + int board_init(void) { int ret; + setup_pinctrl(); + /* * We need to call into regulators_enable_boot_on() again, as the call * during SPL may have not included all regulators. @@ -35,6 +59,25 @@ int board_init(void) if (ret) debug("%s: Cannot enable boot on regulator\n", __func__); + /* + * vdd_log is ignored by regulators_enable_boot_on(), because + * regulator-min-microvolt != regulator-max-microvolt. + * Therefore we explicitly enable it here. + */ + struct udevice *regulator; + ret = regulator_get_by_platname("vdd_log", ®ulator); + if (ret) { + debug("%s Looking up regulator vdd-log failed!\n", __func__); + goto out; + } + + ret = regulator_set_enable(regulator, true); + if (ret) { + debug("%s Enabling vdd-log failed!\n", __func__); + goto out; + } + +out: return 0; }