Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5160326img; Wed, 27 Mar 2019 03:22:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwoFiCCW/iS/nsn9HAKBIxRBPafMine8W094dEwuUq08VVO2RFMxA+kml9a/hEaGxbTxc0i X-Received: by 2002:a17:902:28ea:: with SMTP id f97mr36853959plb.203.1553682128282; Wed, 27 Mar 2019 03:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553682128; cv=none; d=google.com; s=arc-20160816; b=bbXBrBBoinUI/cSYZQ9/+iePLE4jmFSMhAGUSeHbGKlDRP59xQSZj3lx1aADQI+nKX MZ2SHqhZXeVIPwTmTCnRhV/NXg72RYQYPNVJv6mG/ivwz5WTnIYN6ngkWNn8CPMt5Sen Fsu6SWrFvF11Vn/SFDhGdDKWb3BHvPXdV0Gv8g5uhX2dEyGqzW53lpG9vIaZYHAJi1cP o2RBB+tuRF2esXtB7g7PHHDaydjJuc/w0hWfpluvTPW9cyKzgtx2xYBU2buf5EwM7Oz1 NnKwBdly8KwT7emgd+gov+hNwe+tjtLh+hKjhyG7qEj03yilq2WbI8Gdkv0XCIKABeG/ WUQQ== 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:organization:from:references:cc:to:subject :dkim-signature; bh=xLh+19KBNGfhJu0+puppWHkeDcNPIdA5C5X9WsudEg8=; b=EQ8XgS1UbCqJwAW+UhwJ2bRTjrJ+SDnuwf7wd32jdFX9oVqOAElOaEP6zFzHi3ZJQj Mh2g6ci64unO+qZoRHX1eoSb3s94o0OgyFUZWmSCtqPN9nw7DYgmy8LJXesZrnN40Dpq nkAFyK5x6gX1yOtXktivVNSAFebsciZmNK101O42YwQFZqpwb70hs+Vw6BHntWLHhiUu vSVOJQzd+b5YlTCi6U/OpQItqp/mWJnNh2g+sJ5dRgrhZdYHDGIH4W+8NlwEaYkLfSz4 oHb7zkKK6dS52Kq5aPyuJqkGDs/3jK3O+r8jicvSKKcoZrjPzghqEuNt6HlcuN73Z7TL qyMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=OXNlR3GI; 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 62si20066791ple.393.2019.03.27.03.21.52; Wed, 27 Mar 2019 03:22:08 -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=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=OXNlR3GI; 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 S1732857AbfC0KVB (ORCPT + 99 others); Wed, 27 Mar 2019 06:21:01 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:37590 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725786AbfC0KVB (ORCPT ); Wed, 27 Mar 2019 06:21:01 -0400 Received: by mail-lf1-f67.google.com with SMTP id u2so10862309lfd.4 for ; Wed, 27 Mar 2019 03:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=xLh+19KBNGfhJu0+puppWHkeDcNPIdA5C5X9WsudEg8=; b=OXNlR3GIFIrB1LOwG1JxYIiV77mYD2Vz+wSvVpCR+iKw2dlJcOQ/9FUuDtQt6e8V21 QOVZiQ4HIB6uXCSTrHwEidMG2VT5SO/c09NSGNdtS9X2FRc8gkrTK/892/GEO2Ymvmqg btY6oeJ9aeqPWPI1xvHaj3+dwnavdTuASmUhW7injYDXYhU8t+fuqt9vDlpONP5a8UaF OmV6qILU25jzMmnjgBEiC4ztcdP41VRqR1Ir0XmVXMUZHhoF6qydi4p6EAQohnMVRHSv p0lBgSZT92If/c/KnD1rEcj0xs0CqLYWo4APtoXtfnEfJZGZOeWPxRj7c2NQ1aXxSZzt D6Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=xLh+19KBNGfhJu0+puppWHkeDcNPIdA5C5X9WsudEg8=; b=AvjEezAvUmBh7071mLjVx93RDV6UNBTXZH92NVl055a1A0ALWRDfZk64XEZtaldVF2 6dIfkzIKfMfcV8v8Ovv5JM5rycaFWWrLg2orTzAZIgRoJU6ij78qfQjkKr3Nhfmy4XCl 5ZnyV3tOqnIIWKwpksXWJ2gjpX/kGADiKBFKPr1TiNvmAgRTY8icrN1KqIj1kL9Gr/Wj OrUYkEIiHbre78TbZqegInuJOlOgl0f9xGD7BMslTcpRpHBOPzy3bEJLDDNCUoO9kEIh oTrI54YipJJ70hO2oP62zABGlv8cQ3pZCRC3Iigl3qyKPIBi3Br1UwAFDhqaKtwqsEGN 75Dg== X-Gm-Message-State: APjAAAUzJX9KSyb/YVuM8IhiZR5qknHm3UxFHpYWDr29smlv2zdUBCGH Vd9GkjnY00ES7tIsYTPyAexPsg== X-Received: by 2002:ac2:44d0:: with SMTP id d16mr17926974lfm.164.1553682059232; Wed, 27 Mar 2019 03:20:59 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.80.202]) by smtp.gmail.com with ESMTPSA id g18sm4567436ljk.26.2019.03.27.03.20.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Mar 2019 03:20:58 -0700 (PDT) Subject: Re: [PATCH v8 1/2] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver To: masonccyang@mxic.com.tw Cc: bbrezillon@kernel.org, broonie@kernel.org, Geert Uytterhoeven , Simon Horman , juliensu@mxic.com.tw, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-spi@vger.kernel.org, marek.vasut@gmail.com, zhengxunli@mxic.com.tw References: <1548658158-5460-1-git-send-email-masonccyang@mxic.com.tw> <1548658158-5460-2-git-send-email-masonccyang@mxic.com.tw> <75c4642b-536e-f596-158d-387a63a5f6c5@cogentembedded.com> <2fa6af66-de08-be37-7cdf-ccbf1e50ceb0@cogentembedded.com> <86e65614-814a-e8b8-fdbe-4b7b033e4938@cogentembedded.com> From: Sergei Shtylyov Organization: Cogent Embedded Message-ID: <07bee590-9334-f17f-19dd-f5fd35f44e11@cogentembedded.com> Date: Wed, 27 Mar 2019 13:20:55 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-MW Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello! On 03/27/2019 04:32 AM, masonccyang@mxic.com.tw wrote: >> >>>> +static void rpc_spi_mem_set_prep_op_cfg(struct spi_device *spi, >> >>>> + const struct spi_mem_op *op, >> >>>> + u64 *offs, size_t *len) >> >>>> +{ >> >>>> + struct rpc_spi *rpc = spi_controller_get_devdata(spi->controller); >> >>> >> >>>> + if (op->dummy.nbytes) { >> >>>> + rpc->smenr |= RPC_SMENR_DME; >> >>>> + rpc->dummy = RPC_SMDMCR_DMCYC(op->dummy.nbytes); >> >>> >> >>> SMDMCR.DMCYC is in bits -- you forgot to multiply by 8. >> >> >> >> ? >> >> >> >> It's dummy cycles setting, i.e,. 0 is 1 cycle dummy and >> > >> > Yeah, I should've written "cycles", sorry about that. >> >> I also should've mentioned that w/o this change the "read SFDP" command >> returns garbage and the flash doesn't work. >> > > Have you checked the dummy cycles setting with logical analysis ? I don't have a logic analyzer (if you meant it). However, I dumped all the registers in your driver and Cogent's own driver, and SMDMCR was set to 0 in your driver and to 7 in our driver -- and only our driver then worked correctly. > As datasheet mentioned it's dummy cycles depends on the transfer bit size setting = 1, 4 or 8. > Setting RPC_SMDMCR_DMCYC(0x13) in 8 bits data width I got a 20 dummy cycles. > Also confirmed these 20 dummy cycles by logical analysis equipment. [...] > best regards, > Mason MBR, Sergei