Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3181688imu; Sun, 27 Jan 2019 23:43:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN5rgLE/nmSA9AgftTavhh5cqZF01Idnt44lrqq0kg6i23l/Wxfa2lMw91LxnJbdAZdJQXOk X-Received: by 2002:a17:902:b282:: with SMTP id u2mr21112355plr.89.1548661381526; Sun, 27 Jan 2019 23:43:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548661381; cv=none; d=google.com; s=arc-20160816; b=I2+6DsIXFamM2F6dxPD2zMGTlG1dgJRMECAyaAfdZTumsK5HXWxyWFyf9583TQ/fHm g5jX0cLjGHpRX657TAmQlxlZq1IGrePg35REtbdr+h5/4Tq7p0RvM/R41IBXiSPet1SU Zg9HbH6V5O24txUby+eTtSPH8IsHS0WJAxWo9tAqV+hstPTwlBuEW98oHZU9HvsjrVBF L3JmGjorOAsTull4eLq2YFm8oLOJA5BiUfEagX7zPkStupJpslwcbmWJIiMw1iO+D4wq 6sZtDpM82PYiGAQ82hJudQwlpwSSweNqlXq5RpRg8+ieP6cPFD/p1ZF8PClVtcIItLSQ sfyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=Q3hMp/k6lyJ2mMVPABphaPNzEClKY7IR08jEaMktiXI=; b=Sgs9nlxQ/QMfPJfDvHe1oCtqmzPzxheb7q7AJj/xRmy2i7x/iAU6FcXdvxr7K8xdTS 6jX1I3C8VnW4Srqg4NXT3aORl6N2/9dJp7dipMevDjmfduFq08u3uGsX8gh+8x9e8U/i r7ED+3pchnbkkTJyA7TDqZPiJ3dlirlDul44KRLVg3FpvGHVhXZyMLpZX05LqZ8124Ix aU8rRMun1L+iy34k3glyDaCFsGqsXw0CyDf5n2g7e56MczzZ8Cbev91OnKzzkdSClYnb FTxNv063wO/czU7c8P96JRP6qaR6y/877vhMrk/S/qOEEuk8WuWz5fRnmQB/1051LVY+ dpNQ== 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 x14si31097929plr.378.2019.01.27.23.42.46; Sun, 27 Jan 2019 23:43:01 -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 S1726693AbfA1HlT (ORCPT + 99 others); Mon, 28 Jan 2019 02:41:19 -0500 Received: from mail-vs1-f66.google.com ([209.85.217.66]:44472 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726630AbfA1HlT (ORCPT ); Mon, 28 Jan 2019 02:41:19 -0500 Received: by mail-vs1-f66.google.com with SMTP id u11so9174148vsp.11; Sun, 27 Jan 2019 23:41:18 -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; bh=Q3hMp/k6lyJ2mMVPABphaPNzEClKY7IR08jEaMktiXI=; b=FLp/dTtqy3s5xEWOlzRoVoMBD+rwBWig/mIAB3qJYln0RUxOrprzUMmDXm9teD2Iuk nyew3ldQGXfzneJfMssxnUOU0B1QhO/Y/zLcwa0BIbqL3zXaaUddsPxekMfT9Tao+54x W60DEwVXUkMroCVIPwXPw3I7uA6s7WZdAUC3CPmCdwdDCOPyrUTTPi0SXnL1QWuM5AKm aAO3evitFjk34GlEo0W78biVnQdDnJawUNhW0MkkObKYETCZ1LQPc3LGaq+Mp1/JtPr1 zHMtlcj9eTrry7IURk5kbB4T0BxutCuBgGKDVqmhKQhZjGiBvpaLRV96mbDAP83LMHqw KAOQ== X-Gm-Message-State: AJcUukdO2y3mnvGTCdrrFqLKCL/ynVEnT3ncgupePolODOd+wVf6qOY9 k/vsMBqkel5nxnLYD+fcUndrO1Go3sm6Ml2W0fY= X-Received: by 2002:a67:c202:: with SMTP id i2mr8117148vsj.11.1548661277503; Sun, 27 Jan 2019 23:41:17 -0800 (PST) MIME-Version: 1.0 References: <20190125114429.20066-1-jonas@norrbonn.se> <20190125114429.20066-2-jonas@norrbonn.se> <20190125174713.GA6939@sirena.org.uk> <20190125175031.GA25898@sirena.org.uk> <84d6c40f-62bb-fd00-0dcb-d2f390b136c1@norrbonn.se> In-Reply-To: From: Geert Uytterhoeven Date: Mon, 28 Jan 2019 08:41:05 +0100 Message-ID: Subject: Re: [PATCH 1/2] spi: support inter-word delay requirement for devices To: Jonas Bonn Cc: Mark Brown , Baolin Wang , LKML , linux-spi , Rob Herring , Mark Rutland , DTML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jonas, On Sat, Jan 26, 2019 at 4:40 PM Jonas Bonn wrote: > On 26/01/2019 11:25, Geert Uytterhoeven wrote: > > On Sat, Jan 26, 2019 at 8:53 AM Jonas Bonn wrote: > >> On 25/01/2019 18:50, Mark Brown wrote: > >>> On Fri, Jan 25, 2019 at 05:47:13PM +0000, Mark Brown wrote: > >>>> On Fri, Jan 25, 2019 at 01:06:45PM +0100, Jonas Bonn wrote: > >>>>> Having this as device property rather than a transfer property allows this > >>>>> to be configured one time in setup() rather than having to fiddle with the > >>>>> configuration register for every transfer. > >>> > >>>> That doesn't mean that the coniguration should be done in DT though, and > >>>> given that this presumably is a property of the device there seems to be > >>>> no reason why we'd have it in DT - if every instance of the device is > >>>> going to need to set the property we should just figure it out from the > >>>> compatble string instead. > >>> > >>> To be clear here: the suggestion is to add a parameter the slave device > >>> can set in spi_device which sets the default word_delay similarly to how > >>> max_speed_hz works. > >> > >> I'm confused... isn't that exactly what this patch does? It adds a > >> field word_delay to spi_device in the same manner as max_speed_hz. > >> > >> I also added the ability to set it via DT, which I can break out into a > >> separate patch if that's an issue. Or is the problem that it's set via > >> DT, at all? Documentation/devicetree/bindings/spi-bus.txt documents 10 > >> other slave-node properties related to transfer characteristics; > >> word_delay is just another such characteristic. > >> > >> But again, I'm having trouble parsing your response Is the patch wrong, > >> should be broken up, or you just misunderstood it? > > > > IIUIC, Mark means that it may be a non-configurable property of the slave > > device, and thus should be handled (fixed setting) in the SPI slave driver. > > OK, so given that the "compatible" property identifies the hardware and > there is no other _hardware_ configuration detail that affects the > required inter-word delay, then setting the property in the device tree > is not allowed as the driver has enough info to set it properly. Fair > enough! > > > > > Compare this to CPHA/CPOL, which are properties of the SPI slave device, > > but which may be configurable. E.g. many SPI FLASHes support multiple > > configurations. See e.g. commit 9c5becce21af35e5 ("ARM: shmobile: koelsch: > > Fix QSPI mode of SPI-Flash into mode3"). > > There is nothing about the hardware referenced in that patch that > enforces either mode. Why does the driver get to defer to DT here? The default is non-cpol and non-pha. The device supports both (perhaps even all four modes, didn't check). > Looking at Documentation/devicetree/bindings/spi/spi-bus.txt: > > spi-lsb-first: used only by MAXIM DS-1302 which is always LSB first; > driver should set this For DS1302, this is probable true. For e.g. a generic shift register (e.g. hc595), the driver cannot know. > spi-3wire: again, only set by MAXIM DS-1302 which always needs this > setting; driver could set this For DS1302, this is probable true. Some devices may support both 4-wire or 3-wire mode? > spi-tx-delay-us: > spi-rx-delay-us: only parsed by RMI4 driver... no DTS files in kernel > set these. I hardly see how these are "hardware" settings rather than > message settings, but the driver can set these in any case. > > Anyway, the point is, looking at the current documentation, it's pretty > difficult to understand whether devicetree is restricted to describing > hardware or is also for configuring drivers... True. > > Again, max_speed_hz is something different: while both the SPI master and > > slave may support high speeds, board wiring (capacitance/inductance) may > > need to force a slower speed than supported by the devices, so it makes > > sense to make that configurable from DT. > > Yeah, that one make sense. But if the DT is only overriding the maximum > device frequency that the driver should otherwise be setting, why is > spi-max-frequency a _required_ property? That's a good question. Legacy? > Thanks for taking the time to provide the additional explanation. I had > to ruminate on it for a bit, but I think it's starting to sink in now! You're welcome! 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