From patchwork Wed Feb 29 13:28:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 143723 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7CC99B6ED0 for ; Thu, 1 Mar 2012 00:30:38 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1S2jZu-0004Ol-UH; Wed, 29 Feb 2012 13:28:23 +0000 Received: from mail-gy0-f177.google.com ([209.85.160.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1S2jZq-0004OE-HO for linux-arm-kernel@lists.infradead.org; Wed, 29 Feb 2012 13:28:19 +0000 Received: by ghbf11 with SMTP id f11so1440899ghb.36 for ; Wed, 29 Feb 2012 05:28:16 -0800 (PST) Received-SPF: pass (google.com: domain of festevam@gmail.com designates 10.236.115.105 as permitted sender) client-ip=10.236.115.105; Authentication-Results: mr.google.com; spf=pass (google.com: domain of festevam@gmail.com designates 10.236.115.105 as permitted sender) smtp.mail=festevam@gmail.com; dkim=pass header.i=festevam@gmail.com Received: from mr.google.com ([10.236.115.105]) by 10.236.115.105 with SMTP id d69mr358757yhh.89.1330522096785 (num_hops = 1); Wed, 29 Feb 2012 05:28:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=DxmTRa0rxZLkctyhV33w48zpE6WNKRl6oBuIQbI8FMc=; b=WYo4tvFal2kGfuOHQAgseda7lFzCXs6IH2THKbG7NkiGBQ5Y44znWq91coAXxe36Uu CokshMbYNUyJ++jUI9OmCT7fQxzDnSwe+D/NjzNfPRvaP1gN6xsPLhjIsFAPUIYg+jUI GOIJxDrkzLnA8TGYf2qxEzcQ9nrQJ5eX9BGr8= Received: by 10.236.115.105 with SMTP id d69mr281381yhh.89.1330522096734; Wed, 29 Feb 2012 05:28:16 -0800 (PST) Received: from localhost.localdomain ([201.82.161.72]) by mx.google.com with ESMTPS id n10sm34360817ani.8.2012.02.29.05.28.14 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 29 Feb 2012 05:28:15 -0800 (PST) From: Fabio Estevam To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3] ARM: mx3: Setup AIPS registers Date: Wed, 29 Feb 2012 10:28:08 -0300 Message-Id: <1330522088-20357-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.7.1 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (festevam[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Fabio Estevam , kernel@pengutronix.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org It was observed on a mx31pdk board that audio playback only worked when the bootloader was Redboot, and did not work when U-boot was used. Comparing the sources of these bootloaders showed that the AIPS registers were not setup in U-boot. Instead of relying on the bootloader to setup the AIPS registers, do it in the kernel so that audio playback can work independantly of the bootloader being used. Copied the AIPS settings from Redboot to the kernel. Signed-off-by: Fabio Estevam --- Changes since v2: - Place mx_set_aips inside imx31_soc_init Changes since v1: - Make sure post_cpu_init() only runs on mx31 - Place imx_set_aips() in a common location so that other SoCs can use it. - Improve comments about OPACRx arch/arm/mach-imx/mm-imx3.c | 3 +++ arch/arm/plat-mxc/cpu.c | 24 ++++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/common.h | 1 + 3 files changed, 28 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c index 6222151..77cf553 100644 --- a/arch/arm/mach-imx/mm-imx3.c +++ b/arch/arm/mach-imx/mm-imx3.c @@ -173,6 +173,9 @@ void __init imx31_soc_init(void) } imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata); + + imx_set_aips(MX31_IO_ADDRESS(MX31_AIPS1_BASE_ADDR)); + imx_set_aips(MX31_IO_ADDRESS(MX31_AIPS2_BASE_ADDR)); } #endif /* ifdef CONFIG_SOC_IMX31 */ diff --git a/arch/arm/plat-mxc/cpu.c b/arch/arm/plat-mxc/cpu.c index f5b7e0f..220dd6f 100644 --- a/arch/arm/plat-mxc/cpu.c +++ b/arch/arm/plat-mxc/cpu.c @@ -1,5 +1,6 @@ #include +#include #include unsigned int __mxc_cpu_type; @@ -18,3 +19,26 @@ void imx_print_silicon_rev(const char *cpu, int srev) pr_info("CPU identified as %s, silicon rev %d.%d\n", cpu, (srev >> 4) & 0xf, srev & 0xf); } + +void __init imx_set_aips(void __iomem *base) +{ + unsigned int reg; +/* + * Set all MPROTx to be non-bufferable, trusted for R/W, + * not forced to user-mode. + */ + __raw_writel(0x77777777, base + 0x0); + __raw_writel(0x77777777, base + 0x4); + +/* + * Set all OPACRx to be non-bufferable, to not require + * supervisor privilege level for access, allow for + * write access and untrusted master access. + */ + __raw_writel(0x0, base + 0x40); + __raw_writel(0x0, base + 0x44); + __raw_writel(0x0, base + 0x48); + __raw_writel(0x0, base + 0x4C); + reg = __raw_readl(base + 0x50) & 0x00FFFFFF; + __raw_writel(reg, base + 0x50); +} diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h index 1bf0df8..16c3864 100644 --- a/arch/arm/plat-mxc/include/mach/common.h +++ b/arch/arm/plat-mxc/include/mach/common.h @@ -75,6 +75,7 @@ extern void mxc_restart(char, const char *); extern void mxc_arch_reset_init(void __iomem *); extern int mx53_revision(void); extern int mx53_display_revision(void); +extern void imx_set_aips(void __iomem *); enum mxc_cpu_pwr_mode { WAIT_CLOCKED, /* wfi only */