From patchwork Tue Aug 5 09:20:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 376633 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2736C1400E4 for ; Tue, 5 Aug 2014 19:19:02 +1000 (EST) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id 081AE1A087E for ; Tue, 5 Aug 2014 19:19:02 +1000 (EST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1blp0188.outbound.protection.outlook.com [207.46.163.188]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 127B31A01B9 for ; Tue, 5 Aug 2014 19:18:18 +1000 (EST) Received: from BY2PR03CA041.namprd03.prod.outlook.com (10.141.249.14) by BLUPR03MB358.namprd03.prod.outlook.com (10.141.75.152) with Microsoft SMTP Server (TLS) id 15.0.995.14; Tue, 5 Aug 2014 09:18:07 +0000 Received: from BL2FFO11FD030.protection.gbl (2a01:111:f400:7c09::141) by BY2PR03CA041.outlook.office365.com (2a01:111:e400:2c5d::14) with Microsoft SMTP Server (TLS) id 15.0.1005.10 via Frontend Transport; Tue, 5 Aug 2014 09:17:54 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD030.mail.protection.outlook.com (10.173.161.40) with Microsoft SMTP Server (TLS) id 15.0.990.10 via Frontend Transport; Tue, 5 Aug 2014 09:17:54 +0000 Received: from rio.ap.freescale.net (rio.ap.freescale.net [10.192.242.9]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s759Hn4n027866; Tue, 5 Aug 2014 02:17:50 -0700 From: Nicolin Chen To: Subject: [PATCH] ASoC: fsl_sai: Initialize with software reset Date: Tue, 5 Aug 2014 17:20:21 +0800 Message-ID: <1407230421-20953-1-git-send-email-nicoleotsuka@gmail.com> X-Mailer: git-send-email 1.8.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 130517038745717825; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009002)(6009001)(199002)(189002)(48376002)(50466002)(31966008)(92566001)(20776003)(92726001)(99396002)(36756003)(79102001)(21056001)(84676001)(74662001)(74502001)(64706001)(61266001)(69596002)(68736004)(83072002)(47776003)(87936001)(87286001)(81542001)(81342001)(81442001)(85852003)(82202001)(50226001)(4396001)(88136002)(77156001)(89996001)(85306004)(46102001)(55446002)(80022001)(73392001)(77982001)(86362001)(33646002)(93916002)(50986999)(107046002)(102836001)(229853001)(2351001)(104166001)(110136001)(62966002)(104016003)(105596002)(97736001)(81156004)(106466001)(26826002)(6806004)(95666004)(73972005)(19580395003)(19580405001)(87572001)(44976005); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB358; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 02945962BD Received-SPF: SoftFail (protection.outlook.com: domain of transitioning gmail.com discourages use of 192.88.158.2 as permitted sender) Authentication-Results: spf=softfail (sender IP is 192.88.158.2) smtp.mailfrom=nicoleotsuka@gmail.com; Cc: alsa-devel@alsa-project.org, Li.Xiubo@freescale.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, timur@tabi.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This patch adds software reset code in dai_probe() so as to make a true init by clearing SAI's internal logic, including the bit clock generation, status flags, and FIFO pointers. Signed-off-by: Nicolin Chen --- sound/soc/fsl/fsl_sai.c | 9 +++++++-- sound/soc/fsl/fsl_sai.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index dc84f98..ef7c758 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -438,8 +438,13 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai) { struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev); - regmap_update_bits(sai->regmap, FSL_SAI_TCSR, 0xffffffff, 0x0); - regmap_update_bits(sai->regmap, FSL_SAI_RCSR, 0xffffffff, 0x0); + /* Software Reset for both Tx and Rx */ + regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR); + regmap_write(sai->regmap, FSL_SAI_RCSR, FSL_SAI_CSR_SR); + /* Clear SR bit to finish the reset */ + regmap_write(sai->regmap, FSL_SAI_TCSR, 0); + regmap_write(sai->regmap, FSL_SAI_RCSR, 0); + regmap_update_bits(sai->regmap, FSL_SAI_TCR1, FSL_SAI_CR1_RFW_MASK, FSL_SAI_MAXBURST_TX * 2); regmap_update_bits(sai->regmap, FSL_SAI_RCR1, FSL_SAI_CR1_RFW_MASK, diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h index c24d3fd..b3d8864 100644 --- a/sound/soc/fsl/fsl_sai.h +++ b/sound/soc/fsl/fsl_sai.h @@ -48,6 +48,7 @@ /* SAI Transmit/Recieve Control Register */ #define FSL_SAI_CSR_TERE BIT(31) #define FSL_SAI_CSR_FR BIT(25) +#define FSL_SAI_CSR_SR BIT(24) #define FSL_SAI_CSR_xF_SHIFT 16 #define FSL_SAI_CSR_xF_W_SHIFT 18 #define FSL_SAI_CSR_xF_MASK (0x1f << FSL_SAI_CSR_xF_SHIFT)