Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2425060imm; Thu, 9 Aug 2018 12:41:09 -0700 (PDT) X-Google-Smtp-Source: AA+uWPy9jQ5c9yl1OeQlItZ95qHgjCYMU6emTzx2TrNaAKgKoe5yru9x+XQC5dwIhW/T745BftyY X-Received: by 2002:a17:902:9a47:: with SMTP id x7-v6mr3245292plv.37.1533843668991; Thu, 09 Aug 2018 12:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533843668; cv=none; d=google.com; s=arc-20160816; b=a07BR4PH/5hioWtGRC7m4lfFlsz8dVm41FCTjzUloMoqBKvXjrwRwXE8FQgf+fwJhQ oqddPQHAB2RVjU8u4ysOEo0teWiu67ezgDhsFqQTfHUT0rDpvdC/jQSwFuG05kGVFxuo EMypTEvwS6vrJmMgDA9dbFT6zCWRlqIetdtDIwohUXGesdbX9sdtvDMD1TxUJp8JVB0n ZRBXldVR3oeK8LpkJhg6crkPLP3H0/UQty3I7BjmvArXUQSgvUbaU6b3PBJ6m/fJq0/o CS8+r11YRAOov8hFJ80KIr4agmakUAH0I+Qmt5FjhK4QArmk23V6kmF3tpWtFhmlifDe lQzw== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Q/G66rTI3ibq9RNzQInnB3gQg9nv61I5r+XmWb/2OPY=; b=uhS6+8boaqArkytkV62dV92h+DJn6dfo0op1oOIegMNppxIxBZx3OxItfjQS9zh8U6 1GEwB/WnpjvME/fA0fNLLV7zeifmpPo1SqSXzH16GYDoP7YE7VKskguh7DuxUVBvP3IY Xr1ooOVdtnnfWLHEdr5TiJOlIWdktyyNXFCVSGMoNMAUPtYC+skcF6Du2aGAsHQHvW8x fCpYEcwfhOi37dhWY5gLU5CO8Dmm0egd+id3CIEpcFpdZxbr/dlVcConZkoswHU6fHLc QKoa6+/HXOjbIgmyctuKDS5OSIZNVKn9S0eVsHIUJk5GsZcNgGvrGsDNt8cOyOB2C8Ew axHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SOkAVRVK; 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=REJECT sp=REJECT dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d27-v6si8362885pgm.67.2018.08.09.12.40.54; Thu, 09 Aug 2018 12:41:08 -0700 (PDT) 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=@chromium.org header.s=google header.b=SOkAVRVK; 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=REJECT sp=REJECT dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727225AbeHIWEO (ORCPT + 99 others); Thu, 9 Aug 2018 18:04:14 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:40093 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727038AbeHIWEN (ORCPT ); Thu, 9 Aug 2018 18:04:13 -0400 Received: by mail-yw1-f67.google.com with SMTP id z143-v6so6166167ywa.7 for ; Thu, 09 Aug 2018 12:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Q/G66rTI3ibq9RNzQInnB3gQg9nv61I5r+XmWb/2OPY=; b=SOkAVRVKKq53roeye3WQFiSZud2rzT/Yi+OZ4MYmCN1D7fYLaX7uzjek819ZeKWNe9 B9MOMaPn4R+iVwGpMo8CeFtPdOl2fWREihwptlmGm9/9gWM76Zdopmg7VCfD7vRQOgM7 w0eexRmQzx744HJLrXGrgYDsWn7jwkYIac/8w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Q/G66rTI3ibq9RNzQInnB3gQg9nv61I5r+XmWb/2OPY=; b=fk5ZSGzCbePN6ZjLH2C2ze9MXuh4bS/96fnnVi25vDcHr35AwFcBaTS2U2DsssEFoy RfxM9kZlEY5T6p3b3G+iO7Ka6nXdTyl7FG9L1AZbprHmPQeFrVBugFvpyI2iIkfJ+kLy S95xOKDSjPsIgFSdlJoydhDdOxqTAuiaFURJZM9BoDv11gp+1IfR7p8bwObwVnPQm1UR aNzOWyvhWO7c49wCmHd6+GN6xy+CkgiDQdGA6IgL1s9xL8WWPYoBADS+dpV/iKfUJwfk n0tMSdq2apOIRmlg2D4Lm1mitktoue6coXVGI2WyKQ2isDbwV4fNpConcPHKKFjxkyB7 BYUg== X-Gm-Message-State: AOUpUlH/v1PcILzUKW/SbGPQlhGdiOdohp6sp5tUDtBJEwV8O07yokNw qW3mOIjH1bAYQ71x+BLJjb/k2zYPAHc= X-Received: by 2002:a9f:2266:: with SMTP id 93-v6mr2376336uad.40.1533843475469; Thu, 09 Aug 2018 12:37:55 -0700 (PDT) Received: from mail-ua1-f43.google.com (mail-ua1-f43.google.com. [209.85.222.43]) by smtp.gmail.com with ESMTPSA id u25-v6sm1071825uan.26.2018.08.09.12.37.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 12:37:54 -0700 (PDT) Received: by mail-ua1-f43.google.com with SMTP id h1-v6so34553uao.8 for ; Thu, 09 Aug 2018 12:37:54 -0700 (PDT) X-Received: by 2002:ab0:11dd:: with SMTP id q29-v6mr2351191uac.191.1533843473898; Thu, 09 Aug 2018 12:37:53 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1f:cd5:0:0:0:0:0 with HTTP; Thu, 9 Aug 2018 12:37:52 -0700 (PDT) In-Reply-To: <1533839042.2283.305.camel@impinj.com> References: <1525383283-18390-1-git-send-email-girishm@codeaurora.org> <152607782792.34267.8023817955251139395@swboyd.mtv.corp.google.com> <24b3ef71-18c1-1704-e324-5581fd18a998@codeaurora.org> <152700759909.210890.13296077062705155869@swboyd.mtv.corp.google.com> <20180522173000.GG24776@sirena.org.uk> <8968e04c-a200-ef06-5c33-94e399f7b9fe@codeaurora.org> <20180524162940.GA4828@sirena.org.uk> <28d8ab5fdeb34e52eba7ca771a17bc06@codeaurora.org> <61f2e1fb394bfe47ace42352f2e1b3a6@codeaurora.org> <1533839042.2283.305.camel@impinj.com> From: Doug Anderson Date: Thu, 9 Aug 2018 12:37:52 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] spi: spi-geni-qcom: Add SPI driver support for GENI based QUP To: Trent Piepho Cc: "dkota@codeaurora.org" , "linux-kernel@vger.kernel.org" , "swboyd@chromium.org" , "linux-arm-msm@vger.kernel.org" , "sdharia@codeaurora.org" , "broonie@kernel.org" , "linux-spi@vger.kernel.org" , "kramasub@codeaurora.org" , "girishm@codeaurora.org" 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, On Thu, Aug 9, 2018 at 11:24 AM, Trent Piepho wrote: > On Thu, 2018-08-09 at 11:03 -0700, Doug Anderson wrote: >> On Fri, Aug 3, 2018 at 5:18 AM, wrote: >> > > > + if (of_property_read_u32(pdev->dev.of_node, "spi-max-frequency", >> > > > + &spi->max_speed_hz)) { >> > >> > >> > > Why does this need to come from DT? >> > >> > >> > This is required to set the SPI controller max frequency. >> > As it is specific to the controller, so looks meaningful to specify it in >> > dtsi. >> > Also, spi core framework will set the transfer speed to controller max >> > frequency >> > if transfer frequency is greater than controller max frequency. >> > Please mention if you have a other opinion. >> >> Here are my thoughts: >> >> 1. It sure seems like the clock framework could be enforcing the max >> speed here. SPI can just ask for the speed and the clock framework >> will pick the highest speed it can if you ask for one too high. Isn't >> that the whole point of the "struct freq_tbl" in the clock driver? >> >> >> 2. The device tree writer already provides a max clock speed for each >> SPI slave in the device tree. ...shouldn't the device tree writer >> already be taking into account the max of the SPI port when setting >> this value? > > No, the way it works is the actual speed is the lesser of the master's > max and the slave device's max. > > But usually the master's max is determined by: > > 1. The input clock the SPI master device, as provided by the clock > framework. Usually the max SPI clock will be this clock /2 or > something like that. > > 2. The master has some maximum clock as part of its specifications, in > which case the driver basically hard codes it. Maybe it is different > based on model and the driver has a table. > > The device tree isn't really meant to be a way to remove all data from > the device driver just because it can be, or shift work from the driver > author to the device tree author. > > So, one shouldn't specify the master max in the DT if the driver could > figure it out. > > Sometimes you see a field in the DT and I think the thought process > that put it there was, "I don't understand how to set this register, > I'll just stick in the device tree and then it's Someone Else's Problem > to find the correct value." > > The max speed that some board can talk to a SPI slave might be from the > specs of the slave device or maybe it's due to the traces on the board > itself that is the limiting factor. In the latter case the convention > is to consider this part of the slave's max speed and put into the DT > in the slave's DT node max speed property. > > So the same spi eeprom chip might have have a max in the DT of 20 MHz > on one board, copied out of the eeprom's datasheet. But on another > board it has a max of 10 MHz because on that board's layout it only > works up to 10. I think we're in agreement but perhaps there's a miscommunication here? I'm saying that we _shouldn't_ put the max-speed of the master in the device tree. The max speed for the IP block ought to be in code either in the clock driver or in the SPI driver based on the compatible string. ...as one argument _against_ putting a max-speed for the master in the device tree I'm saying that we can already specify a max-speed of each slave in the device tree. The max speed of the slave should take into account whatever factors are specific to this board including trace lengths, noise, etc. If we somehow did need to get a max speed in the device tree it seems like we could just adjust the max speed for the slave to be something lower. In other words if you know a board has an sdm845 on it and you know that the SPI clock on sdm845 can't go over 50 MHz then it would make no sense to suggest that we should run the SPI clock for a device at 100 MHz. -Doug