From patchwork Thu Mar 7 19:00:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2233441 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 67BAC3FCF6 for ; Thu, 7 Mar 2013 19:00:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932743Ab3CGTAv (ORCPT ); Thu, 7 Mar 2013 14:00:51 -0500 Received: from moutng.kundenserver.de ([212.227.126.171]:56511 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932414Ab3CGTAu (ORCPT ); Thu, 7 Mar 2013 14:00:50 -0500 Received: from axis700.grange (dslb-178-001-151-034.pools.arcor-ip.net [178.1.151.34]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0Lzq1j-1Urs8p3iM7-014jFS; Thu, 07 Mar 2013 20:00:49 +0100 Received: by axis700.grange (Postfix, from userid 1000) id 9930040BB4; Thu, 7 Mar 2013 20:00:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 972BC40BB3; Thu, 7 Mar 2013 20:00:48 +0100 (CET) Date: Thu, 7 Mar 2013 20:00:48 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: Magnus Damm cc: Simon Horman , Linux-SH Subject: [PATCH/RFC 3/3] ARM: shmobile: sh73a0: add a TWD clock In-Reply-To: Message-ID: References: <20130301110802.GB24364@verge.net.au> <20130301122805.GD24364@verge.net.au> <20130304130035.GA31626@verge.net.au> MIME-Version: 1.0 X-Provags-ID: V02:K0:CE+1w6yWF+Poy2K3D51G++JdiGBHym8VgoaUsTE6t6E nojXr3b+o7eyFkFXX+Bwc0+X2T9F3mzbDMWMcwHMh9ExKTUvxH lfa2PiH5wBvTDDVwSozunevAOiLVhWMkakgehxp4OyocDAPpOS NY4YpbMdRLbJrmSxS3vJF72FihPxEYMXIRw8/gUrZLZye6cfJZ uNIZgm0IA6QuHhFe23OJqoimHU59lp1MQBZ8g7h5/IXzqu2g/N jgSyMvbxMxJ+4qFKH6liiFNRBZHJLZ2yz6DVhzPnmU57LPjQqA jV6algdwfZg/tFJkTuL4Qo8tqCU/e9Rn8RDmFW9g/CGqDt4UFd JuTEdfgj/rTGwb2356C7ufKW37jIYYedadjl1V3H+37qcoQH7z qTgWTNunY1I3g== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Add a TWD clock on sh73a0 for the smp_twd driver to properly update the clock's frequency upon cpufreq events. Signed-off-by: Guennadi Liakhovetski --- arch/arm/mach-shmobile/clock-sh73a0.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index 71843dd..e8a6ba7 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c @@ -277,6 +277,20 @@ static struct clk div4_clks[DIV4_NR] = { [DIV4_HP] = DIV4(FRQCRB, 4, 0xdff, 0), }; +static unsigned long twd_recalc(struct clk *clk) +{ + return clk_get_rate(clk->parent) / 4; +} + +static struct sh_clk_ops twd_clk_ops = { + .recalc = twd_recalc, +}; + +static struct clk twd_clk = { + .parent = &div4_clks[DIV4_Z], + .ops = &twd_clk_ops, +}; + enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_ZB1, DIV6_FLCTL, DIV6_SDHI0, DIV6_SDHI1, DIV6_SDHI2, DIV6_FSIA, DIV6_FSIB, DIV6_SUB, @@ -471,6 +485,7 @@ static struct clk dsi1phy_clk = { static struct clk *late_main_clks[] = { &dsi0phy_clk, &dsi1phy_clk, + &twd_clk, }; enum { MSTP001, @@ -535,6 +550,7 @@ static struct clk mstp_clks[MSTP_NR] = { static struct clk_lookup lookups[] = { /* main clocks */ CLKDEV_CON_ID("r_clk", &r_clk), + CLKDEV_DEV_ID("smp_twd", &twd_clk), /* smp_twd */ /* DIV6 clocks */ CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]),