Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9481195imu; Wed, 5 Dec 2018 05:35:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/VHj0mHBvNKT1aqJVOLRmGkvmJa20/GCip+EdyKJRC6DUeq4PmvDjrh0tPewX8EbNrNQeH/ X-Received: by 2002:a17:902:d83:: with SMTP id 3mr2778681plv.43.1544016937770; Wed, 05 Dec 2018 05:35:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544016937; cv=none; d=google.com; s=arc-20160816; b=Qlnew7ktiP9J7YarB7i9PKhEMsZ1Ljp6YTSZIZ/lFHETYTZtSQRyZw8Sd9PMX8KxJl wp1bmWSDanXA7SnF7KFCLjhLI59YgUZTlchlCJXAwCvMLEZufJSve+f3YvYvUPY0LBuU fkaHWScHQMPFvQSQD/eK/PCnCleDwb9WQt2vrCV9XkFfMVD9gQ6DtcEJTLt0En+CctDh E4xQb8DL4voEXv5QsWVa8tpFho9lzLXisVq7EPH+b9JvvdjK+4fHMjwK3o52AU1uvZxn l1mYMC9aCgC2h+WTJ8jadEZ3z8yVhJ6U2Oiv/iWuUExeZfByfrFEtnVxKO5dB7tagttR ze0Q== 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:from:references:cc:to:subject:dkim-signature; bh=r1OA3q6YJs/OPuN8QenAuS1r1CZLv2kBy91Ys95FEjo=; b=P7SzB2vLE7Ut887RDv8mZkSe3aFCSeeYeoywl4NSLOFuJ9uHOGmjWvjkfMTeKHShvs I9yd3ys1dIXoRatf8TYvWnJSdgHQus5tjpg6YiK5as1ErRlrkW0hWFiER2Uv1bYUp0LQ HCxwyqnQElqJr+6fDOWihUvwdbzPOKbasXOVfM2ARluHChc22Bw4/UEBX1L3lPORNcLD sQWEzAfzuW82uOR58dWAeYAfarag6ThvGzJ8Ia5wEKtJT4a94hrfSZvHtCG9uYVhJ400 phFfcuNLROg9DQDIwYrxU4KSpAEWIQHcRf2VOi0qZQiFiNPRJXNP1XNihHYJDzhjwmqk jKzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Vkhd4E1V; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y17si17803670pgh.353.2018.12.05.05.35.22; Wed, 05 Dec 2018 05:35:37 -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=@gmail.com header.s=20161025 header.b=Vkhd4E1V; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727486AbeLENe2 (ORCPT + 99 others); Wed, 5 Dec 2018 08:34:28 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35193 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727094AbeLENe1 (ORCPT ); Wed, 5 Dec 2018 08:34:27 -0500 Received: by mail-wr1-f65.google.com with SMTP id 96so19740974wrb.2; Wed, 05 Dec 2018 05:34:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=r1OA3q6YJs/OPuN8QenAuS1r1CZLv2kBy91Ys95FEjo=; b=Vkhd4E1VzK2VItiAapmpyqlSukxTetzj4w+daM4C+WsjsvdNbaZJgYbMAS+VeaHS3V 1Fg75cZciw6g3DQkP2L/XHQ43jRZ31a7C69Q2YOLQBvw/V2dDL7j4Mp7DJKF97sJ07IQ 3uiuRY27IBO9skqZRmCoNuooF1qDPpKgY0RFAGY/F44UITiQuLiiTGRX3180+S2ahvcO UMG321H0y7BdiIj4+FBvyzxLnPksZ10CIzHJrRmX6VBvpUu5SNf5pBSEombpYsAQdcJP c5tHQCzS5dYUaKCDivb1kcB6a4DD1wqCzSFb+JZUuRBQiz7NLIm0DWqxZe7VbpmH4FWw MJKg== 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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=r1OA3q6YJs/OPuN8QenAuS1r1CZLv2kBy91Ys95FEjo=; b=NGHEe8IiNU/Mc6U+ycNIlx++jiYgdS6YHlb7ILc1V6H97lokJPsQdpCmMzixDNUVmO JYSPnZOXszjNMrsLy5w3yjEPb/UbK+JxtKd+Hi65gmBv2UA7fdDY56Wh1Wn4/Dw98eVL 9HbgFWQgW8Oaq2JYIyqgTmepm+ZEzF8+EkVGuPMIm9ekRgROZVkLCnS2hT5Dm0/6cFn7 tEcRkEedLvI+B2/YmT2P0idQBipjpDod2pLVpSOEAEmYexpThBRKm3zIu7n4hujyLQq6 vXaKpQYNPqquXLQCkzMOmipScTx5prztgpN2UggY2pypml66KbyzHouaCm/+LSwDOOhi e+ow== X-Gm-Message-State: AA+aEWalPakbIZvgxnz6Xb4o9eJh9v9za7udxnbooL23q8dKlhDf1Nrj p79D9d2QNXQwRG/JcTwGTq8= X-Received: by 2002:adf:b3c3:: with SMTP id x3mr21833150wrd.294.1544016863771; Wed, 05 Dec 2018 05:34:23 -0800 (PST) Received: from [192.168.1.4] (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id c13sm44328386wrb.38.2018.12.05.05.34.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 05:34:23 -0800 (PST) Subject: Re: [PATCH v2 1/2] spi: Add Renesas R-Car Gen3 RPC SPI controller driver To: Geert Uytterhoeven Cc: masonccyang@mxic.com.tw, Boris Brezillon , Mark Brown , Geert Uytterhoeven , Simon Horman , juliensu@mxic.com.tw, Linux Kernel Mailing List , Linux-Renesas , linux-spi , zhengxunli@mxic.com.tw References: <1543828720-18345-1-git-send-email-masonccyang@mxic.com.tw> <1543828720-18345-2-git-send-email-masonccyang@mxic.com.tw> <84e3c55b-687e-28f6-0a7c-1c48c822ef05@gmail.com> <8e667f91-70bd-795c-094f-23c919c3802c@gmail.com> From: Marek Vasut Message-ID: <941aca45-185a-fb99-f5d1-d12b3bcad6de@gmail.com> Date: Wed, 5 Dec 2018 14:34:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/05/2018 02:31 PM, Geert Uytterhoeven wrote: > Hi Marek, Hi, > On Wed, Dec 5, 2018 at 2:25 PM Marek Vasut wrote: >> On 12/05/2018 02:15 PM, Geert Uytterhoeven wrote: >>> On Wed, Dec 5, 2018 at 1:57 PM Marek Vasut wrote: >>>> On 12/05/2018 08:44 AM, masonccyang@mxic.com.tw wrote: >>>>>> "Marek Vasut" >>>>>> 2018/12/05 上午 10:04 >>>>>> On 12/03/2018 10:18 AM, Mason Yang wrote: >>>>>>> Add a driver for Renesas R-Car Gen3 RPC SPI controller. >>>>>>> >>>>>>> Signed-off-by: Mason Yang >>> >>>>>>> +static void rpc_spi_hw_init(struct rpc_spi *rpc) >>>>>>> +{ >>>>>>> + /* >>>>>>> + * NOTE: The 0x260 are undocumented bits, but they must be set. >>>>>>> + * RPC_PHYCNT_STRTIM is strobe timing adjustment bit, >>>>>>> + * 0x0 : the delay is biggest, >>>>>>> + * 0x1 : the delay is 2nd biggest, >>>>>>> + * 0x3 or 0x6 is a recommended value. >>>>>>> + */ >>>>>> >>>>>> Doesn't this vary by SoC ? I think H3 ES1.0 had different value here, >>>>>> but I might be wrong. >>>>> >>>>> I check the Renesas bare-metal code, mini_monitor v4.01. >>>>> It set 0x03 or 0x0 and I test them w/ 0x0, 0x3 and 0x6 are all OK. >>>> >>>> Shouldn't this somehow use the soc_device_match() then and configure it >>>> accordingly for various chips ? Like eg. the r8a7795-cpg-mssr driver does. >>> >>> Please don't use soc_device_match() for per-SoC configuration, if >>> you already have of_device_id.data. >> >> I mean, the value is different on H3 ES1 and ES2 iirc, that's what >> soc_device_match() is for, right ? > > Oh, it differs between revisions, too? > Yes, in that case you need soc_device_match(). > >>> BTW, this drivers support r8a7795 only (for now), as per the compatible >>> value. >> >> 77995 > > Sorry, typo on my side. So H3 is not yet supported ;-) It's coming the minute this lands mainline, so we should make it easy to add. >>>>>>> +#ifdef CONFIG_RESET_CONTROLLER >>>>>> >>>>>> Just make the driver depend on reset controller. >>>>> >>>>> ? >>>>> please refer to >>>>> https://github.com/torvalds/linux/blob/master/drivers/clk/renesas/renesas-cpg-mssr.c >>>>> >>>>> line 124 ~ 126 >>>> >>>> This seems like a stopgap measure for systems which do not have a reset >>>> api compatible controller. Geert ? >>> >>> So far CONFIG_RESET_CONTROLLER is optional. >> >> My understanding is that for this IP, it can well be mandatory, since >> all the chips have a reset wired to the IP internally. > > That's what I was trying to find out, hence my question about the purpose. > >>>>>>> + regmap_write(rpc->regmap, RPC_SMWDR0, >>>>>>> + *(u32 *)(tx_buf + pos)); >>>>>> >>>>>> *(u32 *) cast is probably not needed , fix casts globally. >>>>> >>>>> It must have it! >>>> >>>> Why ? >>> >>> Else you get a compiler warning, as tx_bug is void *. >> >> Don't you need some get_unaligned() in that case ? txbuf+pos can well be >> unaligned if it's void * . > > True, but IIRC, arm64 can handle that, right? > Don't know about SuperH. Oh, that's right, there are SH systems with RPC. Right. >>>>>>> +#ifdef CONFIG_PM_SLEEP >>>>>>> +static int rpc_spi_suspend(struct device *dev) >>>>>>> +{ >>>>>>> + struct platform_device *pdev = to_platform_device(dev); >>>>>>> + struct spi_master *master = platform_get_drvdata(pdev); >>>>>>> + >>>>>>> + return spi_master_suspend(master); >>>>>> >>>>>> Won't the SPI NOR lose state across suspend ? Is that a problem ? >>>>> >>>>> I don't think so. >>>>> Because when the device is not in operation and CS# is high, >>>>> it is put in stand-by mode. >>>> >>>> Is the power to the SPI NOR retained ? >>> >>> Not if PSCI system suspend turns of power to the SoC. >> >> And is that a problem ? > > Good question! That's what we need an answer to :) -- Best regards, Marek Vasut