From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753243AbcBZCcC (ORCPT ); Thu, 25 Feb 2016 21:32:02 -0500 Received: from regular1.263xmail.com ([211.150.99.135]:43669 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751124AbcBZCcA (ORCPT ); Thu, 25 Feb 2016 21:32:00 -0500 X-Greylist: delayed 141706 seconds by postgrey-1.27 at vger.kernel.org; Thu, 25 Feb 2016 21:31:58 EST X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 X-RL-SENDER: huangtao@rock-chips.com X-FST-TO: huangtao@rock-chips.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: huangtao@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Subject: Re: [PATCH] spi/rockchip: Make sure spi clk is on in rockchip_spi_set_cs To: Mark Brown References: <1456308004-29102-1-git-send-email-huibin.hong@rock-chips.com> <56CD8F85.2090204@rock-chips.com> <20160226015829.GC18327@sirena.org.uk> Cc: Huibin Hong , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, "shawn.lin" , linux-rockchip@lists.infradead.org, Addy Ke From: "Huang, Tao" Message-ID: <56CFB916.5010403@rock-chips.com> Date: Fri, 26 Feb 2016 10:31:50 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160226015829.GC18327@sirena.org.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016年02月26日 09:58, Mark Brown wrote: > >> Another way to solve this bug is add runtime PM support while spi setup. >> Some other chips may have some problem, for example mt65xx and orion, >> which access hardware register too. > > No, this is telling you you're doing something wrong - setup() might be > called while another transfer is in progress so you shouldn't be > changing the hardware setup (see Documentation/spi/spi-summary). This > means that you normally shouldn't be writing to registers there. Moving > this to prepare_message() instead is probably what you want. > You misunderstand me. I talk about spi_setup, as Documentation/spi/spi-summary, which would normally be called from probe() before the first I/O is done to the device. spi_setup will call spi_set_cs(spi, false), which introduced with commit 1a7b7ee72c21 ("spi: Ensure that CS line is in non-active state after spi_setup()"). And spi_set_cs will call spi->master->set_cs, and set_cs callback will access register. Without clk enable, I believe some drivers will failed to run. Best Regards, Huang, Tao