From patchwork Tue May 31 17:09:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 833392 Received: from canuck.infradead.org (canuck.infradead.org [134.117.69.58]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4VJfUsx004734 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 31 May 2011 19:42:01 GMT Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QRUaU-0003dY-3m; Tue, 31 May 2011 19:26:46 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRUaQ-0003cN-Tu for linux-arm-kernel@canuck.infradead.org; Tue, 31 May 2011 19:26:43 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by casper.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRSUn-0004Mq-FF for linux-arm-kernel@lists.infradead.org; Tue, 31 May 2011 17:12:50 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id p4VHBvWq025327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 May 2011 12:11:59 -0500 Received: from dbde70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p4VHBojL013829; Tue, 31 May 2011 22:41:51 +0530 (IST) Received: from dbde02.ent.ti.com ([172.24.170.145]) by dbde70.ent.ti.com ([172.24.170.148]) with mapi; Tue, 31 May 2011 22:41:50 +0530 From: "Nori, Sekhar" To: Jean-Christophe PLAGNIOL-VILLARD , "linux-arm-kernel@lists.infradead.org" Date: Tue, 31 May 2011 22:39:48 +0530 Subject: RE: [RFC PATCH v4] Consolidate SRAM support Thread-Topic: [RFC PATCH v4] Consolidate SRAM support Thread-Index: AcwbQl/B7Ihf/bzQS8Ob+Hq24DOr5QEbkkqg Message-ID: References: <20110512174546.GB8633@n2100.arm.linux.org.uk> <1306371777-20431-1-git-send-email-plagnioj@jcrosoft.com> In-Reply-To: <1306371777-20431-1-git-send-email-plagnioj@jcrosoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110531_181245_807217_00F15D6F X-CRM114-Status: GOOD ( 27.43 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2-r929478 on casper.infradead.org summary: Content analysis details: (-4.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.94.94.40 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: "Hilman, Kevin" , "davinci-linux-open-source@linux.davincidsp.com" , Russell King - ARM Linux , Tony Lindgren , Sascha Hauer , Russell King , "linux-omap@vger.kernel.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 31 May 2011 19:42:02 +0000 (UTC) Hi Jean-Christophe, On Thu, May 26, 2011 at 06:32:57, Jean-Christophe PLAGNIOL-VILLARD wrote: > From: Russell King - ARM Linux > > We have two SoCs using SRAM, both with their own allocation systems, > and both with their own ways of copying functions into the SRAM. > > Let's unify this before we have additional SoCs re-implementing this > obviously common functionality themselves. > > For this use the generic allocator and the newly introduce > gen_pool_add_virt and gen_pool_virt_to_phys > > Uio_pruss should probably take the SRAM pool pointer via > platform data so that it doesn't have to include Davinci specific > includes. > > Signed-off-by: Russell King > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD > Cc: Sekhar Nori > Cc: Kevin Hilman > Cc: Tony Lindgren > Cc: Sascha Hauer I tested this on DA850 using suspend-to-RAM and audio, it works well! > arch/arm/Kconfig | 2 + > arch/arm/mach-davinci/da850.c | 2 +- > arch/arm/mach-davinci/dm355.c | 2 +- > arch/arm/mach-davinci/dm365.c | 2 +- > arch/arm/mach-davinci/dm644x.c | 2 +- > arch/arm/mach-davinci/dm646x.c | 2 +- > arch/arm/mach-davinci/include/mach/common.h | 2 +- > arch/arm/mach-davinci/include/mach/sram.h | 13 +---- > arch/arm/mach-davinci/pm.c | 21 +++---- > arch/arm/mach-davinci/sram.c | 57 +++++-------------- > arch/arm/plat-mxc/include/mach/iram.h | 28 ++++++++-- > .../plat-mxc/{include/mach/iram.h => iram_alloc.c} | 40 ++++++++------ I had trouble applying the plat-mxc stuff on v3.0-rc1. Can you please check? I also found some check patch errors. Feel free to merge the attached patch. With these, please add my: Acked-by: Sekhar Nori Thanks, Sekhar ----8<------- diff --git a/arch/arm/plat-mxc/include/mach/iram.h b/arch/arm/plat-mxc/include/mach/iram.h index 8279c47..aae5e35 100644 --- a/arch/arm/plat-mxc/include/mach/iram.h +++ b/arch/arm/plat-mxc/include/mach/iram.h @@ -31,7 +31,7 @@ static inline void *iram_alloc(size_t size, phys_addr_t *phys) *phys = gen_pool_virt_to_phys(iram_pool, addr); - return (void*)addr; + return (void *) addr; } static inline void iram_free(void *addr, size_t size) diff --git a/arch/arm/plat-omap/include/plat/sram.h b/arch/arm/plat-omap/include/plat/sram.h index 52b9b5c..cc99397 100644 --- a/arch/arm/plat-omap/include/plat/sram.h +++ b/arch/arm/plat-omap/include/plat/sram.h @@ -27,7 +27,7 @@ extern struct gen_pool *omap_gen_pool; size_t _sz = size; \ void *_sram = gen_pool_alloc(omap_gen_pool, _sz); \ _res = (_sram ? fncpy(_sram, &(funcp), _sz) : NULL); \ - if (!_res) \ + if (!_res) \ pr_err("Not enough space in SRAM\n"); \ _res; \ }) diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c index db486cc..444176e 100644 --- a/drivers/uio/uio_pruss.c +++ b/drivers/uio/uio_pruss.c @@ -153,7 +153,7 @@ static int __devinit pruss_probe(struct platform_device *dev) goto out_free; } - gdev->sram_vaddr = (void*)gen_pool_alloc(davinci_gen_pool, sram_pool_sz); + gdev->sram_vaddr = (void *)gen_pool_alloc(davinci_gen_pool, sram_pool_sz); if (!gdev->sram_vaddr) { dev_err(&dev->dev, "Could not allocate SRAM pool\n"); goto out_free; diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index dd305a2..1c383ab 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c @@ -239,7 +239,7 @@ static int allocate_sram(struct snd_pcm_substream *substream, unsigned size, return 0; ppcm->period_bytes_max = size; - iram_virt = (void*)gen_pool_alloc(davinci_gen_pool, size); + iram_virt = (void *)gen_pool_alloc(davinci_gen_pool, size); if (!iram_virt) goto exit1; iram_phys = gen_pool_virt_to_phys(davinci_gen_pool,