From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Lezcano Subject: Re: [PATCH v4 7/8] clocksource: kona: Add basic use of external clock Date: Mon, 16 Dec 2013 11:34:38 +0100 Message-ID: <52AED73E.5090507@linaro.org> References: <1386271244-3927-1-git-send-email-tim.kryger@linaro.org> <1386271244-3927-8-git-send-email-tim.kryger@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail-wi0-f179.google.com ([209.85.212.179]:53384 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753145Ab3LPKel (ORCPT ); Mon, 16 Dec 2013 05:34:41 -0500 Received: by mail-wi0-f179.google.com with SMTP id z2so1893702wiv.0 for ; Mon, 16 Dec 2013 02:34:39 -0800 (PST) In-Reply-To: <1386271244-3927-8-git-send-email-tim.kryger@linaro.org> Sender: linux-mmc-owner@vger.kernel.org List-Id: linux-mmc@vger.kernel.org To: Tim Kryger , Christian Daudt , Rob Herring , Pawel Moll , Mark Rutland , Stephen Warren , Ian Campbell , Thomas Gleixner , Chris Ball , Axel Lin Cc: Device Tree List , Linux ARM Kernel List , Linux Kernel Mailing List , Linux MMC List , Linaro Patches List On 12/05/2013 08:20 PM, Tim Kryger wrote: > When an clock is specified in the device tree, enable it and use it t= o > determine the external clock frequency. > > Signed-off-by: Tim Kryger > Reviewed-by: Markus Mayer > Reviewed-by: Matt Porter Acked-by: Daniel Lezcano > --- > drivers/clocksource/bcm_kona_timer.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksour= ce/bcm_kona_timer.c > index 0d7d8c3..8a4ab36 100644 > --- a/drivers/clocksource/bcm_kona_timer.c > +++ b/drivers/clocksource/bcm_kona_timer.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -107,11 +108,18 @@ static const struct of_device_id bcm_timer_ids[= ] __initconst =3D { > static void __init kona_timers_init(struct device_node *node) > { > u32 freq; > + struct clk *external_clk; > > - if (!of_property_read_u32(node, "clock-frequency", &freq)) > + external_clk =3D of_clk_get_by_name(node, NULL); > + > + if (!IS_ERR(external_clk)) { > + arch_timer_rate =3D clk_get_rate(external_clk); > + clk_prepare_enable(external_clk); > + } else if (!of_property_read_u32(node, "clock-frequency", &freq)) { > arch_timer_rate =3D freq; > - else > - panic("clock-frequency not set in the .dts file"); > + } else { > + panic("unable to determine clock-frequency"); > + } > > /* Setup IRQ numbers */ > timers.tmr_irq =3D irq_of_parse_and_map(node, 0); > --=20 Linaro.org =E2=94=82 Open source software fo= r ARM SoCs =46ollow Linaro: Facebook | Twitter | Blog