From patchwork Sun Dec 22 20:27:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 182368 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp3232720ilf; Sun, 22 Dec 2019 12:27:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyl41Qmg59NNKdoQED7GzE+QM/gmDYx3ZofC+pSgKGcSKGa3r39xLly+F8EbQAkB5cJ0bHC X-Received: by 2002:a05:6830:18e3:: with SMTP id d3mr22653409otf.190.1577046469862; Sun, 22 Dec 2019 12:27:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577046469; cv=none; d=google.com; s=arc-20160816; b=sz0EOS0fz3eSuIM50B6Ze5dEdnny7jT7vOzwsNGGMZS4IXxnAkWWwK6LfmflzyjuRO h/M8+6IONFjymV257Ew0c+F+94zJy8roLecfi5347Ps7vdj5naCA19Q3Xvq0PoGpGao/ gpIqvUeebrKLbQ0U0pAHQUUubj3H9/mZGamTwYtM0Wm898LXK7peHpMd9lF7ZDNj13uC fpnZPkb/wAPY2RPJHCWAZeCR3aTWQIpIpvE6aqWni8ZnoVP+8oSnuzuqqByU7DYpnjsa Xvs9RDv9M8mqwvsn5D7whqHMefp4vUpd+NxlpmA0Ux8h/QBRzuHl4RuC9e3goieq2wP3 g/OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=M/XhSv9rcF0XWmB/OEE0N6v1jyA2bXv8OJQMzsw7bGY=; b=PMtQoXD/ea+6MfWxVUorkrfVlH3hcQnVI124Gs8yoJDivjQ4exMwod1D0ojS3tR5Ze SWz1kwtesmZ2ZqcmZ8tD5n+MN8cIHLu9Qv+9heTuq2wEpczhOvsK84oXViFkRriN1yPi FT923Y/FReTQkI+j0N5hxCIkinqJYY4/ILf4A4Th/QIRe0oOdHFfirjgjbHfar9KLyN3 Aj91atfOAV2pY6CBBErtRAF5tozYIRgQBKVPTGULDE+LU/xgD+Rwpfy/TIb7O56SJt2e KadsP4centNbSkp/tp4x8iTjMwR0aBIepnesiEu/53Qm8MSBl1PkEuCshvsvoE8MEVCW BNzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QP7mfRM0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y3si5970980oto.98.2019.12.22.12.27.49; Sun, 22 Dec 2019 12:27:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QP7mfRM0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726705AbfLVU1m (ORCPT + 27 others); Sun, 22 Dec 2019 15:27:42 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:33717 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725951AbfLVU1m (ORCPT ); Sun, 22 Dec 2019 15:27:42 -0500 Received: by mail-lf1-f65.google.com with SMTP id n25so11117236lfl.0 for ; Sun, 22 Dec 2019 12:27:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=M/XhSv9rcF0XWmB/OEE0N6v1jyA2bXv8OJQMzsw7bGY=; b=QP7mfRM0SFh4sSHhwTjky3RtPOPheJZMTGoxFL0N9x2HHtYfJWngVjbpVYFa+o5H1c AWgszBEdGZHtdQ8ReL4ZZCGyJ+CB3IozFrk23ZNzhusRSefmqaIA8iM/CRNXqxcT4viQ QraMPV5mtLAz6882ctaXgv/fft14e4P/XOCY0PIF9SMra6SC3yzyi5rLculbJ+MqV7Nm fbSQY4oAwVuHURNuBlxQqc807pcO1L3GJe3Rd2de0aGmKjBwuEKpUhkrDUrqe2DI462q bYj0424tC4Uh//TC5EbTfw/tAo9xHsZrA8o5Fg9gCltOVOx2aCLZLSQwopeb0fZRiC+P zu4Q== 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:mime-version :content-transfer-encoding; bh=M/XhSv9rcF0XWmB/OEE0N6v1jyA2bXv8OJQMzsw7bGY=; b=AOMv/XOPHl8HHq1RVNZI9hxLSLbKLjkz8kon+fXcMKNN3hY2x0NwwQuRjKTlieVPbh 8Pc7z35szGsJNwdpwdBjKQ5xzoIykUnGgjprKVzqWas+1lxr08V2sxQQcBlBpn9zWVIJ HyEflKXbRlubmLCvrW04jAFKxDjGDGwB/v2YiIyuSaRBXWU5f83z4XVhex7mhU3ISVNG wSvgTNr9+mCFjRZT5wCWOipa/Qtj+ty7kS12gN7nAO21iNiD1vGdZSUYHxj8sFWRBvgV hqWWWbL3vAUveN2oKi8J7Xr0l+InH05/mKCqOionnzQnyIbE3lU/bPMvh+jdeDF1jV4p A26A== X-Gm-Message-State: APjAAAVeXJxfeIaqgaXZZwN1tZSbgKAuNVVpD0O4MHFf6mXvFyccL1VM xoh2GlTJN0GGd7CLCFNS7JYqQg== X-Received: by 2002:a19:5f05:: with SMTP id t5mr15013827lfb.149.1577046460055; Sun, 22 Dec 2019 12:27:40 -0800 (PST) Received: from localhost.bredbandsbolaget (c-21cd225c.014-348-6c756e10.bbcust.telenor.se. [92.34.205.33]) by smtp.gmail.com with ESMTPSA id i17sm5775449ljd.34.2019.12.22.12.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2019 12:27:38 -0800 (PST) From: Linus Walleij To: lee.jones@linaro.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Stephan Gerhold Subject: [PATCH] mfd: db8500-prcmu: Fix DSI LP clock Date: Sun, 22 Dec 2019 21:27:35 +0100 Message-Id: <20191222202735.13910-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The DB8420 sysclk firmware is missing the ULPPLL (ultra-low power phase locked loop) which has repercussions on how the DSI LP clock is handled in the PRCMU driver. This was missed in the patch adding support for the U8420 sysclk firmware variant. Move the functions around a bit to avoid forward declarations. This fix is not a regression as no systems in the kernel are currently using it. Cc: Stephan Gerhold Fixes: 22fb3ad0cc5f ("mfd: db8500-prcmu: Support U8420-sysclk firmware") Signed-off-by: Linus Walleij --- drivers/mfd/db8500-prcmu.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) -- 2.21.0 diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 26d967a1a046..8aa701f81a08 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -561,7 +561,8 @@ static struct dsiescclk dsiescclk[3] = { /* DPI 50000000 Hz */ #define PRCMU_DPI_CLOCK_SETTING ((1 << PRCMU_CLK_PLL_SW_SHIFT) | \ (16 << PRCMU_CLK_PLL_DIV_SHIFT)) -#define PRCMU_DSI_LP_CLOCK_SETTING 0x00000E00 +#define PRCMU_DSI_LP_CLOCK_SETTING_ULPPLL_ON 0x00000E00 +#define PRCMU_DSI_LP_CLOCK_SETTING_ULPPLL_OFF 0x00000A00 /* D=101, N=1, R=4, SELDIV2=0 */ #define PRCMU_PLLDSI_FREQ_SETTING 0x00040165 @@ -577,6 +578,19 @@ static struct dsiescclk dsiescclk[3] = { #define PRCMU_PLLDSI_LOCKP_LOCKED 0x3 +struct prcmu_fw_version *prcmu_get_fw_version(void) +{ + return fw_info.valid ? &fw_info.version : NULL; +} + +static bool prcmu_is_ulppll_disabled(void) +{ + struct prcmu_fw_version *ver; + + ver = prcmu_get_fw_version(); + return ver && ver->project == PRCMU_FW_PROJECT_U8420_SYSCLK; +} + int db8500_prcmu_enable_dsipll(void) { int i; @@ -627,7 +641,10 @@ int db8500_prcmu_set_display_clocks(void) cpu_relax(); writel(PRCMU_DSI_CLOCK_SETTING, prcmu_base + PRCM_HDMICLK_MGT); - writel(PRCMU_DSI_LP_CLOCK_SETTING, prcmu_base + PRCM_TVCLK_MGT); + if (prcmu_is_ulppll_disabled()) + writel(PRCMU_DSI_LP_CLOCK_SETTING_ULPPLL_OFF, prcmu_base + PRCM_TVCLK_MGT); + else + writel(PRCMU_DSI_LP_CLOCK_SETTING_ULPPLL_ON, prcmu_base + PRCM_TVCLK_MGT); writel(PRCMU_DPI_CLOCK_SETTING, prcmu_base + PRCM_LCDCLK_MGT); /* Release the HW semaphore. */ @@ -664,19 +681,6 @@ void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value) spin_unlock_irqrestore(&prcmu_lock, flags); } -struct prcmu_fw_version *prcmu_get_fw_version(void) -{ - return fw_info.valid ? &fw_info.version : NULL; -} - -static bool prcmu_is_ulppll_disabled(void) -{ - struct prcmu_fw_version *ver; - - ver = prcmu_get_fw_version(); - return ver && ver->project == PRCMU_FW_PROJECT_U8420_SYSCLK; -} - bool prcmu_has_arm_maxopp(void) { return (readb(tcdm_base + PRCM_AVS_VARM_MAX_OPP) &