From patchwork Tue Jan 19 13:10:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 8061471 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD61BBEEE5 for ; Tue, 19 Jan 2016 13:11:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC5262039C for ; Tue, 19 Jan 2016 13:11:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A40CD20397 for ; Tue, 19 Jan 2016 13:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751184AbcASNLZ (ORCPT ); Tue, 19 Jan 2016 08:11:25 -0500 Received: from mail-yk0-f179.google.com ([209.85.160.179]:33412 "EHLO mail-yk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751051AbcASNLY (ORCPT ); Tue, 19 Jan 2016 08:11:24 -0500 Received: by mail-yk0-f179.google.com with SMTP id k129so624016773yke.0 for ; Tue, 19 Jan 2016 05:11:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=AUs/i7c13f8oNSuTvsWNjVY7IdIe0HbxowdisZ8IuNg=; b=b96OtSmtmgCP4VO1H5Unc6HGh1rrA6++XjR+clVlmxFuNV5bqQJK2NbKfuMTKmbC3G EmHMPjIJ8d3ZTswc+mIifZJ0Ma49oynykotxUjUA2PLDfoZASNCG21I5i0u9bKNNPG8P +ETzIvabDuBpXiS42zeMGdcYyLa83GEKOkhpOOB2Jblo3NP27ou9Ni29pyWrNF8YnpQe aVjAENlp20kt+TU8wSAX7QsucI/lOtU/jWRCJLxlt8mrRnEaqKKApB01tRrYRS6a8h2i EeSY490noiH/kZaY5+Ev4VHP1CpidyKntwJYKHSD1VQwOEM1LXWq0BW01lyCRkFEy1l2 s3og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AUs/i7c13f8oNSuTvsWNjVY7IdIe0HbxowdisZ8IuNg=; b=ToZXMGQk57FJEuNm09URa5SG/U6JVtD2JQoxZM+BWkRnHXKYxuAK8SHLWdZF+0rAID bcQYdYDsjFe8INXwkGXhqhi9CkgCCEzLcq8s8NOQ5eCRntALSIkx6cWChi4TCsdGDzXl wzHoWbZNgBxrdG74vR6hvwGBtcmwZ3z2foelgZtzfZxNAKSzpXu/k3BDWdUWeR9/JT3O YCnJ3XhUkQrFYyhSpe592HeC8RUHX5XjwyXYrl5FLLq1D5uUmju/sbtVioxIOFHGq40F T6tJSGO5e56aUfxZegFbyrxFp9W6JqWVrquj/7IvhsqXnJ7iwW7qSXN2Cuv/I3Tc7JeG XVKg== X-Gm-Message-State: ALoCoQmD1MSm5fbe5KTuuc3yHw7HHBhIXLE8GwuewAVFAKeg8/5rjxsfMDRvNP5taHqYum9tEPjHXRXGGB+sSN5lGrhvkEXUxg== X-Received: by 10.13.226.198 with SMTP id l189mr18314666ywe.239.1453209083789; Tue, 19 Jan 2016 05:11:23 -0800 (PST) Received: from localhost.localdomain ([187.64.228.119]) by smtp.gmail.com with ESMTPSA id h68sm15409353ywd.42.2016.01.19.05.11.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jan 2016 05:11:23 -0800 (PST) From: Fabio Estevam To: tomi.valkeinen@ti.com Cc: kernel@pengutronix.de, csotoalonso@gmail.com, linux-fbdev@vger.kernel.org, mturquette@baylibre.com, Fabio Estevam Subject: [PATCH] video: fbdev: imxfb: Provide a reset mechanism Date: Tue, 19 Jan 2016 11:10:57 -0200 Message-Id: <1453209057-16444-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam Currently when we boot the kernel on a mx25pdk the LCDC controller does not show the Linux logo on boot. This problem is well explained by Sascha Hauer: "Unfortunately this LCD controller does not have an enable bit. The controller starts directly when the clocks are enabled. If the clocks are enabled when the controller is not yet programmed with proper register values then it just goes into some undefined state. What I suspect is that the clocks already were enabled before driver probe, presumably by the bootloader, so the controller is already in undefined state when entering Linux. Now by dis/enabling the ipg clock you effectively reset the controller. Since you have programmed it with valid register values in the mean time it starts working after this reset." So do as suggested and force a reset of the LCDC hardware by enabling and disabling the IPG clock. With this change the Linux logo can be seen on boot on a mx25pdk. Signed-off-by: Fabio Estevam --- drivers/video/fbdev/imxfb.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c index cee8860..bb2f1e8 100644 --- a/drivers/video/fbdev/imxfb.c +++ b/drivers/video/fbdev/imxfb.c @@ -902,6 +902,21 @@ static int imxfb_probe(struct platform_device *pdev) goto failed_getclock; } + /* + * The LCDC controller does not have an enable bit. The + * controller starts directly when the clocks are enabled. + * If the clocks are enabled when the controller is not yet + * programmed with proper register values (enabled at the + * bootloader, for example) then it just goes into some undefined + * state. + * To avoid this issue, let's enable and disable LCDC IPG clock + * so that we force some kind of 'reset' to the LCDC block. + */ + ret = clk_prepare_enable(fbi->clk_ipg); + if (ret) + goto failed_getclock; + clk_disable_unprepare(fbi->clk_ipg); + fbi->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); if (IS_ERR(fbi->clk_ahb)) { ret = PTR_ERR(fbi->clk_ahb);