Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1060046imu; Wed, 23 Jan 2019 10:05:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN5W5vVk+geNaxe5Dr8NT5BBV1+11CeajWEu2K5MNsuE+dJ853Zzo6wfIH+9mg8KXaSSI2RG X-Received: by 2002:a63:8c0d:: with SMTP id m13mr2893776pgd.422.1548266709924; Wed, 23 Jan 2019 10:05:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548266709; cv=none; d=google.com; s=arc-20160816; b=0vUoLrty1+ps+Z/Fnm6JtZnfGHCKDNUmiXLRX9oad6vKkeisAmUR7iqIrJ+KnhGFNR xhHid11wGc6vbjP15kou+bc7bQfH9Vz3C3C1JqH9g4ht2ITdWa4A+yvSIZoezaRV3KHi OubvRbbVhoBqzhQ8dxhw8dJdY8bz+Wntp3K+uobuUO7TuONntz8ZbNYCZKD5HWzVyRWw OJuLWb3QuUCvqee4mIvOkgZMcC3PwSQN9LDvUzxdARShoFqFVeAfod/tIn73hYxWoyS7 IWThLEgPxX28MZ6PrC3HRYHBTTiSjKR7xCsyqCzeI40dHG3XEtmxOlztmWizgHzsqLvj v/MQ== 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:references:cc:to:subject:from :dkim-signature; bh=l6zEXssNlGT1HWDNuFNUCJZIK/aDeBC6op2m8ToZv4E=; b=pX0Kh0qx4HDXSmkDFrPFqyp+RGLswcQbDCswTdREual9xgCslkN6yudct7BgK4WZ2p u1lQWOYshhu8ZVR9Y0a/mAEq+H1rEKlU19pVfH7OwkUchXSawDmvsWHhJEKu1GYbzMe8 4tQ2G0BMY4oO8Rs6+6jARqsw/FZlaChMMx/p8Ag9lLwCyISev2D9FFnZAPX93M53sme0 vshFhpZzyPr2rAD6ilbYTsV8mZrCorwR80wmof57tIJPvdHwyP4Yacv0jNIcbgErBbWm Z/cgMWAtyepAdu6+gkzaUBrMAxXyNSsNtJ3qQnfXmVTpvkxljNv978XyxObyS7l4ANzs Rf0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=Lpg3V3zO; 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 t3si19457247ply.126.2019.01.23.10.04.53; Wed, 23 Jan 2019 10:05:09 -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=Lpg3V3zO; 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 S1725996AbfAWSEc (ORCPT + 99 others); Wed, 23 Jan 2019 13:04:32 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:41419 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbfAWSEc (ORCPT ); Wed, 23 Jan 2019 13:04:32 -0500 Received: by mail-lj1-f195.google.com with SMTP id k15-v6so2762360ljc.8 for ; Wed, 23 Jan 2019 10:04:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:references:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=l6zEXssNlGT1HWDNuFNUCJZIK/aDeBC6op2m8ToZv4E=; b=Lpg3V3zO6brwyDW140XtZPrpVgWNlJ8HeWr3l5lfzFOOZRwhHF96WTkXloFaWAsu8j DlhgLOGDgNgkJbJRRCgfwiZKhzfsDyfH8/bkEoBsEgsuQPLbOagQC1jEDks/uaZLQoWv NDH/qdCfIsJm62ZKSRKqxE89braxGkwHXNDTxApkQ2Sym9/erK2YS3GSFlkC0L6vnqWq /YFTNPyorP/SoT0I8hbRgqh1SF3nx/Te9e9hP1FabWExvnx7kNBQxrpKfCZFiRNCaHt8 Nf+Ey+KvpPZyMzmc4GeMtfPsIDB17vuLdCB09prvis6zDx6Yu+x89LliPGfQfqN+pWy0 p3AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=l6zEXssNlGT1HWDNuFNUCJZIK/aDeBC6op2m8ToZv4E=; b=IpR+CBbWSdwFg1JGPr3oLlSmjKPzhHuHw5QNWEe5I2RcebRt0+Vo1qU6x5rj7MYNii sFWd+O+sNi9U+jsiQz4rKs813RODzxW/NuQNwe74E7GCB1r5oWKlZNXBhVe6E0Fd6GLq djfe/v8wL2E/ddhXER9xSw6FuWQFEdhUK/dW7Ly2VaFaGQ5fNzbOC8uzBZ7h0KQ6shiU vZDnOZZtRyKvoZB+TZz4fCT0mvxUE0nPrLAyuenG7FblfIhDlCTa49xfBZFRB/26Kag4 74Flo+ESwUYHNHCjOmmu7jKFaKy4gvyG880aBy3ECMPFSE2E8FdkJuTAuseyWyQGxVF0 9uXA== X-Gm-Message-State: AJcUukeqGXp+N5wbdquibb7j6QvNz24RyPcsUQnpBBQwlh6Iy7X7+IbA 1JIjIcGI6uf0U9BuN5xQWP2YCw== X-Received: by 2002:a2e:2246:: with SMTP id i67-v6mr2890912lji.154.1548266670222; Wed, 23 Jan 2019 10:04:30 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.84.180]) by smtp.gmail.com with ESMTPSA id x24-v6sm676916ljc.54.2019.01.23.10.04.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 10:04:29 -0800 (PST) From: Sergei Shtylyov Subject: Re: [PATCH v7 1/2] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver To: Mason Yang , broonie@kernel.org, marek.vasut@gmail.com, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, bbrezillon@kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Cc: juliensu@mxic.com.tw, Simon Horman , 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> Organization: Cogent Embedded Message-ID: <12af2632-491d-0e01-66c9-0ead4f9d985a@cogentembedded.com> Date: Wed, 23 Jan 2019 21:04:26 +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: <1548227352-14910-2-git-send-email-masonccyang@mxic.com.tw> 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 01/23/2019 10:09 AM, Mason Yang wrote: > Add a driver for Renesas R-Car Gen3 RPC-IF SPI controller. > > Signed-off-by: Mason Yang > Signed-off-by: Sergei Shtylyov [...] > diff --git a/drivers/spi/spi-renesas-rpc.c b/drivers/spi/spi-renesas-rpc.c > new file mode 100644 > index 0000000..0127f25 > --- /dev/null > +++ b/drivers/spi/spi-renesas-rpc.c > @@ -0,0 +1,805 @@ > +// 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? > +// > +// 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. :-( [...] > +static int rpc_spi_probe(struct platform_device *pdev) > +{ > + struct spi_controller *ctlr; > + struct resource *res; > + struct rpc_spi *rpc; > + struct device_node *rpc_if; Don't think that's a good name. Why not call it 'flash'? > + int ret; > + > + rpc_if = of_get_next_child(pdev->dev.of_node, NULL); > + if (!rpc_if) { > + dev_warn(&pdev->dev, "no spi-nor device node found\n"); How about "no flash node found"? > + return -ENODEV; > + } > + > + ret = of_device_is_compatible(rpc_if, "jedec,spi-nor"); > + if (!ret) { > + dev_warn(&pdev->dev, "no compatible spi-nor device found\n"); "no SPI-NOR device found"? [...] > + ret = spi_register_controller(ctlr); > + if (ret) { > + dev_err(&pdev->dev, "spi_register_controller failed\n"); > + goto err_put_ctlr; > + } > + return 0; > + > +err_put_ctlr: > + spi_controller_put(ctlr); > + pm_runtime_disable(&pdev->dev); > + > + return ret; > +} [...] > +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. > + { .compatible = "renesas,rcar-gen3-rpc", }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, rpc_spi_of_ids); [...] MBR, Sergei