Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1058752imm; Wed, 19 Sep 2018 11:16:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbMIZna4Fncp+15+lmc15PtJXTkR9f/0KpSN+abeog3mwo3eKMtbyfs5/iBP9SuI7VZ65FY X-Received: by 2002:a62:ca0d:: with SMTP id n13-v6mr37417162pfg.69.1537380967023; Wed, 19 Sep 2018 11:16:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537380966; cv=none; d=google.com; s=arc-20160816; b=a4Cg8COXp/XYFrbVqpuSWXu9gEif1bVEsLPYrRf8DIoKe4LeKDeISeQqykB7zFPxgc p2I7ZupYGOOX1805xQjNTuXgLqJlKZKj8xZJGLzHm5S3NtVz7RS/MbchLelszMJ30ZPw NI0yK8n70ZCemSwkhOvpv6K3EYjDJl+QMWYkY69aaqfScX/csaifYTZN+JqhKjY6AItv 43lmCCE5BZjWW9IhMGSiOt5wFZ6EOVDuddHpW9aCIFvucqjWR8lf8/O/TYOOJw8mQaro xgqokGTKE06j1ltTA6jgeCEdaeskMvZJppd5nA5pZDYTmPqXNuWPdX9tqyYhjRyLe/Xd MLFA== 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:dkim-signature; bh=4VOFTD1AepX+8sEBg0Let5oupMO5p7Bq950W2Zd6ZZM=; b=dPkSqqhEWHaxN9EZHp7J/zMZ7sMO2gsqTvPqz7/pmJTAI0yV5/FzZ5WTy9h/zGjf+h OtzIyPySWL6OVDvfDuz88adM/fiIzL7JXJ46P2m29yno3f+uSd2joMFldwAWWCRjv03Z LbHTQkPFAepwDoDijzQWT4q8iRdtOS4c0/AKfZ3OEQeS03wnUxKVoUVxQgCF1FWDt5f0 lQkTp4/i4rfFiV7XkpELn/x4yIdoYIzZEqxKL2kaZWfm5MdREDIvD/Ujn7so2hGsDgW5 sPjVXA41ZNy5D8l1UYlUlwgPtFjHOY4bFz7Y5sJlXlSQ3TJOdBwuK3XClLSd47OqoxB6 sq/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=p4oj5YDR; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r18-v6si20882501pgj.194.2018.09.19.11.15.51; Wed, 19 Sep 2018 11:16:06 -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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=p4oj5YDR; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732777AbeISXZT (ORCPT + 99 others); Wed, 19 Sep 2018 19:25:19 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:50820 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728197AbeISXZT (ORCPT ); Wed, 19 Sep 2018 19:25:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4VOFTD1AepX+8sEBg0Let5oupMO5p7Bq950W2Zd6ZZM=; b=p4oj5YDReFkR796aRcBOvdrC3 k0ZzfHTnNkE/DsLAZBWbdhGbGPgpcKg7Ga4ySypkGvQ/DdTNA/z1Q+USgMpS72TX0cmlnHG35NF9P uo2Wf6D615wTApw16V50QlcGff+LT4Hq+4AS1+2UxDXdE75cSp6x5DCBH7NkhzvEVjzMo=; Received: from [209.121.128.187] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2gYI-0004wF-Gw; Wed, 19 Sep 2018 17:46:14 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 3838F440078; Wed, 19 Sep 2018 18:46:12 +0100 (BST) Date: Wed, 19 Sep 2018 10:46:12 -0700 From: Mark Brown To: masonccyang@mxic.com.tw Cc: tpiepho@impinj.com, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, boris.brezillon@bootlin.com, juliensu@mxic.com.tw, zhengxunli@mxic.com.tw Subject: Re: [PATCH 1/2] spi: Add MXIC controller driver Message-ID: <20180919174612.GG2471@sirena.org.uk> References: <1537168579-31593-1-git-send-email-masonccyang@mxic.com.tw> <1537168579-31593-2-git-send-email-masonccyang@mxic.com.tw> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="/zLL6W406Aotuby1" Content-Disposition: inline In-Reply-To: <1537168579-31593-2-git-send-email-masonccyang@mxic.com.tw> X-Cookie: Universe, n.: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --/zLL6W406Aotuby1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Sep 17, 2018 at 03:16:18PM +0800, masonccyang@mxic.com.tw wrote: > +static void mxic_spi_set_cs(struct spi_device *spi, bool lvl) > +{ > + struct mxic_spi *mxic = spi_master_get_devdata(spi->master); > + > + if (!lvl) { > + if (mxic_spi_clk_setup(spi)) > + return; > + if (mxic_spi_clk_enable(mxic)) > + return; > + writel(readl(mxic->regs + HC_CFG) | HC_CFG_MAN_CS_EN, > + mxic->regs + HC_CFG); > + writel(HC_EN_BIT, mxic->regs + HC_EN); > + writel(readl(mxic->regs + HC_CFG) | HC_CFG_MAN_CS_ASSERT, > + mxic->regs + HC_CFG); Like Boris says having the clock management in the chip select operations is not good - it's not just redundant with runtime PM, it's potentially broken if a device does something like using an inverted chip select. The chip select operation should just be managing the chip select, nothing else. If it does other things it's going to end up being broken for some cases. Otherwise this looks good. --/zLL6W406Aotuby1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAluii2MACgkQJNaLcl1U h9D50Qf9G9sFzVoF5k2uw3dJxs3w76wu7spHMRRe/DRf1QSI/vHfzhuBGfCL8Xo6 Z78sgnpiC2Nqa2Uu/oKQdQ9+70SQlb9K3F+o5KwV2eIk6tZpFiMGRN6Y/YFoFvGw aLrj/8ruutokwFGxibqEJdTAp/ErE+6ND6cdRln0SAH+VUW/4dzNZbB5LS8NtMJR c32ZJaUeN90+UBqYalxG4tm8zSodDv2HqQ4DzfdBIl0KWZqM2g4qjVPbWeFH7KFW JPAr35PWWnmTUeYWXrrdm17pAn7xfQMJLjrDDjcuRb3AjqL7XMRtAoxeFiaDcfQR f/YWGn4PwtE2acggALgCrE/u0z669w== =5LGp -----END PGP SIGNATURE----- --/zLL6W406Aotuby1--