Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753091AbbEQMzU (ORCPT ); Sun, 17 May 2015 08:55:20 -0400 Received: from down.free-electrons.com ([37.187.137.238]:35013 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752819AbbEQMzD (ORCPT ); Sun, 17 May 2015 08:55:03 -0400 Date: Sun, 17 May 2015 14:50:14 +0200 From: Maxime Ripard To: Jens Kuske Cc: Emilio =?iso-8859-1?Q?L=F3pez?= , Mike Turquette , Linus Walleij , Rob Herring , Chen-Yu Tsai , Vishnu Patekar , Hans de Goede , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: Re: [PATCH v2 02/10] clk: sunxi: Add support for multiple parents to gates Message-ID: <20150517125014.GB4004@lukather> References: <1431707940-19372-1-git-send-email-jenskuske@gmail.com> <1431707940-19372-3-git-send-email-jenskuske@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wNT7VBaN1rUIB9jO" Content-Disposition: inline In-Reply-To: <1431707940-19372-3-git-send-email-jenskuske@gmail.com> 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 Content-Length: 3796 Lines: 107 --wNT7VBaN1rUIB9jO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Jens, On Fri, May 15, 2015 at 06:38:52PM +0200, Jens Kuske wrote: > Some newer sunxi SoCs (A83T, H3) don't have individual registers for > AHB1, APB1 and APB2 gates anymore, but one big bus gates area where each > gate can have a different parent. >=20 > The current clock driver sets the same parent for all gates in a group. > This commit adds a new parents field to the gates_data structure, which > allows us to specify an array of parent indices for every single gate. >=20 > Signed-off-by: Jens Kuske > --- > drivers/clk/sunxi/clk-sunxi.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c > index 9a82f17..17cba4d 100644 > --- a/drivers/clk/sunxi/clk-sunxi.c > +++ b/drivers/clk/sunxi/clk-sunxi.c > @@ -898,6 +898,8 @@ static void __init sunxi_divider_clk_setup(struct dev= ice_node *node, > =20 > struct gates_data { > DECLARE_BITMAP(mask, SUNXI_GATES_MAX_SIZE); > + /* If used, ARRAY_SIZE(parents) has to be >=3D bitmap_weight(mask) */ > + const u8 *parents; > }; > =20 > static const struct gates_data sun4i_axi_gates_data __initconst =3D { > @@ -1000,16 +1002,21 @@ static void __init sunxi_gates_clk_setup(struct d= evice_node *node, > struct gates_data *data) > { > struct clk_onecell_data *clk_data; > + const char *parents[SUNXI_MAX_PARENTS]; > const char *clk_parent; > const char *clk_name; > void __iomem *reg; > + int npar =3D 0; > int qty; > int i =3D 0; > int j =3D 0; > =20 > reg =3D of_iomap(node, 0); > =20 > - clk_parent =3D of_clk_get_parent_name(node, 0); > + while (npar < SUNXI_MAX_PARENTS && > + (parents[npar] =3D of_clk_get_parent_name(node, npar)) !=3D NULL) > + npar++; > + clk_parent =3D parents[0]; > =20 > /* Worst-case size approximation and memory allocation */ > qty =3D find_last_bit(data->mask, SUNXI_GATES_MAX_SIZE); > @@ -1026,6 +1033,9 @@ static void __init sunxi_gates_clk_setup(struct dev= ice_node *node, > of_property_read_string_index(node, "clock-output-names", > j, &clk_name); > =20 > + if (data->parents && !WARN_ON(data->parents[j] >=3D npar)) > + clk_parent =3D parents[data->parents[j]]; > + I'm currently removing that code, so I was more expecting a new standalone driver for that clock. Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com --wNT7VBaN1rUIB9jO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVWI6GAAoJEBx+YmzsjxAg1k8P/i62hodT09JHYyj9umDIYdE5 tleh3aCLNNX5Y6dnKhPAuINswVX20+7+bx/eBwDYr8AdrnI1iLZ8KWO3X/kE7Exk JC88u8v+mqC+6ucM2BfyLruhhm1cAmS+xuEjADBgZuJ+2aKw4BBdMmQwT28szZlv UvzrUhcwOpRPxxRKJQ+mWfBto7zxNGqr84Tdx01nlYwy7zu5pwmsBhHgWv9yC+s9 Kb4nvUhl1csExWU0UHVt/tFzAofmx82OWN+X5rEVABFNu9o7y8AGX6XvVh7mSmKG Rbcn3muRCHgDlEmUnSErKNbKF+lyM3KkuSGpYNZ+59NUdzPw2MypX1z9VaJ9ErOz jAaWIAXaM26UNAdjAaJTy7htc5CnQKUVL5FRKXtuP9JmpCsbgO3PgTK6KC6lUUdD SG2pA5cKstsF+nj/wbdSnJ+96KBvgp2DiTzTBPjzussaCyFcI4JcKwr9XQbKQUs+ mlg3rRrIKQrVEk37EfqnIMOcxgU0wiESd1kkWFh+nTd+D0R1yvB6JE5Edkut2P2F rqujrYX816MgslD/p0aanEfJcmzyKUqLK2Djitmf7sU/ZGtasKOYo3jDcRH24IJS OZjd4KiGfBJ5v3bah/b6G0uDiyVI51oID2ZofZfNYbFFqX8IF5renH4rCg0+oa6B TnS/yykB/KG1mC/ddNOK =so8Q -----END PGP SIGNATURE----- --wNT7VBaN1rUIB9jO-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/