Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp145284ybi; Fri, 26 Jul 2019 07:27:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhxVk6jmoWrn/V4Gk+oRBcNznD9jHQoJHSm8CwXx5PXkAj6jNiOFCmvFAPMzM2MP+OYYaD X-Received: by 2002:a62:2ad3:: with SMTP id q202mr23098827pfq.161.1564151262768; Fri, 26 Jul 2019 07:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564151262; cv=none; d=google.com; s=arc-20160816; b=RTPBdKfjavGhU4vlKGeU8msgBPQ3JOZtDd9X7P91vyvA/dPC0MGvMHmSBoLa1pY6MO y/xvIRCgFcZ8F9Njhf6So6Ou7bxYbdTvxDZXM8AMBJEGH3//z3Na+kHcjDwsq9Awk+Fi KV5EEZq3Mj/VXNmZQFYsRb+U5zbwxsYL6kaVKZb3zFG7nS/WReO74wRJ1rwIXtMKww6F XuO6zapEgk8uu6Rx075pa8aoLGiOdA/+CkaWHsdJDdqsLv6FX5XJyW1roJrLae0AP5uc mfTa68MWLOia92octJjaw8HvDsQsNtwRW6kuzur21lN2REePPiEDuANiY3hwU9s+hZ4K Zucg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=T0ptKRpEuvrAtHZg2cFx7kUNCevg1Lpb80NAuRjT7mI=; b=MS30OO4hx9/edf3W0ziFQkBO1GY1/lI+UtTeHtiVfmjSI7YoVoKSdDVp46P262zr4Y 6SU/IA36Ot9ESLtZTnYFG1OzKOD8to7ECpVBHjaogh+WJ5PwSCtxu1DC2QS8CaVAss2M 2DFhxX4AFVDDdRcegpxA4pJ9wl32MNr1lfxktyWoIGCyHiuyhxA7hepm2I537V0Pp1/Z RDTLGjqG+njFkiPdZ8PSNU0xaPC36Y8Z/YMrTbP76ouV+j5up8xvz/zNxZ35RoWmM/MR yEg4t+9k8QLEdwE2ROBU4K64Ms52r2puAPobvgQEqX32O7zubmxEGbQgXkZ9XUsmdd9E SSKA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s94si17416235pjb.83.2019.07.26.07.27.27; Fri, 26 Jul 2019 07:27:42 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727763AbfGZOYy (ORCPT + 99 others); Fri, 26 Jul 2019 10:24:54 -0400 Received: from mga03.intel.com ([134.134.136.65]:51935 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726731AbfGZOYx (ORCPT ); Fri, 26 Jul 2019 10:24:53 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2019 07:24:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,311,1559545200"; d="scan'208";a="322052065" Received: from msmall-mobl.amr.corp.intel.com (HELO [10.251.154.62]) ([10.251.154.62]) by orsmga004.jf.intel.com with ESMTP; 26 Jul 2019 07:24:51 -0700 Subject: Re: [alsa-devel] [RFC PATCH 26/40] soundwire: cadence_master: fix divider setting in clock register To: Bard liao , alsa-devel@alsa-project.org Cc: tiwai@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, slawomir.blauciak@intel.com, Sanyog Kale , Rander Wang References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-27-pierre-louis.bossart@linux.intel.com> From: Pierre-Louis Bossart Message-ID: <616012b9-d4a2-b980-68e6-d9ba7e6d819b@linux.intel.com> Date: Fri, 26 Jul 2019 09:24:51 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/26/19 12:19 AM, Bard liao wrote: > > On 7/26/2019 7:40 AM, Pierre-Louis Bossart wrote: >> From: Rander Wang >> >> The existing code uses an OR operation which would mix the original >> divider setting with the new one, resulting in an invalid >> configuration that can make codecs hang. >> >> Add the mask definition and use cdns_updatel to update divider >> >> Signed-off-by: Rander Wang >> Signed-off-by: Pierre-Louis Bossart >> >> --- >>   drivers/soundwire/cadence_master.c | 12 +++++++----- >>   1 file changed, 7 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/soundwire/cadence_master.c >> b/drivers/soundwire/cadence_master.c >> index 10ebcef2e84e..18c6ac026e85 100644 >> --- a/drivers/soundwire/cadence_master.c >> +++ b/drivers/soundwire/cadence_master.c >> @@ -57,6 +57,7 @@ >>   #define CDNS_MCP_SSP_CTRL1            0x28 >>   #define CDNS_MCP_CLK_CTRL0            0x30 >>   #define CDNS_MCP_CLK_CTRL1            0x38 >> +#define CDNS_MCP_CLK_MCLKD_MASK        GENMASK(7, 0) >>   #define CDNS_MCP_STAT                0x40 >> @@ -988,9 +989,11 @@ int sdw_cdns_init(struct sdw_cdns *cdns) >>       /* Set clock divider */ >>       divider    = (prop->mclk_freq / prop->max_clk_freq) - 1; >>       val = cdns_readl(cdns, CDNS_MCP_CLK_CTRL0); > > > Do we still need to read cdns_readl(cdns, CDNS_MCP_CLK_CTRL0) > > after this change? no I don't think we do indeed. > > >> -    val |= divider; >> -    cdns_writel(cdns, CDNS_MCP_CLK_CTRL0, val); >> -    cdns_writel(cdns, CDNS_MCP_CLK_CTRL1, val); >> + >> +    cdns_updatel(cdns, CDNS_MCP_CLK_CTRL0, >> +             CDNS_MCP_CLK_MCLKD_MASK, divider); >> +    cdns_updatel(cdns, CDNS_MCP_CLK_CTRL1, >> +             CDNS_MCP_CLK_MCLKD_MASK, divider); >>       pr_err("plb: mclk %d max_freq %d divider %d register %x\n", >>              prop->mclk_freq, and this log needs to go away or done in a better way, I missed this. >> @@ -1064,8 +1067,7 @@ int cdns_bus_conf(struct sdw_bus *bus, struct >> sdw_bus_params *params) >>           mcp_clkctrl_off = CDNS_MCP_CLK_CTRL0; >>       mcp_clkctrl = cdns_readl(cdns, mcp_clkctrl_off); > > > Same here. yep. > > >> -    mcp_clkctrl |= divider; >> -    cdns_writel(cdns, mcp_clkctrl_off, mcp_clkctrl); >> +    cdns_updatel(cdns, mcp_clkctrl_off, CDNS_MCP_CLK_MCLKD_MASK, >> divider); >>       pr_err("plb: mclk * 2 %d curr_dr_freq %d divider %d register %x\n", >>              prop->mclk_freq * SDW_DOUBLE_RATE_FACTOR, > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel