From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751929AbcELBpy (ORCPT ); Wed, 11 May 2016 21:45:54 -0400 Received: from anholt.net ([50.246.234.109]:39842 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751605AbcELBpx (ORCPT ); Wed, 11 May 2016 21:45:53 -0400 From: Eric Anholt To: Stephen Boyd Cc: Michael Turquette , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stephen Warren , Lee Jones Subject: Re: [PATCH 3/3] clk: bcm2835: Skip PLLC clocks when deciding on a new clock parent In-Reply-To: <20160511225854.GI3492@codeaurora.org> References: <1462842090-2017-1-git-send-email-eric@anholt.net> <1462842090-2017-4-git-send-email-eric@anholt.net> <20160511225854.GI3492@codeaurora.org> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Wed, 11 May 2016 18:45:48 -0700 Message-ID: <87mvnw82wj.fsf@eliezer.anholt.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Stephen Boyd writes: > On 05/09, Eric Anholt wrote: >> If the firmware had set up a clock to source from PLLC, go along with >> it. But if we're looking for a new parent, we don't want to switch it >> to PLLC because the firmware will force PLLC (and thus the AXI bus >> clock) to different frequencies during over-temp/under-voltage, >> without notification to Linux. >>=20 >> On my system, this moves the Linux-enabled HDMI state machine and DSI1 >> escape clock over to plld_per from pllc_per. EMMC still ends up on >> pllc_per, because the firmware had set it up to use that. > > Is it ok for EMMC rate to change with over-temp/under-voltage? > The description makes it sound like PLLC is for clks that want to > run at some system bus rate and they don't care about exact > frequencies. I'm surprised it's OK for it to change, but the firmware is very intentionally putting it on PLLC (there's this #define for where most peripherals go, and EMMC doesn't use it and goes for PLLC instead). If we do decide we want to override the firmware, I suspect we'll use assigned-clock-parents for that. >> Signed-off-by: Eric Anholt >> Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the audi= o domain clocks") >> diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835= .c >> index 1091012ecec6..1d8f29ea9f69 100644 >> --- a/drivers/clk/bcm/clk-bcm2835.c >> +++ b/drivers/clk/bcm/clk-bcm2835.c >> @@ -1008,16 +1008,28 @@ static int bcm2835_clock_set_rate(struct clk_hw = *hw, >> return 0; >> } >>=20=20 >> +static bool >> +bcm2835_clk_is_pllc(struct clk_hw *hw) >> +{ >> + if (!hw) >> + return false; >> + >> + return strncmp(clk_hw_get_name(hw), "pllc", 4) =3D=3D 0; > > This strcmp is not great. Any chance we could look for the parent > by reading the hardware and knowing what bit corresponds to pllc > as a parent? That would be much nicer so that we don't rely on > string comparisons for something the hardware can tell us. We just have the parent index, but which indices are pllc dividers is different between bcm2835_clock_per_parents and bcm2835_clock_vpu_parents. So, I guess it's possible, but seems more error-prone than the strncmp. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJXM+BMAAoJELXWKTbR/J7o6oMP/j65nkzZC0gZW9nAouP7KO19 JUbBKuwF8OQECRFgK+/z8SUiYjKmyN3u1SDaNA/WrxPYYaTDuYmyYEzFleJSOV2g PuuPqJuPKFXl8xss/11ULk4wXxYDJILgySdTvtzo5khZm5Q2CxrVKuwGivNi/ch1 Mr6v1ZE80bw+lHcpU/M+AtNoIEJkPCyi/JhDRpy5/ZZ41xvwGbTLjLwMRMP7wauJ PhmrVJR0z/h98Y+L0301906vknvWkmbu4nuoHzaXsUIo7A0e/lU4PyaNosVW336P ZdAbrh5n+VylHUgG/8C9yWME/qg1gZak6m4lWMmOfik60tHmux0pcZDSm5KTfoYU ZU5VgtPXfbgG3pj0f/O45wtz5fctekuAGlEmo8+9eq6NeV/fS/0CIMw4oMrTl3wT fbGnN0FV28MZp+y3nO3kfsh2iP3H6XR+OldG4r/LGO3/evROJedEfLC42Sq9xsCn 2K+AQZId89RTBnoE1cIio22OUitMApfY8jpIGjII/BNEud6YOrbjgI+PeQzTeTdH iil98IsdBA3VUbgJ1c3CadRBGSOuYWNOb//r4sMf/tdngclwVjmF6KXclrhcYUgD lVae0gzgTRkhxKvM8p0hnGwc/kNYCZ+F70ZRYQhx45z6V8Ubjfym/aBW4kA9Yfsl bmMsfHvXmYd3DPPSBA9D =+goB -----END PGP SIGNATURE----- --=-=-=--