Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9478453imu; Wed, 5 Dec 2018 05:33:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/XrmGkjEpGSzC11yf7TPDJ2eZML3NxOThFNaPz1tsJFqTfKgZLypJY4RGPafLaO7umW07JS X-Received: by 2002:a63:2222:: with SMTP id i34mr18833944pgi.83.1544016790511; Wed, 05 Dec 2018 05:33:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544016790; cv=none; d=google.com; s=arc-20160816; b=BqO7LbW3yX9ZSgO0G88kfjJey70QXnuYij16FakrMtWzvrOAbN1yyK97Aea+xyBlte FUSNOjJyIK+EBQk8pMXsMQDtn56hPdB8C1y+kF5iJlvx8SSGx6YZX5rtEfqNfu7JWfl3 PPdhUQzzJJ/uXSDgxzrDZg/kxePgd6XthKMRoukR/EeNP7Mb1MnW685tO+YGLmdY9jBr OOr0h7EJZQs0ngWjtPNPUbEr7qSqgc8kD0OPYdnxJe6yPikNHO1GSdTOaK7zzF9PwtdO 5VzWxKoE/JsAyThddzhe6Zlvm8jH08+fntHEQ/2cHhzMXSE+EndVX+RemKdz18Kx0FO0 jg8A== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=LYSb+llaxXYRjoVrBiJOlfsT/LvhJHYeQceMuoilsUk=; b=WkFq+UvGj0nqGHaZ6gNtPwVGUnCbYfMT6XfPYdiE0FD8KHh8xWhcJ7RZ2d/wEQcikm WjidQytoyYFCmgxm9kVOwf656G9nJ7+kpQuUnDagOPs11YL+MtULAEsZZvGjFp14j8uP L5rxAz4za660ZcyjTMOaHXo0OdWwYgF6lpuNruJFb1ycV5qtCmussupOhlfRitO2asl+ 0YeUhbSrFymrfmsENm+gtwrZKEyXtki9iyAya2Qrc0jbwMXNzLx/v/OM88jsFemSLa/H z4IGXvRmdjFswRVM0N0pIqs+Z5yM8QEcsjkln01colyIc22PRQu253lwD5u3aXSTSVZC suyQ== ARC-Authentication-Results: i=1; mx.google.com; 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 a2si18607474pgm.154.2018.12.05.05.32.52; Wed, 05 Dec 2018 05:33:10 -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; 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 S1727257AbeLENcF convert rfc822-to-8bit (ORCPT + 99 others); Wed, 5 Dec 2018 08:32:05 -0500 Received: from mail-ua1-f67.google.com ([209.85.222.67]:46422 "EHLO mail-ua1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726979AbeLENcF (ORCPT ); Wed, 5 Dec 2018 08:32:05 -0500 Received: by mail-ua1-f67.google.com with SMTP id v24so7075096uap.13; Wed, 05 Dec 2018 05:32:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=57brSFTNVlykh+UrdKCfjSi4UwojTyrs80aykKhHwoE=; b=Hs/wN5bK23Hd9pEoKodYfxYboHTTFHx1JwFw2iSDAbw64m6NEQHFAKMthHQtOGW6t9 ClFzdFfCJXOM6/xNi4sifiICYWJhGBFjwUtm8dupop6E8Q1qlVD0ULAM2mwAlSfheJ2o WePPodymp0Pgg2rQ1WjpSlH3ZkriWV+YBuGGG7nWp2CbG5Rc4ckCdGq3OIgxJG2iuU4X r/8d8DYYg7mR+WmXHH6dIONb6UHEICrhhfSul/zz0k984zCXE0c9b984YNSkfROp2+r7 npqfqWJ4EdWh66RWierlR4VQI+uXTojC3WRUaJYFuSvNRK6Ued+NPRLDy1dqGwusPV6a aJHw== X-Gm-Message-State: AA+aEWZhij5IqeiZoIj4Ow1VDOn5XhcJYSP1meSqr3bJzhf+IbidbfpA zqnKZ4OZTKgXr+/h0KfM/p0eya3Wma2bQFlvxrQ= X-Received: by 2002:ab0:210e:: with SMTP id d14mr11234301ual.20.1544016723259; Wed, 05 Dec 2018 05:32:03 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <8e667f91-70bd-795c-094f-23c919c3802c@gmail.com> From: Geert Uytterhoeven Date: Wed, 5 Dec 2018 14:31:50 +0100 Message-ID: Subject: Re: [PATCH v2 1/2] spi: Add Renesas R-Car Gen3 RPC SPI controller driver To: Marek Vasut 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marek, 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 ;-) > >>>>> +#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. > >>>>> +#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! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds