Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1872148imu; Thu, 24 Jan 2019 03:29:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN4nlz08bGOts2iGCi9J7Jy5zapSxZpeAapF0mbd731Rg4OXnPMcSdmdLoRTWD8loeSuolY3 X-Received: by 2002:a63:2bc4:: with SMTP id r187mr5541078pgr.306.1548329392095; Thu, 24 Jan 2019 03:29:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548329392; cv=none; d=google.com; s=arc-20160816; b=g1H7BlzbAotKcZqUp++rEQooiqpmx6Slj35rLw/FdyC0zqjfx5TPbvMPLZHSqD7qhF 18ciRfW275Umz2t+1SXx4V114wA6V080NigkYZOPfRQKSynL4t298XRgCMuyFTVAqApq 5WbDQupWV2i25Icpq/Du4EinE0S3TywJQ+g90O2FWPzT36ubQvSobZZ1YkgbDz25WzPH c2fntnKflMo34infIVzaMF7dxapl0ZyommT7IVxpk3FCXb9iMYSXY5tvzY6q+Kufgpa9 Sev//iFxuUudvKy46pMHm1FK5E0fqTKFE+UmHBVsbBBeY1JNGXTxvrQy8fWVUdu2dsua ovkg== 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=VrZZaCNJA5LxCq/2HDw9sOlVtJiJiEbnl+FPXNsPEw8=; b=AqTrz1fpZeuq2DARvZfl9JMqHzCl8kLiCUGOinGKWum0NsUhTQOfrjvf3BhCDMhl3R A7Qk1bIfWVQfTXv0pCizK1xlwWsWR/szttNVWU53BEYpa4xQYbHui2d0Z3gbevEftxHa vEoYrnid3KhLIOSckpZtselt+iHVgEA+ZmPPJ4zJ2QlFFRn4yN5s3hWFukHB2kPDKV3n t2nCPO0wV7/vuBVkmVNyqBCostemp1GNu+sOqIyiZObhXMoZ0Lnt1ELfmsSfGfPoQaeW Ate5B/XoDkmYqQRYjG3c+pevl4eTuMkpHlC0L7YkyCG3Zt8kDaYDdVL3za1s9Ep4f4zn 4jyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=x+Utd+c4; 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 p14si20510827pfi.12.2019.01.24.03.29.36; Thu, 24 Jan 2019 03:29:52 -0800 (PST) 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=x+Utd+c4; 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 S1727878AbfAXL1p (ORCPT + 99 others); Thu, 24 Jan 2019 06:27:45 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:41278 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727409AbfAXL1p (ORCPT ); Thu, 24 Jan 2019 06:27:45 -0500 Received: by mail-lf1-f68.google.com with SMTP id c16so4024398lfj.8 for ; Thu, 24 Jan 2019 03:27:43 -0800 (PST) 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=VrZZaCNJA5LxCq/2HDw9sOlVtJiJiEbnl+FPXNsPEw8=; b=x+Utd+c4Vcgp+tlgdQ5vG1UZ7Mixr6id7Ysyj0LD5JIhz4B2x5lithWgqdRKu7fA3S EPRSf87H7q21xTC02SMkosLB2jQ0R56ooILHlgNswzppUMn6r4AToKrbdtsqHpBOpe6b kzIz3RlPvpGK5E80PVQfp9mjbYvPyk76xG9edAaTaZjrXRs3YXtsoCLvG6RRHQEVg/IU 8ryZsubsp/cjkdgQKvreYYPhZlbM5J2fqW0kJzPvooet5DCjGOGbDvhy7qtA9f/SBz5X sopOoEsjUfMGMytAlwmzTJQDsJlLAhTYYsA53Lya9wcmVvjtPGbNTK+QccxzrSs6zluC wu8w== 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=VrZZaCNJA5LxCq/2HDw9sOlVtJiJiEbnl+FPXNsPEw8=; b=edEliiwS6q2PS85U3bJPRaejLtETYPiJS90J55isHyFX5+UUgL6dBJgLqFAt6Dyu5P uAdMoUqkzqrtsO3RbNWpJOo4up/8UoYbhHh5cqEwXNs7SSURdtuy19rQ3hJHw5Dc87j6 u7Agcn5ZKCFHZAll+RRO0IsmwE4Qr5G0X5P4a6vWNWVvofvhfkBA7IcyXEdgbytxCe4U JxALR2HQPHjlnWyDMxiR93wpzu24h3YEncI1wkyxOrAvnI3sFa1m/+BddrqQrE9zd+oW 4WCMpwiCKm4NTqt+5kb1hLia5FWvrvrq66k4QRAocKK661hdrRPvw/2voVIKG+0RsBsa dlfg== X-Gm-Message-State: AJcUukdyebGzykQ8LgvOsBlNB7XN4YmrTaOsBF+Rt5yZjM+MMVA6A8dD VQLG4+UzP451MZKpu0lThZUpRw== X-Received: by 2002:a19:7d42:: with SMTP id y63mr5012602lfc.47.1548329262921; Thu, 24 Jan 2019 03:27:42 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.84.179]) by smtp.gmail.com with ESMTPSA id s3-v6sm963489lje.73.2019.01.24.03.27.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 03:27:41 -0800 (PST) Subject: Re: [PATCH v7 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: <1548227352-14910-1-git-send-email-masonccyang@mxic.com.tw> <1548227352-14910-2-git-send-email-masonccyang@mxic.com.tw> <12af2632-491d-0e01-66c9-0ead4f9d985a@cogentembedded.com> From: Sergei Shtylyov Organization: Cogent Embedded Message-ID: <1c47e6ba-66ac-49c5-1dc5-a441f5a8b42c@cogentembedded.com> Date: Thu, 24 Jan 2019 14:27:40 +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 On 01/24/2019 05:06 AM, masonccyang@mxic.com.tw wrote: >> > +// SPDX-License-Identifier: GPL-2.0 >> > +// >> > +// Copyright (C) 2018 ~ 2019 Renesas Solutions Corp. >> > +// Copyright (C) 2018 Macronix International Co., Ltd. >> > +// >> > +// R-Car Gen3 RPC-IF SPI/QSPI/Octa driver >> >> Do we really support Octa? > > yes and it needs to patch spi-nor layer and RPC driver for sure. It? >> > +// >> > +// Authors: >> > +// Mason Yang >> > +// >> [...] >> > +#include >> [...] >> > + } else if (rx_buf) { >> > + // >> > + // RPC-IF spoils the data for the commands without an address >> > + // phase (like RDID) in the manual mode, so we'll have to work >> > + // around this issue by using the external address space read >> > + // mode instead. >> > + // >> > + if (!(smenr & RPC_SMENR_ADE(0xf))) { >> > + regmap_update_bits(rpc->regmap, RPC_CMNCR, >> > + RPC_CMNCR_MD, 0); >> > + regmap_write(rpc->regmap, RPC_DRCR, >> > + RPC_DRCR_RBURST(32) | RPC_DRCR_RBE); >> > + regmap_write(rpc->regmap, RPC_DREAR, RPC_DREAR_EAC(1)); >> > + regmap_write(rpc->regmap, RPC_DRCMR, rpc->cmd); >> > + regmap_write(rpc->regmap, RPC_DRDMCR, rpc->dummy); >> > + regmap_write(rpc->regmap, RPC_DROPR, 0); >> > + regmap_write(rpc->regmap, RPC_DRENR, smenr); >> > + memcpy_fromio(rx_buf, rpc->dirmap, rpc->xferlen); >> >> Just noticed: if rpc->dirmap is NULL (which is now allowed), we >> have a kernel oops >> here. :-( > > Do you patch your spi-mem.c ? What do yuo mean? The only extra patch I have to apply now to renesas.git repo's devel branch is "mtd: devices: m25p80: Use the spi-mem dirmap API"... > both dirmap_create() in your rpc driver and spi-mem layer should handle it well. I just saw that you don't fail the driver's probe() method if devm_ioremap_resource() fails for the "dirmap" and "wbuf" resources... >> [...] >> > +static const struct of_device_id rpc_spi_of_ids[] = { >> > + { .compatible = "renesas,r8a77995-rpc", }, >> >> Why (if it has no differences with the generic gen3 value below)? >> Please remove. > > By Geert's comments in dts, > > rpc: rpc@ee200000 { > compatible = "renesas,r8a7795-rpc", "renesas,rcar-gen3-rpc"; > reg = <0 0xee200000 0 0x200>, <0 0x08000000 0 0x4000000>, > <0 0xee208000 0 0x100>; > > I modified it to "renesas,r8a77995-rpc" because this is Soc I developed and validated. Hopefully this matter is cleared up by Geert... :-) > thanks, > Mason MBR, Sergei