Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp972677imu; Wed, 28 Nov 2018 02:34:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/VDwMBIDF70ZrN9ycc6ZvLylt+JhT5xLTAROZwNcKdndge/BtL3Q847AllDg6pfOQUGMeR2 X-Received: by 2002:a63:585c:: with SMTP id i28mr32875870pgm.178.1543401250025; Wed, 28 Nov 2018 02:34:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401250; cv=none; d=google.com; s=arc-20160816; b=av+fIVmbpLKck1UAHHZA+VaG+GXBseYbWZ37XiAhKbnCriQ/S/gb9+zKJ0BxcM/iR+ G6g77P7xVR4QhSZzh7LcHhK+yWSi/yV5xH89VzOTcV2IfcFABCBtRQcH14c5PC2hmX0a WoCxxBfRY0iBPgTySUuzZ95i4tI1XeZal6BMNe2HVtlg/uYt61TEZdZU5FaVkPlVgwBQ jNM8MABsUd2m3Z2mHuVP4eIIjRjJJBTZt+rwyn+amGfhqBux45mcANR9FuYfjyCW3P63 axcP4gAp/VHkR1bL6egq8MKyxiH9/ZpCMkTeQEwibUIhmN0on8G0NMNAwiYneqbvRMBw CnGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=N/PXtlsQV6dpyDm8bdv5KamlqXtZUhK9hXN6vzwV3Hc=; b=cjtrzpbObb9PzwLmoyX3IVhnqqIaBhyIj4Blz7UD5SgQOj++bqAoyJ2JdtjTUVcV9t XaEdx4kobRkaimx73pQwytQ6ag4OjIZ/PeMdknp/gXR9acGfCSjmhjn5zeYc1jVvcY27 F49sbnDr/cIy0wiy4rVRw3u+Q4+2c+me7wpDdjT/KFz14S8bNrZ8Sp6lchwVuc3YbTPT /Hr/bwPm54IbkmHjrloKLadAm1ruXUw31ZY76TvAZJqzIBslEzmelMnwMbnzGNgE2tSF q2jVfmDNDprLsr0z4XmDGbWICzFG4kZ3i111ntEet2+iinfQne4p+BFi+PaAOh+hqZdA BLVQ== 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 d13si6989516plr.403.2018.11.28.02.33.54; Wed, 28 Nov 2018 02:34:09 -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 S1727939AbeK1Veb (ORCPT + 99 others); Wed, 28 Nov 2018 16:34:31 -0500 Received: from mail.bootlin.com ([62.4.15.54]:48350 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727413AbeK1Vea (ORCPT ); Wed, 28 Nov 2018 16:34:30 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 2F61720743; Wed, 28 Nov 2018 11:33:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (aaubervilliers-681-1-94-205.w90-88.abo.wanadoo.fr [90.88.35.205]) by mail.bootlin.com (Postfix) with ESMTPSA id 1BB44207AD; Wed, 28 Nov 2018 11:33:02 +0100 (CET) Date: Wed, 28 Nov 2018 11:33:02 +0100 From: Maxime Ripard To: Chen-Yu Tsai Cc: Alexandre Belloni , Alessandro Zummo , Michael Turquette , Stephen Boyd , Rob Herring , Mark Rutland , 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: Re: [PATCH 08/15] rtc: sun6i: Expose internal oscillator through device tree Message-ID: <20181128103302.n7abjuf4ixjafth6@flea> References: <20181128093013.24442-1-wens@csie.org> <20181128093013.24442-10-wens@csie.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4vh5seys36kdunea" Content-Disposition: inline In-Reply-To: <20181128093013.24442-10-wens@csie.org> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --4vh5seys36kdunea Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 65;5402;1c On Wed, Nov 28, 2018 at 05:30:06PM +0800, Chen-Yu Tsai wrote: > 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. >=20 > 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. >=20 > Signed-off-by: Chen-Yu Tsai > --- > drivers/rtc/rtc-sun6i.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) >=20 > 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_n= ode *node, > .ops =3D &sun6i_rtc_osc_ops, > .name =3D "losc", > }; > + const char *iosc_name =3D "rtc-int-osc"; > const char *clkout_name =3D "osc32k-out"; > const char *parents[2]; > =20 > @@ -228,7 +229,7 @@ static void __init sun6i_rtc_clk_init(struct device_n= ode *node, > return; > =20 > rtc->data =3D data; > - clk_data =3D kzalloc(struct_size(clk_data, hws, 2), GFP_KERNEL); > + clk_data =3D 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; > =20 > + of_property_read_string_index(node, "clock-output-names", 2, > + &iosc_name); > rtc->int_osc =3D 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; > } > =20 > - clk_data->num =3D 2; > + clk_data->num =3D 3; > clk_data->hws[0] =3D &rtc->hw; > clk_data->hws[1] =3D __clk_get_hw(rtc->ext_losc); > + clk_data->hws[2] =3D rtc->int_osc; Shouldn't we add a check on either the compatible on the number of clock-output-names? Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --4vh5seys36kdunea Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCW/5u3gAKCRDj7w1vZxhR xdgBAP0TS5jYj43RhJUZaBpvilPR8NCcJn0ROpWAHbuAwipcrwEAys09f2igBsbo NqXxEBFIQT32qOacr+yaLZwpCXZWJQQ= =MIEY -----END PGP SIGNATURE----- --4vh5seys36kdunea--