From patchwork Tue Dec 31 13:05:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 990 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 7478E3F077 for ; Tue, 31 Dec 2019 14:06:09 +0100 (CET) Received: by mail-pf1-f200.google.com with SMTP id d127sf17770229pfa.7 for ; Tue, 31 Dec 2019 05:06:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1577797568; cv=pass; d=google.com; s=arc-20160816; b=hVt6SJHvgMrPQLT/jXeVluTjvghNnDBphanvLsmi9OeEpAnLP6XNV5aBIZYCt8Q2pm 2PAoMJe+QMS49o0fysgQpS9slIUbrKnhpmTOH3rs3TKCu9TZmfFaR1WTsMRGjsPXdlBO LrQBZSOKOI92WKOv9Rhbjy/yIMqgConD4rFC/qqcCDEGEKsC2OIXKm73g7Jh3vK8Qx8x o87jtXC6JeeoTXCpkZ2RNT2B41UBVMhmvCrqfaHOQH2OwztzeABUCpZ+a3Ovwnmz8xym +u+55+2iMOhCo8PjeshicjE33CIiQZ3qGYdu8SibJdjBZG1wuYLvbIQYsJDMtGeHGc6V vhUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=R24XXfc/43g3PfVq5vjQrgg/auxAg2rUwWWNyOMsOHM=; b=VwW1BPL4izbu7hQK+OWXTvqG3eXfHMd/orU/LVJsSvzeSYDlAlqjrpA4TabDQnh+hY i5nulq06+JJBshyO/PmZrB2MS3gGC+ftk1d22kzfyurxAndZjWmCqkNiPIbti7UHwIAK nbbkKd2fdRturXrgUqdpXSMsVggdKCyZppXceG+u9yxJFxDQI/jYPzek4rNEOzHNuV+V ccsDqCnbGJHKZwLhNiK8Q7X04l+OvUjqAkhKzKJwp7AOtFkqTHUl3jp+cAI61u7J8IDb cPtsJPMJW4jbO+92yZUPy+tyBnDf5JtaZba0s8raE2NJa849Vwu4LvKWBvZcmDN4x6oV 7wIQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DZP420mW; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=R24XXfc/43g3PfVq5vjQrgg/auxAg2rUwWWNyOMsOHM=; b=l8KwL689WsPi+RAMEvPfmFQnyLrgY4IFtrDVLW4O1iuUiYt8Cf2JuNDx5YYy0FyinJ 2kCSyRXPX336/L+hggLQ3hInbwYfa2tgBs0G2RHOO7wkQtFv6ikx/kx7H2P2j4cnxZ58 0U3KhXucuEyCyIVc+oKG3fpfFfVCUGWyo07vk= 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:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=R24XXfc/43g3PfVq5vjQrgg/auxAg2rUwWWNyOMsOHM=; b=fsqx0fVgY8UUxRonI2KvLNdYe1q9aeBCo1nEUpFebJNbQWzcQq9zp8ZDCb0YjDTt4Y tS+WBoaNua7TO8AqA4YBlfImReFnv8eP/z6hKoNsLXUPJvqZ9Hz/NK5hvXaDBWqpb6D6 vsVzV20EWg3hUTykegtPIl7BUNbEZHYhZzMetuhJzIZIhhZOEqb0FEKznw44+WO4tgrK ruKHJ7wrYgh56iMGDT7lFvzKS2AcwOKpuon0mszx3oUadZuYMCGIDJuG2f3zlEGwVIgU 8FdclXYpDgI+frXv5oScgv/yzhOSM/Lm2cSLTJ+MhoTetDpQHxLRZ9MoO8uKnubFMl0i Y5/Q== X-Gm-Message-State: APjAAAWi1eiwfEpT55nKhJ5tub1vxSDWQBLMcjdDxREPGAGZRHuYs10S OmzJNN6xSqwF1qPRQUdH96W8qo7h X-Google-Smtp-Source: APXvYqw9cUVn1U0q0fZVSNvJPfw289ru/wmMobaPQC6p/5NCzCWQnQTJiRMTdD2qsrf0pIIt1aRn3w== X-Received: by 2002:a62:3703:: with SMTP id e3mr67924418pfa.154.1577797568308; Tue, 31 Dec 2019 05:06:08 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:791:: with SMTP id 139ls3985116pgh.4.gmail; Tue, 31 Dec 2019 05:06:08 -0800 (PST) X-Received: by 2002:a62:7c54:: with SMTP id x81mr74666484pfc.180.1577797567847; Tue, 31 Dec 2019 05:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577797567; cv=none; d=google.com; s=arc-20160816; b=E5BG98w/e6+3fz2MidbzBeLysNoChbDZ9PC3+he9MbD7JVvciO5FDK5F2zO8CA56PZ eNnIxAxlO0X2lzxapYbrKN/Fz2tTftKp/L1hztpPWvZC4HH0oKepcZuvl6JFqPugDJi0 Yzo//nCSpve/6xYf4m7uDQMlfwYRcY4of07PK/T8gliLWbXK1LDvVMmy/SpZGkQJ3ztn M0yB4dhBJuCl4mtGbp5KJATIasd7eZwY9GHIRrOcjRbPoISnzZL/kf9XdHidlBvopqxY Lptq3FmWEk+XLO4wMdqiACKPuT2osuOpvyLCe1snHgyEUlENdU8QB5TghpAv/FaPVD3Z FQ1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ILMGQ7TE10GrDN5X2gxz42T2rcYYzl5utH4bizVuaeo=; b=UjYQ7M63xZQr3CRd3izSZW55Bd5cNTyzEjNa9fVa5mhUPr4p6gygXygQ0QpzHlNBur uFXDVA3aWDnBTayNfSEZQART2ExiZuH+sNreIQAFmntYrWX0gfuAUpRiFSuJ4X5cMeK3 ugnAW6zAifpxaWSGDHp0SCp8R6GdjN/ETSu1bBLYR+VAmRoj12PMHNJpUyfI/tlMs97I a6ff0oU6acSpV7i32rl7MT61rPcLaBjCF2Cly+7uQUM6SVGNejAQFqsqRN7zyQBA8F6i NliaD0JjyMVQPRtpW9zxrdGg8rrMK8TCLg9xVtPS0kpSaQGcG0QgAVyjGHb+2sgeXsz2 40Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DZP420mW; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id e28sor49379356pgn.38.2019.12.31.05.06.07 for (Google Transport Security); Tue, 31 Dec 2019 05:06:07 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a63:d00f:: with SMTP id z15mr77454505pgf.143.1577797567531; Tue, 31 Dec 2019 05:06:07 -0800 (PST) Received: from localhost.localdomain ([49.206.202.115]) by smtp.gmail.com with ESMTPSA id i3sm55204089pfg.94.2019.12.31.05.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Dec 2019 05:06:06 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Rob Herring Cc: David Airlie , Daniel Vetter , Mark Rutland , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-sunxi , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v3 5/9] drm/sun4i: tcon_top: Register reset, clock gates in probe Date: Tue, 31 Dec 2019 18:35:24 +0530 Message-Id: <20191231130528.20669-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20191231130528.20669-1-jagan@amarulasolutions.com> References: <20191231130528.20669-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DZP420mW; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , TCON TOP is processing clock gates and reset control for TV0, TV1 and DSI channels during bind and release the same during unbind component ops. The usual DSI initialization would setup all controller clocks along with DPHY clocking during probe. Since the actual clock gates (along with DSI clock gate) are initialized during ton top bind, the DPHY is failed to get the DSI clock during that time. To solve, this circular dependency move the reset control, clock gate registration from bind to probe and release the same from unbind to remove. This eventually give a chance DPHY to initialize the DSI clock gate. Signed-off-by: Jagan Teki --- Changes for v3: - fixed comments from Chen-Yu - move reset control methods into probe drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 41 +++++++++++++------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c index e0b3c5330b9a..732ac19b4371 100644 --- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c +++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c @@ -124,7 +124,22 @@ static struct clk_hw *sun8i_tcon_top_register_gate(struct device *dev, static int sun8i_tcon_top_bind(struct device *dev, struct device *master, void *data) { - struct platform_device *pdev = to_platform_device(dev); + return 0; +} + +static void sun8i_tcon_top_unbind(struct device *dev, struct device *master, + void *data) +{ +} + +static const struct component_ops sun8i_tcon_top_ops = { + .bind = sun8i_tcon_top_bind, + .unbind = sun8i_tcon_top_unbind, +}; + +static int sun8i_tcon_top_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; struct clk_hw_onecell_data *clk_data; struct sun8i_tcon_top *tcon_top; const struct sun8i_tcon_top_quirks *quirks; @@ -132,7 +147,7 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, void __iomem *regs; int ret, i; - quirks = of_device_get_match_data(&pdev->dev); + quirks = of_device_get_match_data(dev); tcon_top = devm_kzalloc(dev, sizeof(*tcon_top), GFP_KERNEL); if (!tcon_top) @@ -226,22 +241,21 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, dev_set_drvdata(dev, tcon_top); - return 0; + return component_add(dev, &sun8i_tcon_top_ops); err_unregister_gates: for (i = 0; i < CLK_NUM; i++) if (!IS_ERR_OR_NULL(clk_data->hws[i])) clk_hw_unregister_gate(clk_data->hws[i]); - clk_disable_unprepare(tcon_top->bus); err_assert_reset: reset_control_assert(tcon_top->rst); return ret; } -static void sun8i_tcon_top_unbind(struct device *dev, struct device *master, - void *data) +static int sun8i_tcon_top_remove(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct sun8i_tcon_top *tcon_top = dev_get_drvdata(dev); struct clk_hw_onecell_data *clk_data = tcon_top->clk_data; int i; @@ -253,21 +267,8 @@ static void sun8i_tcon_top_unbind(struct device *dev, struct device *master, clk_disable_unprepare(tcon_top->bus); reset_control_assert(tcon_top->rst); -} - -static const struct component_ops sun8i_tcon_top_ops = { - .bind = sun8i_tcon_top_bind, - .unbind = sun8i_tcon_top_unbind, -}; - -static int sun8i_tcon_top_probe(struct platform_device *pdev) -{ - return component_add(&pdev->dev, &sun8i_tcon_top_ops); -} -static int sun8i_tcon_top_remove(struct platform_device *pdev) -{ - component_del(&pdev->dev, &sun8i_tcon_top_ops); + component_del(dev, &sun8i_tcon_top_ops); return 0; }