From patchwork Thu Mar 30 15:22:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 9654541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D1C3B602BD for ; Thu, 30 Mar 2017 15:27:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3F2820881 for ; Thu, 30 Mar 2017 15:27:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B71762854F; Thu, 30 Mar 2017 15:27:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D33420881 for ; Thu, 30 Mar 2017 15:27:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934356AbdC3P1X (ORCPT ); Thu, 30 Mar 2017 11:27:23 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:43339 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933769AbdC3PX1 (ORCPT ); Thu, 30 Mar 2017 11:23:27 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id 41842207D1; Thu, 30 Mar 2017 17:23:24 +0200 (CEST) Received: from localhost (83.146.29.93.rev.sfr.net [93.29.146.83]) by mail.free-electrons.com (Postfix) with ESMTPSA id 0B494207F0; Thu, 30 Mar 2017 17:23:08 +0200 (CEST) From: Gregory CLEMENT To: Ulf Hansson , Adrian Hunter , linux-mmc@vger.kernel.org Cc: Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , Gregory CLEMENT , Thomas Petazzoni , linux-arm-kernel@lists.infradead.org, Mike Turquette , Stephen Boyd , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, Ziji Hu , Jimmy Xu , Jisheng Zhang , Nadav Haklai , Ryan Gao , Doug Jones , Victor Gu , "Wei(SOCP) Liu" , Wilson Ding , Yehuda Yitschak , Marcin Wojtas , Hanna Hawa , Kostya Porotchkin Subject: [PATCH v7 02/13] clk: apn806: Turn the eMMC clock as optional for dts backwards compatible Date: Thu, 30 Mar 2017 17:22:54 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP First version of the binding didn't have the eMMC clock. This patch allows to not registering the eMMC clock if it is not present in the device tree. Then the device tree can be backwards compatible. Suggested-by: Stephen Boyd Signed-off-by: Gregory CLEMENT --- drivers/clk/mvebu/ap806-system-controller.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/clk/mvebu/ap806-system-controller.c b/drivers/clk/mvebu/ap806-system-controller.c index 901d89c4ab4a..103fe18a3c29 100644 --- a/drivers/clk/mvebu/ap806-system-controller.c +++ b/drivers/clk/mvebu/ap806-system-controller.c @@ -136,13 +136,19 @@ static int ap806_syscon_clk_probe(struct platform_device *pdev) } /* eMMC Clock is fixed clock divided by 3 */ - of_property_read_string_index(np, "clock-output-names", - 4, &name); - ap806_clks[4] = clk_register_fixed_factor(NULL, name, fixedclk_name, - 0, 1, 3); - if (IS_ERR(ap806_clks[4])) { - ret = PTR_ERR(ap806_clks[4]); - goto fail4; + if (of_property_read_string_index(np, "clock-output-names", + 4, &name)) { + ap806_clk_data.clk_num--; + dev_warn(&pdev->dev, + "eMMC clock mising: update the device tree!\n"); + } else { + ap806_clks[4] = clk_register_fixed_factor(NULL, name, + fixedclk_name, + 0, 1, 3); + if (IS_ERR(ap806_clks[4])) { + ret = PTR_ERR(ap806_clks[4]); + goto fail4; + } } of_clk_add_provider(np, of_clk_src_onecell_get, &ap806_clk_data);