From patchwork Thu May 28 12:52:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 26738 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4SCtgtq012825 for ; Thu, 28 May 2009 12:55:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754283AbZE1Mzi (ORCPT ); Thu, 28 May 2009 08:55:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754636AbZE1Mzi (ORCPT ); Thu, 28 May 2009 08:55:38 -0400 Received: from rv-out-0506.google.com ([209.85.198.224]:25694 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754283AbZE1Mzh (ORCPT ); Thu, 28 May 2009 08:55:37 -0400 Received: by rv-out-0506.google.com with SMTP id f9so1654951rvb.1 for ; Thu, 28 May 2009 05:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=kGviRuDIK4RstbWe+SqQOpmnm5YXlP3+xXDY3J6MX2U=; b=woEdbGXyjUUIHr9MlTyrow+okmzNJMkH8GVE/pZyOR5a+N0p7RHybRj38neCvU0qCN w87wwfXzKH+xXcmEYvgWmRp91flPMk8djyOZLStU0ntIYp56Gjvi8jOGPpp4/vn93xl3 SjzROKnkxPGB/RFjz1ey4ikCOjD734ZJJfrFU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=eLYPac7Ffg7cDaqEc3LHFIMWV4hdZX4UbRiiCs92eFp6TU1GHOTroiXCh4/wjrERdO kcZnqUQJvD5yeGQDyb2V6hyyaRwNO3gkM2FcxxmKutsjwc4wRufThzK8I9kL0vonggI2 wiC/HY29PM+ZpxWyO9fZRvahTfLi8qB+GX17Y= Received: by 10.140.255.19 with SMTP id c19mr753569rvi.30.1243515339848; Thu, 28 May 2009 05:55:39 -0700 (PDT) Received: from rx1.opensource.se (210.5.32.202.bf.2iij.net [202.32.5.210]) by mx.google.com with ESMTPS id g22sm28259582rvb.56.2009.05.28.05.55.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 28 May 2009 05:55:38 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Thu, 28 May 2009 21:52:29 +0900 Message-Id: <20090528125229.6462.23713.sendpatchset@rx1.opensource.se> Subject: [PATCH] sh: shared mstp32 clock code Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm Add shared 32-bit module stop bit clock support. Processor specific code can use SH_CLK_MSTP32() to initialize module stop bit clocks, and then use sh_clk_mstp32() for registration. Signed-off-by: Magnus Damm --- arch/sh/include/asm/clock.h | 13 +++++++++++++ arch/sh/kernel/cpu/clock-cpg.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/arch/sh/include/asm/clock.h +++ work/arch/sh/include/asm/clock.h 2009-05-28 16:56:09.000000000 +0900 @@ -117,4 +117,17 @@ long clk_rate_table_round(struct clk *cl struct cpufreq_frequency_table *freq_table, unsigned long rate); +#define SH_CLK_MSTP32(_name, _id, _parent, _enable_reg, \ + _enable_bit, _flags) \ +{ \ + .name = _name, \ + .id = _id, \ + .parent = _parent, \ + .enable_reg = (void __iomem *)_enable_reg, \ + .enable_bit = _enable_bit, \ + .flags = _flags, \ +} + +int sh_clk_mstp32_register(struct clk *clks, int nr); + #endif /* __ASM_SH_CLOCK_H */ --- 0001/arch/sh/kernel/cpu/clock-cpg.c +++ work/arch/sh/kernel/cpu/clock-cpg.c 2009-05-28 20:37:03.000000000 +0900 @@ -1,7 +1,42 @@ #include #include +#include #include +static int sh_clk_mstp32_enable(struct clk *clk) +{ + __raw_writel(__raw_readl(clk->enable_reg) & ~(1 << clk->enable_bit), + clk->enable_reg); + return 0; +} + +static void sh_clk_mstp32_disable(struct clk *clk) +{ + __raw_writel(__raw_readl(clk->enable_reg) | (1 << clk->enable_bit), + clk->enable_reg); +} + +static struct clk_ops sh_clk_mstp32_clk_ops = { + .enable = sh_clk_mstp32_enable, + .disable = sh_clk_mstp32_disable, + .recalc = followparent_recalc, +}; + +int __init sh_clk_mstp32_register(struct clk *clks, int nr) +{ + struct clk *clkp; + int ret = 0; + int k; + + for (k = 0; !ret && (k < nr); k++) { + clkp = clks + k; + clkp->ops = &sh_clk_mstp32_clk_ops; + ret = clk_register(clkp); + } + + return ret; +} + #ifdef CONFIG_SH_CLK_CPG_LEGACY static struct clk master_clk = { .name = "master_clk",