Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp389427pxk; Thu, 3 Sep 2020 02:23:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCsVrJ0q0P/7RgDX3fey5G2pq6bc2hgLOoWfdsSAth18Q907u8fVeNyGt0ksLf0LUDAwhZ X-Received: by 2002:a17:906:2e83:: with SMTP id o3mr1225525eji.47.1599125007814; Thu, 03 Sep 2020 02:23:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599125007; cv=none; d=google.com; s=arc-20160816; b=OpsWqexMZHu7AC7OMECxVZ0Kc04PJjrZrGi6Wa/57oQZKaPtHC7l1j1rfIpS/+aBVm 7G0i+5OclKtZ4hN0st2uC+fCMb7asQJfj02r0BpXhJ5nQAgD+oEsks42ZKfMUvpsGdh4 FMocD17KACBzYvI+0OT4KSPgUyw8VMJX3qBM2AF0R3ddSqXGEo2sTK7TNbCTWfORlkEE Xm59U6rnVY7nCcBZYmKWoTR6EKnVg/mND/zKnPT3Sr9B4lhdv+zv7a0OAky3NQvs7BzC z6n/cEsVvC4MB1GBJSbHIa7hVJCo853oXzqnNIDDVnjM42rkFOf/fIRosjjaL+fs/vAS q1zA== 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:mime-version :date:cc:to:from:subject:message-id:ironport-sdr:dkim-signature :ironport-sdr; bh=NPx6ZjAe5jOEJjxWtZfDhqYMvIshDBIi+g2FLcTm4Bc=; b=ZnHNEvsg4WFo31IGC1jjDuu2bwAMenXzTDnDeZUAsbWQJ1cOLo/eQeUBX7XzSV+Db2 iG46LpEJviYwcdaZC5SozgD6vj2wBLrT2aLY6U9GOPYVjgxp6FcGDYCjPMu1kEIapezF +pGYUG81vRYIWBg/GKIMVdqvY8HdEW0pM5rqNxA6DzHHi6wnifRqr8Sk4Llb1oQXMkGG qgUrSeKzr/8IFWyViRQEhCZNtiGEaxUb2ZHsvWsxWrDf2A1IqW+ZXsQxUt9Fz7lgSm3E 1UsVRrB/U+x1BvoVPo1JmArD7BYFr95iKXsydzGO5efZgh0dVwbVHfmuWrlvNLGIBiMc lKLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@tq-group.com header.s=key1 header.b=lajE3Og9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb19si731640ejb.589.2020.09.03.02.23.04; Thu, 03 Sep 2020 02:23:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@tq-group.com header.s=key1 header.b=lajE3Og9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727051AbgICJW3 (ORCPT + 99 others); Thu, 3 Sep 2020 05:22:29 -0400 Received: from mx1.tq-group.com ([62.157.118.193]:25027 "EHLO mx1.tq-group.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726047AbgICJW0 (ORCPT ); Thu, 3 Sep 2020 05:22:26 -0400 IronPort-SDR: pdeeloJ54OPb7Op3vser7vOX1+rTJtZZ1GuyM3nNgDq5DaI15qbA+VrXhJb6CcD2CzAnmnsr2Q kbXeIK/NpCuD0PeqRv0C1RRTeBv9Q4/Nto7p7Jsu1A0ClqPZ8yZBE8wu3gEUcqk819zASpMaaM jw3pbW1m5y/HAXOdsBgSzuGHIrH0arCFBgOQIvZKafKlMvjFi1k7yqQ4a/SuZAgWsswIp9AAUR bca/oTL1izsyZHhymZHBejCnyZ25MkrBeqUl+uNj+Ctf/Pdh6AyYk/DJJjKRyIt9cCf6CqG8/9 Khg= X-IronPort-AV: E=Sophos;i="5.76,386,1592863200"; d="scan'208";a="13715495" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 03 Sep 2020 11:22:22 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 03 Sep 2020 11:22:22 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 03 Sep 2020 11:22:22 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1599124942; x=1630660942; h=message-id:subject:from:to:cc:date:mime-version: content-transfer-encoding; bh=s8a9bCwMLw0I2Lg6Q5nlLZokrFRZUgY6ANn6+w/KaeA=; b=lajE3Og93UGjbXpnM9WypLlNFCG3yMsuJso67FGdphE/DOqY+wLhfFZw va0UPc2q4auSq1gg2QoXIQf+PuJXT2/3ldbswl3qFVaeqqg0N3tiYt9eA VSGmvow3ZcZLlPTTWdKhgVapz4nWpMFHxovI0bZTrTsADj6+0h+6JxdEU JwV4UCbn6YlAbANiTzokSfjppVcFuoS7e1eiMS/xqA8+ymB49nFc28aAe 9ORN/oQeKQMHtn+XBhwoZaUxoJG7s0CZOWEBOeCcJZqGUuCruc4oCa74E yDBXaXW792SxYmlV1VmHwIUSDBvttiG4UksIduTh+GgoJ+oJKc6mGsAap Q==; IronPort-SDR: 5ZZ9GdricVMGj1PMBUoT8p4cMdUvNIAt2jbwWyvvaFmU+0w65okwpOLTfL2GYrRiYEI4NPufU1 +e4pnUfmgRLxs/CR9I7+7k2Jt9G+Tae5lc6WgK6JH/l9+uoQGMVbx8Qk6dZFw1amQ+n6ZgD9jb t8WWe7/VvtN9SIBdSpsgjLA5s78mByhb24WDrEsDOXXdguMO3hGJdBDyNLZlfTsu5zQIJcwvTt DM6OOwKdjB2mk5HFvuINQ0HrN9/amRdyJXHi6bXE+h5hLtWqvt9KOjDsUh9E0SBTaz9Lbda7fj eII= X-IronPort-AV: E=Sophos;i="5.76,386,1592863200"; d="scan'208";a="13715494" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 03 Sep 2020 11:22:22 +0200 Received: from schifferm-ubuntu4 (unknown [10.117.49.26]) by vtuxmail01.tq-net.de (Postfix) with ESMTPA id 5344C280065; Thu, 3 Sep 2020 11:22:22 +0200 (CEST) Message-ID: Subject: spi-imx: correct interpretation of num-cs DT property? From: Matthias Schiffer To: Mark Brown , Rob Herring Cc: Shawn Guo , Sascha Hauer , Fabio Estevam , NXP Linux Team , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 03 Sep 2020 11:22:20 +0200 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I've recently had a discussion about the correct way for an SPI driver to handle the num-cs property: https://lkml.org/lkml/2020/8/25/184 Since 8cdcd8aeee281 ("spi: imx/fsl-lpspi: Convert to GPIO descriptors"), the logic of the spi-imx driver is somewhat confusing: If fewer than 3 cs-gpios are defined, and no explicit num-cs property exists, the driver will set num_chipselect to 3 by default, instead of the number of cs-gpios entries. To avoid having to specify num-cs when the number cs-gpios would suffice, I suggested to modify the logic to the following: - If num-cs is set, use that - If num-cs is unset, use the number of cs-gpios - If num-cs is unset and no cs-gpios are defined, use a driver-provided default (which is 3 for spi-imx; this matches the number of native CS pins in older implementations of this SPI controller; i.MX6 and newer support up to 4) Also, would it make sense to add num-cs to all DTS files for boards that actually use fewer than 3 CS pins? At the moment, the num-cs property is not explicitly documented for the spi-imx driver, although the driver understands it. I also suggested to add this to the docs, which Fabio didn't deem a good idea (I don't quite understand the reasoning here - isn't num-cs generally a useful property to have?) Kind regards, Matthias