From patchwork Wed Feb 29 19:44:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 143813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id BAC83B6EE7 for ; Thu, 1 Mar 2012 06:45:18 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 80AED280CD; Wed, 29 Feb 2012 20:45:16 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L9u9N8lk9KQj; Wed, 29 Feb 2012 20:45:16 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B0407280C6; Wed, 29 Feb 2012 20:45:14 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 14784280C6 for ; Wed, 29 Feb 2012 20:45:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uEa-MTxkj6JH for ; Wed, 29 Feb 2012 20:45:12 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-gx0-f172.google.com (mail-gx0-f172.google.com [209.85.161.172]) by theia.denx.de (Postfix) with ESMTPS id 3264B280C2 for ; Wed, 29 Feb 2012 20:45:10 +0100 (CET) Received: by ggmi1 with SMTP id i1so366406ggm.3 for ; Wed, 29 Feb 2012 11:45:08 -0800 (PST) Received-SPF: pass (google.com: domain of festevam@gmail.com designates 10.236.173.195 as permitted sender) client-ip=10.236.173.195; Authentication-Results: mr.google.com; spf=pass (google.com: domain of festevam@gmail.com designates 10.236.173.195 as permitted sender) smtp.mail=festevam@gmail.com; dkim=pass header.i=festevam@gmail.com Received: from mr.google.com ([10.236.173.195]) by 10.236.173.195 with SMTP id v43mr2720454yhl.40.1330544708163 (num_hops = 1); Wed, 29 Feb 2012 11:45:08 -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=X65Hc1Y3v5QgCOUNG0XQ6mMYjYevXXDXlRZNDb49XCQ=; b=SJf5sramurCfF9vuRcMlnjIPMNwPMeEJgPQy6nlrK381VkTO2HjaBZ5poiL1UWxqUB 4+FBgQAU8+xYGIKCVWYD4RI1opmD92XtP8Dij9/M4CGJnxgE4NtnSH9F9crLlE2ANULD j8bxhs0ha3I3eQTsS4lzzqW+fnqFq3RiJIbI4= Received: by 10.236.173.195 with SMTP id v43mr2163736yhl.40.1330544707964; Wed, 29 Feb 2012 11:45:07 -0800 (PST) Received: from localhost.localdomain ([201.82.161.72]) by mx.google.com with ESMTPS id o41sm58357103yhj.7.2012.02.29.11.45.05 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 29 Feb 2012 11:45:07 -0800 (PST) From: Fabio Estevam To: u-boot@lists.denx.de Date: Wed, 29 Feb 2012 16:44:59 -0300 Message-Id: <1330544699-21814-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.7.1 Cc: Fabio Estevam Subject: [U-Boot] [PATCH v2] mx31: Setup AIPS registers X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Setup mx31 AIPS registers. It was verified on a mx31pdk that without the AIPS settings it is not possible to run audio playback. Signed-off-by: Fabio Estevam --- Changes since v1: - Use CONFIG_ARCH_CPU_INIT - Zero-out the 8 MSB of opacr4 - Confirmed that audio playback does work arch/arm/cpu/arm1136/mx31/generic.c | 46 +++++++++++++++++++++++++++++ arch/arm/include/asm/arch-mx31/imx-regs.h | 13 ++++++++ include/configs/mx31pdk.h | 1 + 3 files changed, 60 insertions(+), 0 deletions(-) diff --git a/arch/arm/cpu/arm1136/mx31/generic.c b/arch/arm/cpu/arm1136/mx31/generic.c index d60afc9..a401c9a 100644 --- a/arch/arm/cpu/arm1136/mx31/generic.c +++ b/arch/arm/cpu/arm1136/mx31/generic.c @@ -228,3 +228,49 @@ int print_cpuinfo(void) return 0; } #endif + +#ifdef CONFIG_ARCH_CPU_INIT +void init_aips(void) +{ + struct aipstz_regs *aips1, *aips2; + unsigned int reg; + + aips1 = (struct aipstz_regs *)MX31_AIPS1_BASE_ADDR; + aips2 = (struct aipstz_regs *)MX31_AIPS2_BASE_ADDR; + + /* + * Set all MPROTx to be non-bufferable, trusted for R/W, + * not forced to user-mode. + */ + writel(0x77777777, &aips1->mprot0); + writel(0x77777777, &aips1->mprot1); + writel(0x77777777, &aips2->mprot0); + writel(0x77777777, &aips2->mprot1); + + /* + * Set all OPACRx to be non-bufferable, not require + * supervisor privilege level for access, allow for + * write access and untrusted master access. + */ + writel(0x0, &aips1->opacr0); + writel(0x0, &aips1->opacr1); + writel(0x0, &aips1->opacr2); + writel(0x0, &aips1->opacr3); + reg = readl(&aips1->opacr4) & 0x00FFFFFF; + writel(reg, &aips1->opacr4); + + writel(0x0, &aips2->opacr0); + writel(0x0, &aips2->opacr1); + writel(0x0, &aips2->opacr2); + writel(0x0, &aips2->opacr3); + reg = readl(&aips2->opacr4) & 0x00FFFFFF; + writel(reg, &aips2->opacr4); +} + +int arch_cpu_init(void) +{ + init_aips(); + + return 0; +} +#endif diff --git a/arch/arm/include/asm/arch-mx31/imx-regs.h b/arch/arm/include/asm/arch-mx31/imx-regs.h index 6454acb..11069af 100644 --- a/arch/arm/include/asm/arch-mx31/imx-regs.h +++ b/arch/arm/include/asm/arch-mx31/imx-regs.h @@ -539,6 +539,18 @@ struct esdc_regs { u32 dlyl; }; +/* AIPS registers */ +struct aipstz_regs { + u32 mprot0; + u32 mprot1; + u32 rsvd[0xe]; + u32 opacr0; + u32 opacr1; + u32 opacr2; + u32 opacr3; + u32 opacr4; +}; + #endif #define __REG(x) (*((volatile u32 *)(x))) @@ -873,6 +885,7 @@ struct esdc_regs { #define IRAM_SIZE (16 * 1024) #define MX31_AIPS1_BASE_ADDR 0x43f00000 +#define MX31_AIPS2_BASE_ADDR 0x53f00000 #define IMX_USB_BASE (MX31_AIPS1_BASE_ADDR + 0x88000) /* USB portsc */ diff --git a/include/configs/mx31pdk.h b/include/configs/mx31pdk.h index 4da6020..623b1f7 100644 --- a/include/configs/mx31pdk.h +++ b/include/configs/mx31pdk.h @@ -40,6 +40,7 @@ #define CONFIG_DISPLAY_CPUINFO #define CONFIG_DISPLAY_BOARDINFO +#define CONFIG_ARCH_CPU_INIT #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ #define CONFIG_SETUP_MEMORY_TAGS