From patchwork Fri May 7 09:20:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 97658 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o479LEYn012256 for ; Fri, 7 May 2010 09:21:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753427Ab0EGJUo (ORCPT ); Fri, 7 May 2010 05:20:44 -0400 Received: from mail.renesas.com ([202.234.163.13]:43457 "EHLO mail03.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750766Ab0EGJUn (ORCPT ); Fri, 7 May 2010 05:20:43 -0400 X-AuditID: ac140386-0000000500003037-ea-4be3db6911e6 Received: from guardian02.idc.renesas.com ([172.20.8.201]) by mail03.idc.renesas.com (sendmail) with ESMTP id o479KfAq005103; Fri, 7 May 2010 18:20:41 +0900 (JST) Received: (from root@localhost) by guardian02.idc.renesas.com with id o479KfBY007808; Fri, 7 May 2010 18:20:41 +0900 (JST) Received: from mta05.idc.renesas.com (localhost [127.0.0.1]) by mta05.idc.renesas.com with ESMTP id o479KftQ004968; Fri, 7 May 2010 18:20:41 +0900 (JST) Received: from [172.30.8.157] by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0L2100913LYHNK@ims05.idc.renesas.com>; Fri, 07 May 2010 18:20:41 +0900 (JST) Date: Fri, 07 May 2010 18:20:40 +0900 From: Yoshihiro Shimoda Subject: [PATCH] sh: fix clock framework on SH7757 To: Paul Mundt Cc: SH-Linux Message-id: <4BE3DB68.1040503@renesas.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) X-Brightmail-Tracker: AAAAAA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 07 May 2010 09:21:29 +0000 (UTC) diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c index 86aae60..b24dae6 100644 --- a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c +++ b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c @@ -3,7 +3,7 @@ * * SH7757 support for the clock framework * - * Copyright (C) 2009 Renesas Solutions Corp. + * Copyright (C) 2009-2010 Renesas Solutions Corp. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive @@ -15,38 +15,28 @@ #include #include -static int ifc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1, - 16, 1, 1, 32, 1, 1, 1, 1 }; -static int sfc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1, - 16, 1, 1, 32, 1, 1, 1, 1 }; -static int bfc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1, - 16, 1, 1, 32, 1, 1, 1, 1 }; -static int p1fc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1, - 16, 1, 1, 32, 1, 1, 1, 1 }; - static void master_clk_init(struct clk *clk) { - clk->rate = CONFIG_SH_PCLK_FREQ * 16; + clk->rate = CONFIG_SH_PCLK_FREQ * 12; } static struct clk_ops sh7757_master_clk_ops = { .init = master_clk_init, }; -static void module_clk_recalc(struct clk *clk) +static unsigned long module_clk_recalc(struct clk *clk) { - int idx = __raw_readl(FRQCR) & 0x0000000f; - clk->rate = clk->parent->rate / p1fc_divisors[idx]; + return clk->parent->rate / 12; } static struct clk_ops sh7757_module_clk_ops = { .recalc = module_clk_recalc, }; -static void bus_clk_recalc(struct clk *clk) +static unsigned long bus_clk_recalc(struct clk *clk) { - int idx = (__raw_readl(FRQCR) >> 8) & 0x0000000f; - clk->rate = clk->parent->rate / bfc_divisors[idx]; + /* Bus clock = P clock */ + return clk->parent->rate / 12; } static struct clk_ops sh7757_bus_clk_ops = { @@ -55,8 +45,7 @@ static struct clk_ops sh7757_bus_clk_ops = { static void cpu_clk_recalc(struct clk *clk) { - int idx = (__raw_readl(FRQCR) >> 20) & 0x0000000f; - clk->rate = clk->parent->rate / ifc_divisors[idx]; + return clk->parent->rate; } static struct clk_ops sh7757_cpu_clk_ops = { @@ -78,8 +67,7 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx) static void shyway_clk_recalc(struct clk *clk) { - int idx = (__raw_readl(FRQCR) >> 12) & 0x0000000f; - clk->rate = clk->parent->rate / sfc_divisors[idx]; + return clk->parent->rate / 3; } static struct clk_ops sh7757_shyway_clk_ops = {