From patchwork Fri Aug 15 05:41:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 35423 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A9AA2203C5 for ; Fri, 15 Aug 2014 05:41:29 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf14682056pde.3 for ; Thu, 14 Aug 2014 22:41:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=/CKnpjr4HNDWbDDK29aZotISltWz26c26GdT1Ri5+fo=; b=jArgAufrZDHCGxF01K4ZqdFsJoAr3TpOx0klHdKrTdn87jvSxl6Mc04jVF1tCGxqq1 5W5Ul1DBWDog2uSMXlMlH28qApS2Umt4ULoVQutydfEvwG8DSkRHCk0+aoDJgAOy2HeM AiLY7lY/NY4LkXLlbMErDgNqfwQQJJICiEe65IvSxbuquivoFGDj48u783rh9m+JDWp+ Cg0BTzVgXzMum1eG/Qyio6i6+FC+TZvIb9X77Rc23E0WaMvj99PoUwIXMCZf3Rbfw9m/ 8AHN6rZ9W+erMRORTJyov0Od6+qopYgFLEVvftzPgh9Ix5s3xPvM0cmlm7SUT1CGq/81 6gig== X-Gm-Message-State: ALoCoQl8Gxqb/Hlhs5iJRXvl+m5PmqAEn9XT9vp/7hVhAqNUAohGxJhBR8pwrb9o1arpms1RnO+N X-Received: by 10.66.224.40 with SMTP id qz8mr8629963pac.20.1408081288823; Thu, 14 Aug 2014 22:41:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.40.134 with SMTP id x6ls1274214qgx.45.gmail; Thu, 14 Aug 2014 22:41:28 -0700 (PDT) X-Received: by 10.140.104.138 with SMTP id a10mr23035624qgf.19.1408081288714; Thu, 14 Aug 2014 22:41:28 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id jz8si10590170qcb.4.2014.08.14.22.41.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 14 Aug 2014 22:41:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id im17so2535427vcb.17 for ; Thu, 14 Aug 2014 22:41:28 -0700 (PDT) X-Received: by 10.52.190.71 with SMTP id go7mr7200804vdc.28.1408081288470; Thu, 14 Aug 2014 22:41:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp88314vcb; Thu, 14 Aug 2014 22:41:27 -0700 (PDT) X-Received: by 10.67.29.227 with SMTP id jz3mr8788048pad.62.1408081287402; Thu, 14 Aug 2014 22:41:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cn10si6743849pdb.43.2014.08.14.22.41.26 for ; Thu, 14 Aug 2014 22:41:27 -0700 (PDT) Received-SPF: none (google.com: linux-arm-msm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751067AbaHOFlZ (ORCPT + 5 others); Fri, 15 Aug 2014 01:41:25 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:39279 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751009AbaHOFlZ (ORCPT ); Fri, 15 Aug 2014 01:41:25 -0400 Received: by mail-pd0-f179.google.com with SMTP id v10so2837585pde.10 for ; Thu, 14 Aug 2014 22:41:24 -0700 (PDT) X-Received: by 10.66.97.99 with SMTP id dz3mr9339906pab.71.1408081284560; Thu, 14 Aug 2014 22:41:24 -0700 (PDT) Received: from localhost.localdomain ([117.222.40.137]) by mx.google.com with ESMTPSA id ob14sm10543172pdb.40.2014.08.14.22.41.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Aug 2014 22:41:23 -0700 (PDT) From: Srinivas Kandagatla To: agross@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v1] soc: qcom: do not disable the iface clock in probe Date: Fri, 15 Aug 2014 06:41:08 +0100 Message-Id: <1408081268-5748-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The use case here is when we have a bootconsole which is printing the characters on serial console and gsbi driver comes up after some time. As gsbi driver disables the clock in probe the bootconsole locks up. This patch fixes the problem by disabling the clock in platform remove rather than in probe. Tested-by: Linus Walleij Signed-off-by: Srinivas Kandagatla --- Changes since RFC: - none, just a subject line change. drivers/soc/qcom/qcom_gsbi.c | 46 +++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c index 447458e..7e1f120 100644 --- a/drivers/soc/qcom/qcom_gsbi.c +++ b/drivers/soc/qcom/qcom_gsbi.c @@ -22,44 +22,63 @@ #define GSBI_CTRL_REG 0x0000 #define GSBI_PROTOCOL_SHIFT 4 +struct gsbi_info { + struct clk *hclk; + u32 mode; + u32 crci; +}; + static int gsbi_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; struct resource *res; void __iomem *base; - struct clk *hclk; - u32 mode, crci = 0; + struct gsbi_info *gsbi; + + gsbi = devm_kzalloc(&pdev->dev, sizeof(*gsbi), GFP_KERNEL); + + if (!gsbi) + return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(base)) return PTR_ERR(base); - if (of_property_read_u32(node, "qcom,mode", &mode)) { + if (of_property_read_u32(node, "qcom,mode", &gsbi->mode)) { dev_err(&pdev->dev, "missing mode configuration\n"); return -EINVAL; } /* not required, so default to 0 if not present */ - of_property_read_u32(node, "qcom,crci", &crci); + of_property_read_u32(node, "qcom,crci", &gsbi->crci); - dev_info(&pdev->dev, "GSBI port protocol: %d crci: %d\n", mode, crci); + dev_info(&pdev->dev, "GSBI port protocol: %d crci: %d\n", + gsbi->mode, gsbi->crci); + gsbi->hclk = devm_clk_get(&pdev->dev, "iface"); + if (IS_ERR(gsbi->hclk)) + return PTR_ERR(gsbi->hclk); - hclk = devm_clk_get(&pdev->dev, "iface"); - if (IS_ERR(hclk)) - return PTR_ERR(hclk); + clk_prepare_enable(gsbi->hclk); - clk_prepare_enable(hclk); - - writel_relaxed((mode << GSBI_PROTOCOL_SHIFT) | crci, + writel_relaxed((gsbi->mode << GSBI_PROTOCOL_SHIFT) | gsbi->crci, base + GSBI_CTRL_REG); /* make sure the gsbi control write is not reordered */ wmb(); - clk_disable_unprepare(hclk); + platform_set_drvdata(pdev, gsbi); + + return of_platform_populate(node, NULL, NULL, &pdev->dev); +} + +static int gsbi_remove(struct platform_device *pdev) +{ + struct gsbi_info *gsbi = platform_get_drvdata(pdev); + + clk_disable_unprepare(gsbi->hclk); - return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); + return 0; } static const struct of_device_id gsbi_dt_match[] = { @@ -76,6 +95,7 @@ static struct platform_driver gsbi_driver = { .of_match_table = gsbi_dt_match, }, .probe = gsbi_probe, + .remove = gsbi_remove, }; module_platform_driver(gsbi_driver);