From patchwork Fri Feb 19 07:27:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 80560 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 o1J806mi001778 for ; Fri, 19 Feb 2010 08:00:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752270Ab0BSH76 (ORCPT ); Fri, 19 Feb 2010 02:59:58 -0500 Received: from mail.renesas.com ([202.234.163.13]:59730 "EHLO mail02.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753925Ab0BSH75 (ORCPT ); Fri, 19 Feb 2010 02:59:57 -0500 X-AuditID: ac140385-00000007000002de-ae-4b7e44fb2537 Received: from guardian01.idc.renesas.com ([172.20.8.200]) by mail02.idc.renesas.com (sendmail) with ESMTP id o1J7xt27023678; Fri, 19 Feb 2010 16:59:55 +0900 (JST) Received: (from root@localhost) by guardian01.idc.renesas.com with id o1J7xuKX021711; Fri, 19 Feb 2010 16:59:56 +0900 (JST) Received: from mta02.idc.renesas.com (localhost [127.0.0.1]) by mta02.idc.renesas.com with ESMTP id o1J7xvJg017026; Fri, 19 Feb 2010 16:59:57 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KY20005OWVWO1@ims05.idc.renesas.com>; Fri, 19 Feb 2010 16:59:56 +0900 (JST) Date: Fri, 19 Feb 2010 16:27:01 +0900 From: Kuninori Morimoto Subject: [PATCH] sh: sh7724: Add workaround for FSI sound To: linux-sh@vger.kernel.org Cc: lethal@linux-sh.org, Jeremy Baker Message-id: MIME-version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-type: text/plain; charset=US-ASCII User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.7 Emacs/22.3 (i386-msvc-nt5.1.2600) MULE/5.0 (SAKAKI) Meadow/3.02-dev (RINDOU) (2009-06-17 Rev.4261) 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, 19 Feb 2010 08:00:07 +0000 (UTC) diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 5c24628..4caa8a0 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -690,6 +690,34 @@ static struct platform_device camera_devices[] = { }, }; +/* + * SPU2 + * + * used to clock core of FSI, + * set close to 12.288MHz, + * see + * Table 45.9 point 4 of 7724 manual (English ver) + * Table 45.11 point 4 of 7724 manual (Japanese ver) + */ +#define SPUCLKCR 0xA415003C +static void spuclkcr_init(struct clk *clk) +{ + /* 333 MHz / (27 + 1) = 11.9 MHz */ + ctrl_outl(0x000001B, clk->enable_reg); +} + +static struct clk_ops spuclkcr_clk_ops = { + .init = spuclkcr_init, +}; + +static struct clk spuclkcr_clk = { + .name = "spuclkcr_clk", + .id = -1, + .ops = &spuclkcr_clk_ops, + .enable_reg = (void __iomem *)SPUCLKCR, + .rate = 11904761, /* 11.9 MHz */ +}; + /* FSI */ /* * FSI-B use external clock which came from da7210. @@ -1107,6 +1135,12 @@ static int __init arch_setup(void) gpio_request(GPIO_FN_FSIOBLRCK, NULL); gpio_request(GPIO_FN_CLKAUDIOBO, NULL); + /* change parent of SPU2 */ + clk = clk_get(NULL, "spu_clk"); + clk_register(&spuclkcr_clk); + clk_set_parent(clk, &spuclkcr_clk); + clk_put(clk); + /* change parent of FSI B */ clk = clk_get(NULL, "fsib_clk"); clk_register(&fsimckb_clk); diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index 858ecb2..08cc731 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c @@ -257,6 +257,34 @@ static struct platform_device ceu1_device = { }, }; +/* + * SPU2 + * + * used to clock core of FSI, + * set close to 12.288MHz, + * see + * Table 45.9 point 4 of 7724 manual (English ver) + * Table 45.11 point 4 of 7724 manual (Japanese ver) + */ +#define SPUCLKCR 0xA415003C +static void spuclkcr_init(struct clk *clk) +{ + /* 333 MHz / (27 + 1) = 11.9 MHz */ + ctrl_outl(0x000001B, clk->enable_reg); +} + +static struct clk_ops spuclkcr_clk_ops = { + .init = spuclkcr_init, +}; + +static struct clk spuclkcr_clk = { + .name = "spuclkcr_clk", + .id = -1, + .ops = &spuclkcr_clk_ops, + .enable_reg = (void __iomem *)SPUCLKCR, + .rate = 11904761, /* 11.9 MHz */ +}; + /* FSI */ /* * FSI-A use external clock which came from ak464x. @@ -595,7 +623,7 @@ arch_initcall(arch_setup); static int __init devices_setup(void) { u16 sw = ctrl_inw(SW4140); /* select camera, monitor */ - struct clk *fsia_clk; + struct clk *clk; /* register board specific self-refresh code */ sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF, @@ -764,13 +792,19 @@ static int __init devices_setup(void) gpio_request(GPIO_FN_CLKAUDIOBO, NULL); gpio_request(GPIO_FN_FSIIASD, NULL); + /* change parent of SPU2 */ + clk = clk_get(NULL, "spu_clk"); + clk_register(&spuclkcr_clk); + clk_set_parent(clk, &spuclkcr_clk); + clk_put(clk); + /* change parent of FSI A */ - fsia_clk = clk_get(NULL, "fsia_clk"); + clk = clk_get(NULL, "fsia_clk"); clk_register(&fsimcka_clk); - clk_set_parent(fsia_clk, &fsimcka_clk); - clk_set_rate(fsia_clk, 11000); + clk_set_parent(clk, &fsimcka_clk); + clk_set_rate(clk, 11000); clk_set_rate(&fsimcka_clk, 11000); - clk_put(fsia_clk); + clk_put(clk); /* SDHI0 connected to cn7 */ gpio_request(GPIO_FN_SDHI0CD, NULL);