Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp920447imu; Wed, 28 Nov 2018 01:31:58 -0800 (PST) X-Google-Smtp-Source: AFSGD/XsT/d6nmj/JQBWMfi7l9I0nl29MiYoZYzCnUJj9YbG+avOmpLBRHZbRrix8YeQXnluTOvE X-Received: by 2002:a17:902:b701:: with SMTP id d1-v6mr34426058pls.29.1543397518777; Wed, 28 Nov 2018 01:31:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543397518; cv=none; d=google.com; s=arc-20160816; b=VJeOr9L9WqjXlicwxt11VO1tOg1xoFBRTH09M1oT3oIkLRLMs5TQw+V844sx/6/Qxt qWKuUn/qDTqdBeiN1nyybjFwtT9tcumZGyqMIfoCQW66qZktRyxpCflQAMgjm7lF3AZx GYcK9BiStmTseAGglgf3QmFJaI5sW41EDBWGwE6CFZJsmlv7kWhQ8y117cupMeL41NT5 rAWWDt5hyq1hUWdebwRUAHeFgWjVjpnIKhdq4DQhYkU2TQ3Wlyk20dPy4SEvMmJBkDxZ 8Oynfb2ULBEsWgZXtXpRovAqAoRQlIGu43U+CZAHFiZMeuC8YeWAM1nN92Rz4eYT5Ti+ zBkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=K7EgmPINEKrrz3HM2NGpUe7tNyqmvLQVfdVH5Ve3cKA=; b=BDJlbWNuuK4Eic2oU+q7dZ8mnix0hPvNdlNcpV9FMZKHWYY8qlZDrACCY7dc40f8NK e7JT78VWJMp3n+ZOUCkc2WyKMOSVqW4qWXd+16uzhgcT5fiR4iN70ZO6Stif+M/3bb4/ hUghBLLPD4YHiT22/QOJq36Qy9akqr+lb7BTyjRMY9P9KnerB/KiZFBtMNAY7+qNpLMO 4Fmp03ESDAWDgmZPcbR0ApaWP2gOlcRkmuE+TbIhh32KFj9l9PX/FZaZofyOVlTJwSV4 OKunFWCuGiPoIDjvx9QDzHzda9HXTfNLyUJaXATL9AlI3oIYl5jIz8PmUIN0GCbElTn4 108Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d12si6867014pla.351.2018.11.28.01.31.43; Wed, 28 Nov 2018 01:31:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728301AbeK1Ubh (ORCPT + 99 others); Wed, 28 Nov 2018 15:31:37 -0500 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76]:49298 "EHLO wens.csie.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728183AbeK1Ubg (ORCPT ); Wed, 28 Nov 2018 15:31:36 -0500 Received: by wens.csie.org (Postfix, from userid 1000) id 75ACC60339; Wed, 28 Nov 2018 17:30:28 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org, linux-rtc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH 08/15] rtc: sun6i: Expose internal oscillator through device tree Date: Wed, 28 Nov 2018 17:30:06 +0800 Message-Id: <20181128093013.24442-10-wens@csie.org> X-Mailer: git-send-email 2.20.0.rc1 In-Reply-To: <20181128093013.24442-1-wens@csie.org> References: <20181128093013.24442-1-wens@csie.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The bindings have been updated to expose the RTC's internal oscillator, for some SoCs that have it directly feeding the PRCM block. The changes include the index 2 for the clock outputs, as well as the clock output names. This patch adds the internal oscillator to the list of clocks exposed through of_clk_add_hw_provider(), and also have the driver optionally fetch the name of the clock from the device tree if it's available. Signed-off-by: Chen-Yu Tsai --- drivers/rtc/rtc-sun6i.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index 62ed9ce53d8c..273ab7fbbbe3 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -220,6 +220,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node, .ops = &sun6i_rtc_osc_ops, .name = "losc", }; + const char *iosc_name = "rtc-int-osc"; const char *clkout_name = "osc32k-out"; const char *parents[2]; @@ -228,7 +229,7 @@ static void __init sun6i_rtc_clk_init(struct device_node *node, return; rtc->data = data; - clk_data = kzalloc(struct_size(clk_data, hws, 2), GFP_KERNEL); + clk_data = kzalloc(struct_size(clk_data, hws, 3), GFP_KERNEL); if (!clk_data) { kfree(rtc); return; @@ -253,8 +254,10 @@ static void __init sun6i_rtc_clk_init(struct device_node *node, if (!of_get_property(node, "clocks", NULL)) goto err; + of_property_read_string_index(node, "clock-output-names", 2, + &iosc_name); rtc->int_osc = clk_hw_register_fixed_rate_with_accuracy(NULL, - "rtc-int-osc", + iosc_name, NULL, 0, rtc->data->rc_osc_rate, 300000000); @@ -290,9 +293,10 @@ static void __init sun6i_rtc_clk_init(struct device_node *node, return; } - clk_data->num = 2; + clk_data->num = 3; clk_data->hws[0] = &rtc->hw; clk_data->hws[1] = __clk_get_hw(rtc->ext_losc); + clk_data->hws[2] = rtc->int_osc; of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); return; -- 2.20.0.rc1