From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8C04345EB1 for ; Fri, 31 Jul 2026 03:11:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785467480; cv=none; b=Ob+RiCYLwoBmReh0WAFO7Tiobr0ytxrKJAr58OPMw3GLNqL7uc/80KtuZTXragJRZB6piF2oJzyxyc70yy4JnybtHetd2ADw9RsWkYn7Mw3TPkNxSkmVWXlKQ5LYNTDKwx5JRv0qZSOZUgWfj28k3YmilRzSSHGYlJdO5wRW3Ks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785467480; c=relaxed/simple; bh=GWIkI1eD5Bk27NjXEiBgjczmLe76dOHKjqJoukzr3qM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=if8qlgmn7Hgl4Mv3W3hkdYlUDGuVxHUb24jUlTtIvWmtVVtaCCg6owEHqUR6+yTmLocsxTCAtrPFjbrATfp3Vxyg8jCnOO+KPlEnG8RQT9ZMwb3t4h2q7J/lrEp4B2aOJlqgZd+nCMX4zGmPWwQQe8yrvTh4paBg+1YUgRGORDQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=maticrobots.com; spf=pass smtp.mailfrom=matician.com; dkim=pass (2048-bit key) header.d=maticrobots.com header.i=@maticrobots.com header.b=Dnxwnknn; arc=none smtp.client-ip=209.85.215.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=maticrobots.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=matician.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=maticrobots.com header.i=@maticrobots.com header.b="Dnxwnknn" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-c9e30214d8fso344441a12.3 for ; Thu, 30 Jul 2026 20:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maticrobots.com; s=google; t=1785467479; x=1786072279; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=+jDUeV37G5tAArJc87hK+jR2T1SQGY2xbZAynKmfam4=; b=Dnxwnknn8WmYsztDCENlyfdapOUfYUPHAuieOdhBbVXJZowXPaE/b60CFOhDeTqxym iCFB9CXkdBLP2tJu6U7/s1NnEpuzPbyH2GzfN+pMvACdpjB4XeRnKWS/kH7rJt57zHcm 1wjqLeYEOLvArXnJxOyjm/m7LjydNH5x3NqgatE698uj5nDTUmJL/vwSwDQ+QhU4q+qc eCzYIaEp1jQa8ygKxW3fIsamkCuZI/Eie6JeJCYTuMYOZreOJiqlIxN1gxtvdx5slUpu vJYn8bs6jSdt0TsfDggi3B45mUtCEoqdeb1gfm5p3NWxGuDuyG52vBr6B63s1EMwK9AD ktJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785467479; x=1786072279; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=+jDUeV37G5tAArJc87hK+jR2T1SQGY2xbZAynKmfam4=; b=Zmk0xtWAP6Gzkrkif3pSj24hVAYA+eKSdola9ZRvJf4nA/rD5M8CPqAWk4OC2ZsbsE dKM9pC80u8Omq9xgnoWVshIDAkav8lJ3X6Ntt1Bf+I5W00iqraEI1zoctiYJxwGuDxjF nuiQuJvvZQ/fvIqMAiUDE2lwkHc1DD0VDm4H+DwOgjZ/iu5Is4vFt2bObot4WhF2NPBy rcN3ff8iOFj2e9JXK9adzOFLFuC//v3WiKUPfIIWfil+rH64qBZfSDEPzA+zWfPZ45U+ 5ifDhSO5YbCaBKjdSbjhc4q/EZooc4ZVcmXryQkRPuwezNFnKVL1S9srciH9VxJUdrli b0jA== X-Forwarded-Encrypted: i=1; AHgh+RqXCdgpOFvxzkc+c/eLkWQCkTMOaid73vtFL6mHvZFQVSElm7IeuSO1pnY2LzxT0GV9N0dsSTdOkaI9J1I=@vger.kernel.org X-Gm-Message-State: AOJu0YyC6kT2ySxWDfbJno8hTrvdwtGpAq/h9QLMIZMChdk6AiuXW5Gq MGR7Bc+gj1FB3P7jIB0W7u4Kbl6eMa0oOFrnD1FEr87LKZ6vMZFL07nXPMw2VSB4Ag0= X-Gm-Gg: AR+sD12O8nq6aKglr2jTGt9sp79WN2gL45XvULvbmn4V0dQz4CwSuoDaukoHCVXLHEP Abq8klkGFoEifhMXuN9u0l0UEbSRs6S+xx7RVJtlSkTUhfI+0zenXolYVyBLLDYYZlo+FkS2pAj Lk/66nMgGyZ6pJMQUSiqtJZC4uGTOl6tvWFURJ9rFAKd+HtmIEo4AwXyUaLUhUmHh2NpCOWsnY7 8j1qSa3PLMAFMQ86vkRzJsJ9Qgm6hkkWRxUigcQ1eWtLm5CjxgEk8CXq6nHcApI9euWDFj++xew JbvS3hKuOz130mEy7ywLzONsZpkVZ/avG4/Q7MfWynHNRdIYEBRVYemfHgIUpAFv3O0ISK87VuF RYT/f5mTlTlGrESpl+Mw48xxZ6c/Py7pq4yAKgUvnq5ZES46Z4WNTdfEacrp4tf20aVujELJbPp rEHVXkMM4lj5wj3BTP0QSJy7/VdjkxnIbtDQwQQyVRs8qROi5qdbQ/+U5y+wVdoINRnQzaxPvSM FBriEqMK8UVu89BBOYAszeZSaO2bvXUb0PXPg== X-Received: by 2002:a05:6a21:730b:b0:3c3:83e6:c705 with SMTP id adf61e73a8af0-3c91b346a1dmr164358637.35.1785467479007; Thu, 30 Jul 2026 20:11:19 -0700 (PDT) Received: from abeMaticDesktop.1020marsh.offices.matician.com ([2600:1700:471:807f:4328:dce4:fe00:16d4]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3153dd4f0f0sm1287eec.2.2026.07.30.20.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2026 20:11:18 -0700 (PDT) From: Abraham Zukor To: Jon Hunter , Mark Brown , Laxman Dewangan Cc: Abraham Zukor , Thierry Reding , linux-spi@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] spi: tegra114: initialize native chip selects inactive Date: Thu, 30 Jul 2026 20:11:11 -0700 Message-ID: <20260731030827.4186208-1-abe@maticrobots.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <0513a557-762e-4390-b5f3-84ac26a38de4@nvidia.com> References: <20260725042944.1204409-1-abe@maticrobots.com> <20260728025503.162543-1-abe@maticrobots.com> <9c196ab1-1945-49fc-a89a-5588d1e50046@nvidia.com> <20260728200316.1363536-1-abe@maticrobots.com> <0513a557-762e-4390-b5f3-84ac26a38de4@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 28/07/2026 22:09, Jon Hunter wrote: > I am a bit reluctant to make this change after 10+ years of this driver > being around. That is fair, and v1 deserved it. I have sent a v2 that only touches chip selects the device tree describes: https://lore.kernel.org/r/20260731030134.4182688-1-abe@maticrobots.com/ The steady state is unchanged - tegra_spi_setup() already programs these bits for each device, so only the window before that runs changes, and only for active-low devices. Nothing the device tree does not describe is touched at all. > Right. Although this patch is specific to Tegra, I am guessing that > other devices could also face similar issues and therefore, it would > seem that having a generic facility to scan the devices would be ideal. The window exists because __spi_add_device() calls __spi_setup() and then device_add() per child, so of_register_spi_devices() runs setup(0), add(0), setup(1), add(1) - device 0's driver can transfer before device 1's chip select has been configured. The comment above that __spi_setup() call already notes that devices using SPI_CS_HIGH "can't coexist well otherwise". Splitting __spi_add_device() into a prepare half and a publish half, and having of_register_spi_devices() prepare every child before publishing any, would close it for every controller with a programmable chip select idle level. The awkward part is that the duplicate chip select check uses bus_for_each_dev(), so it only sees published devices and would need to consider the pending ones too. That is a larger change than I want to put in front of a fix, and it would not help a chip select that never gets an spi_device at all, such as a disabled node. So I do not think the two are alternatives - the core change would subsume the declared sibling half of this patch and leave the rest. Thanks, Abe