From patchwork Tue Apr 26 22:36:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Franklin Cooper X-Patchwork-Id: 8947141 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5B8F09F54E for ; Tue, 26 Apr 2016 22:39:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7916F2015A for ; Tue, 26 Apr 2016 22:39:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3AB6D20142 for ; Tue, 26 Apr 2016 22:39:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1avBcf-0007FT-4r; Tue, 26 Apr 2016 22:38:25 +0000 Received: from mail-ob0-f195.google.com ([209.85.214.195]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1avBbi-0006KZ-AE for linux-arm-kernel@lists.infradead.org; Tue, 26 Apr 2016 22:37:27 +0000 Received: by mail-ob0-f195.google.com with SMTP id o7so1697369obl.2 for ; Tue, 26 Apr 2016 15:37:05 -0700 (PDT) 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:in-reply-to :references; bh=fnWRYKodZk5sbB6CZ+BZ9YnxB7L/FFK92O4bLkSu9bY=; b=kqDhP00wNOLnjXle87vlvZ2Tz3x88NQTlpY68UnkdcTPyuzcG83zl+UAI7P/sEAfT2 omrZd3NIsa6djg4BF56Add4wssdDSU/R8ktt00b4euk4sN8oVkONYjC9bxKu4YDVnJ6Q TSJY3e7SNcfDA6hV//sSFYiyogNEEPjn7EDxns50LjMElHTakq75UgQ+JNTG9SPUymDn 7bP5l9+/CGi3EIYaLLNzA12Po1cuOaLURvlN4cVlNgO+dbCzLjIjjRtfyDa8CEN11zkk JkunzC+KT7TlfOz9ELAzhAgmFOFwpPWsJoYobEdPu2bzkK7064EMumOPWOTCFe63nX0K 0YWw== X-Gm-Message-State: AOPr4FVoimZ1nbFIrZ/3UH3ZtqJiDfsCqVIIumnHc/aZ3jR2bjjwkgDskTxRf0oxrUqNnQ== X-Received: by 10.60.118.73 with SMTP id kk9mr2065322oeb.64.1461710225399; Tue, 26 Apr 2016 15:37:05 -0700 (PDT) Received: from beast-server.fios-router.home ([173.64.219.161]) by smtp.gmail.com with ESMTPSA id 5sm405228otw.11.2016.04.26.15.37.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Apr 2016 15:37:04 -0700 (PDT) From: Franklin S Cooper Jr To: thierry.reding@gmail.com, robh+dt@kernel.org, tony@atomide.com, paul@pwsan.com, t-kristo@ti.com, linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, vigneshr@ti.com, nsekhar@ti.com Subject: [PATCH v7 6/9] pwms: pwm-ti*: Get the clock from the PWMSS parent when using old bindings Date: Tue, 26 Apr 2016 17:36:46 -0500 Message-Id: <1461710209-6563-7-git-send-email-fcooper@ti.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1461710209-6563-1-git-send-email-fcooper@ti.com> References: <1461710209-6563-1-git-send-email-fcooper@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160426_153726_474890_3705A3AB X-CRM114-Status: GOOD ( 11.74 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Franklin S Cooper Jr MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 When using the old eCAP and ePWM bindings for AM335x and AM437x the clock can be retrieved from the PWMSS parent. Newer bindings will insure that this clock is provided via device tree. Therefore, update this driver to support the newer and older bindings. In the case of the older binding being used give a warning. Signed-off-by: Franklin S Cooper Jr --- drivers/pwm/pwm-tiecap.c | 7 +++++++ drivers/pwm/pwm-tiehrpwm.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c index 616af76..a0833c8 100644 --- a/drivers/pwm/pwm-tiecap.c +++ b/drivers/pwm/pwm-tiecap.c @@ -195,6 +195,7 @@ static const struct pwm_ops ecap_pwm_ops = { }; static const struct of_device_id ecap_of_match[] = { + { .compatible = "ti,am3352-ecap" }, { .compatible = "ti,am33xx-ecap" }, {}, }; @@ -213,6 +214,12 @@ static int ecap_pwm_probe(struct platform_device *pdev) return -ENOMEM; clk = devm_clk_get(&pdev->dev, "fck"); + + if (IS_ERR(clk) && of_device_is_compatible(pdev->dev.of_node, "ti,am33xx-ecap")) { + dev_warn(&pdev->dev, "Binding is obsolete.\n"); + clk = devm_clk_get(pdev->dev.parent, "fck"); + } + if (IS_ERR(clk)) { dev_err(&pdev->dev, "failed to get clock\n"); return PTR_ERR(clk); diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c index 6a41e66..cee29a2 100644 --- a/drivers/pwm/pwm-tiehrpwm.c +++ b/drivers/pwm/pwm-tiehrpwm.c @@ -426,6 +426,7 @@ static const struct pwm_ops ehrpwm_pwm_ops = { }; static const struct of_device_id ehrpwm_of_match[] = { + { .compatible = "ti,am3352-ehrpwm" }, { .compatible = "ti,am33xx-ehrpwm" }, {}, }; @@ -444,6 +445,12 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev) return -ENOMEM; clk = devm_clk_get(&pdev->dev, "fck"); + + if (IS_ERR(clk) && of_device_is_compatible(pdev->dev.of_node, "ti,am33xx-ecap")) { + dev_warn(&pdev->dev, "Binding is obsolete.\n"); + clk = devm_clk_get(pdev->dev.parent, "fck"); + } + if (IS_ERR(clk)) { dev_err(&pdev->dev, "failed to get clock\n"); return PTR_ERR(clk);