Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1653698imu; Sat, 26 Jan 2019 07:41:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN5GOCKxbYv+zW3/EByZp03GiK2dmDjQ1UDu1F0fXtjhYk92Rg4w2M0d4dumNvUsB/jWRtJq X-Received: by 2002:a62:f51a:: with SMTP id n26mr5332191pfh.245.1548517270363; Sat, 26 Jan 2019 07:41:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548517270; cv=none; d=google.com; s=arc-20160816; b=P9mKqgtaFUKQ6TpEB75FFGdzLvZhc7YDSXsTGZgCNrpjXHu8uCnXNETfAU/lGJrl7W LJdT2W/w4JNDGBi4prpO0cIslWVUF00YCQBcuQb5qLGbqdmYkNZDNq2WNcvom1bwDqPl ivSYIX+AY4NAKit0U18ftA0iSJ+E0mRI01eb6M1YzxTWCmoOn5CUHe7fck7p8G3bE5fD qAf9s6mZ98l47CYahI34SXco1tz525+cQlxTwYma9kecZs0z4TcMUdCNXk/z2aTzP/kL sq+BGgNLKlS0iFmU4pWbveSr2A6xtPhN4idTMCIJAeKSLjroJ06IulAeI1mokKRc2uUA Km/A== 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=n9uOtldaAXYfuOBU0y5lop4byvLK3ttHaozs3KcP+28=; b=IexZ5sVJPtz3yg03aHV5a2QCZ9YDC9HNqlIntid09a+sv4pOxGijcCq/O1kMj3DvHq YhFKxxMGJKRTRLGtBsem6VHqhdfgcrn2l/7ATQfevRE+LHr1v/c3/iIprbBc6RO6v/wD yVbRIzbqBAWDm9HSv29pJJKDkTAl+A1kja63LaS7jo36NA/+m/gHWQh9qiX+lHgxOPal fp/yBCQOyk3V/bq9i8+evySm+8m/CWY++QDJyByJigwhbkUJO/6Zu0Jx6UW9L4SvGxad j8DJhoXpoMx0vsa2usO10uKfg0Yrlg/CIKlMlU8t5MP6wnU2VFEv240OfQbj/SBhleRF syGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@norrbonn-se.20150623.gappssmtp.com header.s=20150623 header.b="robQn/ml"; 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 t186si272540pfd.68.2019.01.26.07.40.40; Sat, 26 Jan 2019 07:41: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; dkim=pass header.i=@norrbonn-se.20150623.gappssmtp.com header.s=20150623 header.b="robQn/ml"; 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 S1726291AbfAZPkL (ORCPT + 99 others); Sat, 26 Jan 2019 10:40:11 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:42952 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726073AbfAZPkL (ORCPT ); Sat, 26 Jan 2019 10:40:11 -0500 Received: by mail-lf1-f68.google.com with SMTP id l10so8948449lfh.9 for ; Sat, 26 Jan 2019 07:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=norrbonn-se.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=n9uOtldaAXYfuOBU0y5lop4byvLK3ttHaozs3KcP+28=; b=robQn/mlJrzL8bQrIx2coDl2M7m1naNuvcnK2zR6nWwMnuO9AuNqRbf0ZkhWTjckZq udGIXRDrO6Kd+9Iw6qFzFynnycJE9OtUeFdzEqn/11I8f+ObacbPeWMUPIvoce9N+CVW 2l9+1nH1Nujpf8wSgoHYXWd/tmLV0m1YJix+s+Joe4I2/DtkdedGklq/pUf8GUaDihvQ 7qqOf9/9rdJyLC7cH8/lfLtwZpxrLKMzV/h+u+4+HZ8+6iDNTzqEZPdqbm6USDIOGPBC fDZRzzgzA7hyg1mUI24NIigsiKeFVB/wTrUFejrgl2yEtUzhklLRglptIsaZ6YFQGk84 HaJw== 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=n9uOtldaAXYfuOBU0y5lop4byvLK3ttHaozs3KcP+28=; b=iqGolhI8oCZQ2Oe9sVFIVXwEA7aK7P8/+EmwF8LkJFKm3CawvCGHQoMPnH7OuPuWuA T6EObhQLlkdfn5bt6Ld9vxdsMTyjH9/Qb3K27Bq8yyK7hGcFjprjWYUPGrXzsziyW+d0 7Ifm5ukHiF8WdyEz0tMX7eAbWOIx3+B+xzoiYjrPzFXETl79NxviJ/mAZNjLgzx2TY/9 la27/C6E269WLxiOvkTdu0aof1bAI9Cjpi/J4LIBtnkWYXNzFb46zDpQoX7+rVsUUFaG +VfWm+o0hDBGLiiF79aoExd0q9tNX76IpSdcIJ6vv8hpOn5PL4BY6PHO6dtIe3NUHDZI ONLw== X-Gm-Message-State: AJcUukfttbOXq20tRwXIREPlYCo35Liu8xPWXzjzs8y8oKIQz1WtvktA HoB6EXGPGvhbR5psoQfhchSPFA== X-Received: by 2002:a19:cbcc:: with SMTP id b195mr11600705lfg.117.1548517208179; Sat, 26 Jan 2019 07:40:08 -0800 (PST) Received: from [192.168.1.169] (h-29-16.A159.priv.bahnhof.se. [79.136.29.16]) by smtp.gmail.com with ESMTPSA id 15-v6sm2379774lje.18.2019.01.26.07.40.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Jan 2019 07:40:07 -0800 (PST) Subject: Re: [PATCH 1/2] spi: support inter-word delay requirement for devices To: Geert Uytterhoeven Cc: Mark Brown , Baolin Wang , LKML , linux-spi , Rob Herring , Mark Rutland , DTML 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> From: Jonas Bonn Message-ID: Date: Sat, 26 Jan 2019 16:40:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, On 26/01/2019 11:25, Geert Uytterhoeven wrote: > Hi Jonas, > > 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? 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 spi-3wire: again, only set by MAXIM DS-1302 which always needs this setting; driver could set this 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... > > 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? 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! /Jonas > > Gr{oetje,eeting}s, > > Geert >