Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2489437ybh; Mon, 5 Aug 2019 01:51:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqDo4yflnLO4fmpq8ZoD5iJEuFfF3I83v5PUwaj/1W2MF5oGzbKTDq8DdwSb0Pm6RP7Ikt X-Received: by 2002:a63:6205:: with SMTP id w5mr17477933pgb.199.1564995101319; Mon, 05 Aug 2019 01:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564995101; cv=none; d=google.com; s=arc-20160816; b=gJjHPGZvYAxj1wd78Nl7uzvl5Su7ql1wcSgKXChErGJyfafnI6JUp7drV0tCX31aIp zH1XX0lL9t0JhM86N32Hf4WERBSVKdXVxw5FhkvXeMeAy7XLsKvA77SBJB1tSO4yY8yc yvM+r9vx9459tNWwHictsy8lkMORrFDnVrFTYXn+RNTJaijd3e5C8cK80Oyi5BgEz6nG BNLH3v4Xp3rqDQeA4PpRnSRYYYfhsYUkjWfXIk7ta+uFweQlRLHbUvdwVFwMBUSS++Vf FvHymbwA01Efpt8M5kNdew+shyjHeNc2Eo+VecT0RyDei1vr72EInOykLLLmXaYShPjv H8Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=vEuxPusu+ivV5/o2Ubnc9iofTbci+XHwr1IiGeJRPYE=; b=eJhFzX9/YgWZXzpv13EVnvratS/HRbrvObyEIqExWYYROcPncvA73lJmW2h1FogC2A UvjKIwHzi+HIuqI1NIJAVFUogMVC2OLbc9vMj6XFhevCZ+ceOsr9pGz68WMBIviS3rI3 VBRjyVtLs7DTwq7BOAwYF7obsLv/1cnJ8AS6hEP95Db4ngfDNrnjMTxwglwke9zzdmHH IeQINL+LcgfRh3k/BsDsntkgGe32jcvvBSr6rBxgWoFR0qhjmBzF2oa38G1wFuLD5pWZ 8SuYqMsN91HyKpUK5aI6leApJJtp6t8oFkNYAILruZDcXF+uGV2KGwH4ClGMZs+89SG3 3CCw== 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 q25si41376336pgv.114.2019.08.05.01.51.25; Mon, 05 Aug 2019 01:51:41 -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 S1727844AbfHEIub (ORCPT + 99 others); Mon, 5 Aug 2019 04:50:31 -0400 Received: from mga03.intel.com ([134.134.136.65]:28351 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726423AbfHEIub (ORCPT ); Mon, 5 Aug 2019 04:50:31 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Aug 2019 01:50:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,349,1559545200"; d="scan'208";a="373010128" Received: from buildpc-hp-z230.iind.intel.com (HELO buildpc-HP-Z230) ([10.223.89.34]) by fmsmga005.fm.intel.com with ESMTP; 05 Aug 2019 01:50:01 -0700 Date: Mon, 5 Aug 2019 14:21:53 +0530 From: Sanyog Kale To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com Subject: Re: [RFC PATCH 09/40] soundwire: cadence_master: fix usage of CONFIG_UPDATE Message-ID: <20190805085153.GB22437@buildpc-HP-Z230> References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-10-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190725234032.21152-10-pierre-louis.bossart@linux.intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 25, 2019 at 06:40:01PM -0500, Pierre-Louis Bossart wrote: > Per the hardware documentation, all changes to MCP_CONFIG, > MCP_CONTROL, MCP_CMDCTRL and MCP_PHYCTRL need to be validated with a > self-clearing write to MCP_CONFIG_UPDATE. > > For some reason, the existing code only does this write to > CONFIG_UPDATE when enabling interrupts. Add a helper and do the update > when the CONFIG is changed. > the sequence of intel_probe is as follows: 1. intel_link_power_up 2. intel_shim_init 3. sdw_cdns_init 4. sdw_cdns_enable_interrupt Since we do self-clearing write to MCP_CONFIG_UPDATE in sdw_cdns_enable_interrupt once for all the config changes, we dont perform it as part of sdw_cdns_init. It does make sense to seperate it out from sdw_cdns_enable_interrupt so that we can use when clockstop is enabled where we dont need to enable interrupts. > Signed-off-by: Pierre-Louis Bossart > --- > drivers/soundwire/cadence_master.c | 29 +++++++++++++++++++++-------- > 1 file changed, 21 insertions(+), 8 deletions(-) > > diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c > index 9f611a1fff0a..eb46cf651d62 100644 > --- a/drivers/soundwire/cadence_master.c > +++ b/drivers/soundwire/cadence_master.c > @@ -224,6 +224,22 @@ static int cdns_clear_bit(struct sdw_cdns *cdns, int offset, u32 value) > return -EAGAIN; > } > > +/* > + * all changes to the MCP_CONFIG, MCP_CONTROL, MCP_CMDCTRL and MCP_PHYCTRL > + * need to be confirmed with a write to MCP_CONFIG_UPDATE > + */ > +static int cdns_update_config(struct sdw_cdns *cdns) > +{ > + int ret; > + > + ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, > + CDNS_MCP_CONFIG_UPDATE_BIT); > + if (ret < 0) > + dev_err(cdns->dev, "Config update timedout\n"); > + > + return ret; > +} > + > /* > * debugfs > */ > @@ -758,15 +774,9 @@ static int _cdns_enable_interrupt(struct sdw_cdns *cdns) > */ > int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns) > { > - int ret; > - > _cdns_enable_interrupt(cdns); > - ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, > - CDNS_MCP_CONFIG_UPDATE_BIT); > - if (ret < 0) > - dev_err(cdns->dev, "Config update timedout\n"); > > - return ret; > + return 0; > } > EXPORT_SYMBOL(sdw_cdns_enable_interrupt); > > @@ -943,7 +953,10 @@ int sdw_cdns_init(struct sdw_cdns *cdns) > > cdns_writel(cdns, CDNS_MCP_CONFIG, val); > > - return 0; > + /* commit changes */ > + ret = cdns_update_config(cdns); > + > + return ret; > } > EXPORT_SYMBOL(sdw_cdns_init); > > -- > 2.20.1 > --