From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755967AbbKDQYa (ORCPT ); Wed, 4 Nov 2015 11:24:30 -0500 Received: from down.free-electrons.com ([37.187.137.238]:60561 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751314AbbKDQYC (ORCPT ); Wed, 4 Nov 2015 11:24:02 -0500 Date: Wed, 4 Nov 2015 08:23:04 -0800 From: Maxime Ripard To: Julian Calaby Cc: Jens Kuske , Chen-Yu Tsai , Michael Turquette , Linus Walleij , Rob Herring , Philipp Zabel , Emilio =?iso-8859-1?Q?L=F3pez?= , Vishnu Patekar , Hans de Goede , devicetree , "Mailing List, Arm" , "linux-kernel@vger.kernel.org" , linux-sunxi Subject: Re: [linux-sunxi] [PATCH v4 2/6] clk: sunxi: Add H3 clocks support Message-ID: <20151104162304.GZ6114@lukather> References: <1445964626-6484-1-git-send-email-jenskuske@gmail.com> <1445964626-6484-3-git-send-email-jenskuske@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="s8wpp40TDz0KNMmP" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --s8wpp40TDz0KNMmP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Julian, On Wed, Oct 28, 2015 at 10:12:09AM +1100, Julian Calaby wrote: > > + of_property_for_each_u32(node, "clock-indices", prop, p, index)= { > > + of_property_read_string_index(node, "clock-output-names= ", > > + i, &clk_name); > > + > > + if (index =3D=3D 17 || (index >=3D 29 && index <=3D 31)) > > + clk_parent =3D AHB2; > > + else if (index <=3D 63 || index >=3D 128) > > + clk_parent =3D AHB1; > > + else if (index >=3D 64 && index <=3D 95) > > + clk_parent =3D APB1; > > + else if (index >=3D 96 && index <=3D 127) > > + clk_parent =3D APB2; >=20 > A way to make this reusable in the future might be to encode it in a > structure like: >=20 > static const struct bus_clock_paths sun8i_h3_bus_clock_paths __initdata = =3D { > {.parent =3D 2, .min =3D 17, .max =3D 17}, /* index 17 is from AH= B2 */ > {.parent =3D 2, .min =3D 29, .max =3D 31}, /* AHB2 bank */ > {.parent =3D 1, .min =3D 63, .max =3D 128}, /* AHB1 bank */ > ... > {} > }; >=20 > Then the code here can be reused for other clocks like this in the > future without too much bloat. (And this would potentially could be > generic enough for other platforms.) We don't really need that at the moment. There's not point in writing more complicated code to support a use case we don't have yet. (However, something along these lines will definitely be needed if we ever have another SoC having the same bus gates madness) Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com --s8wpp40TDz0KNMmP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWOjDoAAoJEBx+YmzsjxAg+JAQAK8H8nFF+4KPR74p6KS/xf/0 rvhvHltqFdW/rieslqZydqIlcyaKyFZHKKawDhdjohm0XQaQP4ZxB11ztwXAmd4k 2LbErraLcZt8a0xuHgAF8+Vm0b3Kqx2i/8wfsKqBxMNroVNibeFiriRCj+WnlBSI sv5BOwikoX/1GIwSPKpQPL9kvAX7w6V+3Wu/qryvs5ztxKNVU5TsibyOEcJFDVVq nYZNDWfwMyTPaZp7yINB+JmpRy7IfTHUkan05lYK4AYODqNEpPmAZZIwtFaSLkvy gQjLpBCrIEcP6Y0bmZlNz0eG9yE8AXwF4aJRH5gLlzZL3ebo8b9ThCdyVNm7Dbdg 3Mw1+JhGhun2CKuzUgdoL8Tx+2ojSF4a0fNT3LZ9d+8kJbDiVD7hECyupTRG7KpY gplg6YPh1Hr2L9eAsxZ5MqlvA//wATX5+PHkX9165HhLHYihfdDfBetqAaYedN/R NjAFaGk0SXwV3WOgkyOXGxzUssFpn/4x9qORr1iT0Nc8bcxu/P87uXdrTbfd3FWx NtXichAWv2pJszYVQFRzFLsJz1T1jhrPo774NMqHjUd/Whi9mmItmDEF4sd0V3lJ PeKnr2IU25sZ5xwYl8ad0PVUPN43k6JJ52wzI/AtOSgctpVkkZE9BvTXg0IuPL5a O/xD3n+cewDWaTokpXFM =fwDs -----END PGP SIGNATURE----- --s8wpp40TDz0KNMmP--