Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2454776imm; Mon, 10 Sep 2018 01:10:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdapQDgUsWN6PrjhTwgDaT+ny60HUYuUMlM2LQZfU1w6O/N2l45SzxdNcWpVXI3ms9xyKe5B X-Received: by 2002:a63:4606:: with SMTP id t6-v6mr21008799pga.271.1536567013599; Mon, 10 Sep 2018 01:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536567013; cv=none; d=google.com; s=arc-20160816; b=xLb6Z1JMbnXZEzZh7YOED7VGRqgCgcaIBMlGRd6IrFGCYZYtSQXWL8jFjBzKeb3HRJ LMUDpdPWENgFKeWQSefH3pXGICcdhEGWcDZ2339Wio511DE6MOMZuy6/c2VA1ziBavoL 8+K6wgFewKkYAnI31Q3Ghox0YtegKelRw20HiHvE9Fd+ZMM7CewSTgQ14vZ35RVTOIdk nxQ44ZVXEKMFes9znwfBSEhYU2Dq//mwrSiEQfMQ7WqMTekpDfRuNBIQMbfVxhUBi5hO W/Y++uHt0+tIulCyddojaG5viIGU2NyZbnJApJudC7Tt5UD0+pvY8pfzPpZuztdVCYwr Ee5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:from:dkim-signature; bh=AGjJk1WhGgn2rOQ6EvhKwmOPXAMeK6A4IVGBURYf9zo=; b=sh2rb4m8vGsngbQUA6bxB4NV0nCA8wYY1wKSb1LNCFAHxi9A1rT21xH5HjcMTqBxYf xmotAdATDGOfPu93yRvpXldH4mwZDFVyzQpVwKJJ/iP/E2SVa9sGmRuYJkdeApRlpy1p AM2Av0K/f/ynTxJIKTQI5QRpsslORNclf3SMBm7TqoVJbjRzybw3fomyvRgCO1EivQie oY1U7XKIjHB+A3hNQi7ixQ+zDSw0ks0Pli17+9Dsr4S1m2ZqEqsFZluFAS34Fyf3piCa yfYzjuM/TPVJV+1TyU5yUoG4S0/oic+CaT658CtRp41/V5gGHPK4f1zph3C69ycdQV9e JnvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=t+GjDU4j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34-v6si16629187plp.310.2018.09.10.01.09.58; Mon, 10 Sep 2018 01:10:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=t+GjDU4j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727752AbeIJNBI (ORCPT + 99 others); Mon, 10 Sep 2018 09:01:08 -0400 Received: from mail-eopbgr730064.outbound.protection.outlook.com ([40.107.73.64]:18940 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726505AbeIJNBH (ORCPT ); Mon, 10 Sep 2018 09:01:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AGjJk1WhGgn2rOQ6EvhKwmOPXAMeK6A4IVGBURYf9zo=; b=t+GjDU4jMv9G3hoMTzUn7XRvgveNfGwe+EJJOsZxWlyCxchsGELzk+8mgj8drd/hGW8h5IFDSY8kb96zZndSTNWyNyfXyDkOAH0rmH5HIuLqo//m0QOfTXnmFwBBC+JGbQfE+DCRuuOaM4tJoKoKXu2LHWno/wlQP5/L+RJ/Hig= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.amd.com (165.204.156.251) by BL0PR12MB2355.namprd12.prod.outlook.com (2603:10b6:207:4c::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.15; Mon, 10 Sep 2018 08:07:33 +0000 From: Akshu Agrawal Cc: djkurtz@chromium.org, akshu.agrawal@amd.com, Alexander.Deucher@amd.com, Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , "Mukunda, Vijendar" , Alex Deucher , alsa-devel@alsa-project.org (moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/2] ASoC: AMD: Ensure reset bit is cleared before configuring Date: Mon, 10 Sep 2018 13:36:30 +0530 Message-Id: <1536566815-3271-2-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1536566815-3271-1-git-send-email-akshu.agrawal@amd.com> References: <1536566815-3271-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: PN1PR0101CA0039.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::25) To BL0PR12MB2355.namprd12.prod.outlook.com (2603:10b6:207:4c::33) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 43fc20f9-8e03-47d5-5963-08d616f47b5b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052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pJtaRsnfh4toA7KKcRe+voAIL/g6s9gsKO9j6u/4bSgOXjW5Yv4Knvj0luv/oUayKFlXLwaBxmm6S6a+WGWlC9OffZHdklauy5T23SX+70yGm+5CEzLyIRYxZg8UlPW9UBWQjs/4e33QnG1kJ2EO7PVL1CBcuB2397Z8UJrfQUVyOTzmRbdAUt7o2DtPhB64jTtBJ3Wrmj3Rl2hp4/G8otnGQaoXI+lz1IS5NTwmbbjADBd0oHoIarTVRCJHB0X/YPOb4bqSynIaTEdmJ/mDmBa00SdbTJvMNk/wORHOC6wvC6MfK02ktNJaYDJvy2X+2xg9s/5EH+wIZePvNZv7nlpTLbdF5n4E0jnUqutEIeoyKF9oOaU1fS9lXV7GNylSMPlL3iguxDeEKNWq7t8KlkClasLjO8zbp5ZT9C9nK;4:V+yT7fiaPdK43I0lJa1QSRj0zxECCmOiLJGYNoWDZU5ueAoSlag3ayHjhO1+5vhEDel425QQOskNMoUzvEwcBOApUqVzFnBl1t5OsgUdttAk0y0/0pWIRrZSudI8pCTksvZ1bGCSsd5JfWApKTBj8cRdfGJ9cBZPH2l+gm7o+fYYwH2HhS4GI2SftfhdHo6zG88ayWHxBa2MgreD61und67XszOcim74IPTVaQb5HlMFrJsHbGO86TqSkfjVU9aXsCq6YLAnJXQJpwnKvGACZWwT9LW6wfCZaubpcgKKzHdj7yzbdrfZ0jUveVvEtu+k X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201708071742011)(7699050);SRVR:BL0PR12MB2355;BCL:0;PCL:0;RULEID:;SRVR:BL0PR12MB2355; X-Forefront-PRVS: 07915F544A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(396003)(136003)(366004)(346002)(199004)(189003)(50226002)(81156014)(86362001)(81166006)(54906003)(109986005)(36756003)(476003)(105586002)(39060400002)(2616005)(446003)(26005)(51416003)(11346002)(956004)(53416004)(386003)(1671002)(66066001)(53936002)(7696005)(52116002)(3846002)(6116002)(47776003)(8676002)(68736007)(6486002)(16526019)(486006)(186003)(478600001)(2906002)(48376002)(316002)(4326008)(97736004)(5660300001)(7736002)(305945005)(25786009)(76176011)(16586007)(14444005)(8936002)(72206003)(44832011)(50466002)(106356001)(266003);DIR:OUT;SFP:1101;SCL:1;SRVR:BL0PR12MB2355;H:akshu-HP-EliteBook-745-G2.amd.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BL0PR12MB2355;23:IYRoRAhfvh4IAbGATnOEhkyr7NSUFqLLIhY8f/6rS?= =?us-ascii?Q?vAxqwrFrxlsBXsavIVP77JfsaLeWAfEU3UCCHtSpI24wQ0JRWFow3L37mR1W?= =?us-ascii?Q?y9xqgHAoOLw94Z2rAzOtb9+o5PdhybzlJ4MBFzZhyyMc7tsDzp6tIMsYgeF7?= =?us-ascii?Q?GH/dEa3olEJYPV2B5NElxJRWs39xNmQhe3kVkJ7vWk42sNmDQe6gcplF69Ne?= =?us-ascii?Q?xD19iSP17VhZ605VnlmLaCI4KnlJZoQ7n+nGUv2i/zjpfgirMoc3a+dOJhB/?= =?us-ascii?Q?Tqv9mldwU2NR3BRS8kIgp1k3F8qcvnPJQX5rjRvYFgNOs5wwoy1bSdLINLG+?= =?us-ascii?Q?LwkfSZzR5Y+eV3q1waTrCxmq6xhPcHm+1mAYRtV1kwpkP6F00AjNfVBFh4EB?= =?us-ascii?Q?D2P1hC/MJPi+HioEXSYUiM4UdlVpVvYplMwgJ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o=;7:fpEsv3BpUZf7gPoYk6b7lE0w8XZtkeXnb6ZagrFSwAXYh6WwYj/KTl8vEPCof/QWM+7SbAiWM81D31BnfjSmFwDAqC+iofpG2EwU/A5dN/jWypQLAcqFs3eR1S+m02lKi+HBU1NDhhXNubXwp69XzLAS5Df9eCheFqVr17gdcyT9NWoga+YSvW3eXoL1zZ04pBBdD7l1E0kLXtROHbnql38C9LmZzzO6FciCJ2IX+aUwpdkiQcy7N9FC60k7z6tf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BL0PR12MB2355;20:Jb+B/zyl+5Sw0EgNBDrrmIorjjQmbEJGQfcKKo8D3PB8j+OPr7AFVIwmT29E+IFA90Vity5dMrLtm/s0yte2ttNKRZOf/zDiNfB1SPvOoAo3PesoXDnIXwiN5AgVRX3SUziW0I8pTqQdlTD3lSzkYln85KXxKd+xi5KrIPkl9QZV+SKUoNsXwscIK/eFlWnX0qeSRR2skvpT9b57RzkL2sM+xJunemNNoOTXA8IhOjg3y6TKROPmoTH6k6RHBXMh X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2018 08:07:33.0200 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43fc20f9-8e03-47d5-5963-08d616f47b5b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2355 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org HW register descriptions says: "DMA Channel Reset...Software must confirm that this bit is cleared before reprogramming any of the channel configuration registers." There could be cases where dma stop errored out leaving dma channel in reset state. We need to ensure that before the start of another dma, channel is out of the reset state. Signed-off-by: Akshu Agrawal --- sound/soc/amd/acp-pcm-dma.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index e359938..77b265b 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -184,6 +185,24 @@ static void config_dma_descriptor_in_sram(void __iomem *acp_mmio, acp_reg_write(descr_info->xfer_val, acp_mmio, mmACP_SRBM_Targ_Idx_Data); } +static void pre_config_reset(void __iomem *acp_mmio, u16 ch_num) +{ + u32 dma_ctrl; + int ret; + + /* clear the reset bit */ + dma_ctrl = acp_reg_read(acp_mmio, mmACP_DMA_CNTL_0 + ch_num); + dma_ctrl &= ~ACP_DMA_CNTL_0__DMAChRst_MASK; + acp_reg_write(dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + ch_num); + /* check the reset bit before programming configuration registers */ + ret = readl_poll_timeout(acp_mmio + ((mmACP_DMA_CNTL_0 + ch_num) * 4), + dma_ctrl, + !(dma_ctrl & ACP_DMA_CNTL_0__DMAChRst_MASK), + 100, ACP_DMA_RESET_TIME); + if (ret < 0) + pr_err("Failed to clear reset of channel : %d\n", ch_num); +} + /* * Initialize the DMA descriptor information for transfer between * system memory <-> ACP SRAM @@ -236,6 +255,7 @@ static void set_acp_sysmem_dma_descriptors(void __iomem *acp_mmio, config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx, &dmadscr[i]); } + pre_config_reset(acp_mmio, ch); config_acp_dma_channel(acp_mmio, ch, dma_dscr_idx - 1, NUM_DSCRS_PER_CHANNEL, @@ -275,6 +295,7 @@ static void set_acp_to_i2s_dma_descriptors(void __iomem *acp_mmio, u32 size, config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx, &dmadscr[i]); } + pre_config_reset(acp_mmio, ch); /* Configure the DMA channel with the above descriptore */ config_acp_dma_channel(acp_mmio, ch, dma_dscr_idx - 1, NUM_DSCRS_PER_CHANNEL, -- 1.9.1