Message ID | 20240215180102.13887-1-fancer.lancer@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-67460-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp19516dyb; Thu, 15 Feb 2024 10:02:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVfmRds3guUWhRGbZD937Lz0C9ylnNxSt08lYYs0fzwIY+MJ+3gGOFPzwJZ+GRU0PDYRvtVtJJp6pcuc3Zfh8DhpQznzA== X-Google-Smtp-Source: AGHT+IH0JwrnEAZhFCE3Ckux2nDfjgx4EtMths0iHdO0WHDySmb4xqVZzHKX10rLyaosd6Qbz0gP X-Received: by 2002:a17:906:a881:b0:a3d:8466:d355 with SMTP id ha1-20020a170906a88100b00a3d8466d355mr1831547ejb.19.1708020139786; Thu, 15 Feb 2024 10:02:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708020139; cv=pass; d=google.com; s=arc-20160816; b=FWbDH/GOEAJjS3Toi2d1jBaxRRV5gYRW3h3AK8mN+G5BmAwt2zO7bSczSZO2ajE2GM 4txX2CwWSbCOpuyE/377IDhyqGzR9wl7OzKDLvuGA5GKc5REGg/571bvSwSrBe/kjwgI rwVdUM9o8R/8eBE+7ed3dF/sn+h5M3FnE0Qw0XWlV9wN9bM5vyZP/tp8lI64YRXyBGvr 8AgnNAUuM9i4YPIWBRef9D6nnJtpNBFnBUf+ikU1yeirUIK6Z7hPd9Jk3JMU/rQYNWBx FzN8SONAvVxOyLh0jZ5APby/YNQuxDLRkM3Z3zcAAxnEBl+/sSuFwssbo/ox+OXsdNgz Lhjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=DM527n3CwiSmkbi18txMgMFI0Ds898Ao/4BpV0UAhnw=; fh=cQnV7VYAQV7TFtcUtlMxbjQXGIkxQLbfbcfzXGmb6g8=; b=OVMHM2GWxvGwDxc+SztXiooKU6Q1HYB8ehnFWjnQFSCfNL4IV9uQyXbgBjHHpQdlzr Hsq9m25NoLKDBkpywhErr6QhtOK9tHVRGAykypOdR0pJK7BPXv5GnDxsmgrif/QPFoKs 2WHWGtdvyzinCtbs+ChiC4GKq56fK1cJFPEG24qcgB5uT/sIC0t+79RQwcTZjpxTUr8M ezb4Lopjnp/noKHLBqXjLfBZ+HZnFe65hgtLXq2C/t40krW1Sx463LZNk1PIlwHnhcYp AQqFWdRSN+zy+JqMBOvZkH9hSEmYHiW7+16DWmfHufHTYDgTPnqG5KFIX/EU6BgpTJwQ oGbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k9++1qVh; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67460-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67460-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lf29-20020a170907175d00b00a3d5be137e7si799045ejc.787.2024.02.15.10.02.19 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 10:02:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67460-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k9++1qVh; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-67460-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67460-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B62411F25F6F for <ouuuleilei@gmail.com>; Thu, 15 Feb 2024 18:01:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7230A13849A; Thu, 15 Feb 2024 18:01:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k9++1qVh" Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (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 D6F0A134721; Thu, 15 Feb 2024 18:01:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708020085; cv=none; b=fQV52bVYm3cPiWsJMWwgI3ox2q48jqddsqN6hARkK6SnwhCUyr0DG/StOPNEHGKx+CBBHPW/FtQt9yP59Ttug5lCpXS0ocjOVEcIfn9nwnpW9rDYl8ugIt2w55BachMmqhgIkoJC8wHBAE9iRidvUt4Z4FOLK5vDv2S+OhE40YI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708020085; c=relaxed/simple; bh=uOCFg9KS9aHD7BrnsfKkEPzwjTcKv414Q5O985BCAN0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KGCvAFx3wLdJkP3kbC0kh60lc4w+JYMuO2x11hYZS+afLz5Tg3Y+tECZVmxcs2SwMFOcIYgGH2a8jVmd1ePsdNiDrIsGDH9SQHO9WPxJ68PXZBADRZTR0iq6GVuDlCjiwvZabJR9S36fYIf19G3GKUqElP50DTqh5I0z5Xs6s8o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=k9++1qVh; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-5114b2b3b73so1365286e87.0; Thu, 15 Feb 2024 10:01:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708020082; x=1708624882; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=DM527n3CwiSmkbi18txMgMFI0Ds898Ao/4BpV0UAhnw=; b=k9++1qVhkLFXpfrpEEGRrUVo/sHuDxRqQoyqYD4L2vOBMzv7nrviMyjZtpnEe2LGzt SH9VuNHdNcdmayXGaEcLdz8aodbIAU0VO3Clvs2dv8WrDjkq+CGQwNfYFIt4XJ9EdisT DCyIoNYSs5sOqxDsJcJxLKoRSLcFa6Aqk5sM18YpK2rZKlEweD/Mw3KT1JiYYDuyYBeO HSjwIBkEo/RSgKr/ZpXgO5T61atIwBOdiv1cuWfbedA4W9kZNy114cgaf+1lWetEIMvc sBKaYi8GbcF9uYZ4+MhPBlMXWZpcxOg9zXiI0Db1KVmuegOm+pPLL4pFlso25/xX6PcW w80w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708020082; x=1708624882; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DM527n3CwiSmkbi18txMgMFI0Ds898Ao/4BpV0UAhnw=; b=vqui37qX3A/0R+tuvf11UiAa3cctPN2Y3VWS1lr8jKfL8KQboK5RrAg7MPndKkzsSC D+ZT8E7Z7jQx9+FFQoBZj3vs5UL6IhR4+rHeULNcRfhO4KJqAOstjus25hL8Xffk8a8I bBlxbRKrjm8fkvcmpLSCyXQ9g/mKbeHZQj0dSop0V605XpBX0AbuFR777sv9gj5kNnsn HK16ZXG+miwltToED2MNZauY1dU72ZtandWaq9YO3vJhMBOeoJlDe6XXOiWifL6o2shd svJhmXVtQZQRPpeB2iywhGubNAjQHvKpDFLTlpAM/07XjHri6cG0hmrFtme1V+O6FJNl M5HQ== X-Forwarded-Encrypted: i=1; AJvYcCWQv0VotSzGPJh3xo2o27Kbbf1BPNQ5qh/ktFu/q1Dzvoi7GIAIyx53qbfCzZdhu7LVBC6V7fko33LZ5wku7/j14HQQcTiFRABqnjujCzgLRetbaxwA4NheeqRZUHT9DyK/mXDpH0yy X-Gm-Message-State: AOJu0YwCN6xDtd0rP+gKOLLdvYPStZiTcIZ4mJPTSOTllU10Ckx7lcxP +MG/K9yiLCjn3JXUTkL30XcufoShm4bIB60SE2Su8z9HR/6QDEMDiu6NTTKx X-Received: by 2002:ac2:4da4:0:b0:512:8deb:6f96 with SMTP id h4-20020ac24da4000000b005128deb6f96mr425101lfe.67.1708020081674; Thu, 15 Feb 2024 10:01:21 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id x9-20020ac259c9000000b0051166fc7faesm319681lfn.75.2024.02.15.10.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 10:01:21 -0800 (PST) From: Serge Semin <fancer.lancer@gmail.com> To: Serge Semin <fancer.lancer@gmail.com>, Mark Brown <broonie@kernel.org>, Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Andy Shevchenko <andy@kernel.org>, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/3] spi: dw: Auto-detect number of native CS Date: Thu, 15 Feb 2024 21:00:45 +0300 Message-ID: <20240215180102.13887-1-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790988925821247135 X-GMAIL-MSGID: 1790988925821247135 |
Series |
spi: dw: Auto-detect number of native CS
|
|
Message
Serge Semin
Feb. 15, 2024, 6 p.m. UTC
The main goal of the short series is to provide a procedure implementing
the auto-detection of the number of native Chip-Select signals supported
by the controller. The suggested algorithm is straightforward. It relies
on the fact that the SER register writable flags reflects the actual
number of available native chip-select signals. So the DW APB/AHB SSI
driver now tests the SER register for having the writable bits,
calculates the number of CS signals based on the number of set flags and
then initializes the num_cs private data field based on that, which then
will be passed to the SPI-core subsystem indicating the number of
supported hardware chip-selects. The implemented procedure will be useful
for the DW SSI device nodes not having the explicitly set "num-cs"
property. In case if the property is specified it will be utilized instead
of the auto-detection procedure.
Besides of that a small cleanup patch is introduced in the head of the
series. It converts the driver to using the BITS_TO_BYTES() macro instead
of the hard-coded DIV_ROUND_UP()-based calculation of the number of
bytes-per-transfer-word.
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andy Shevchenko <andy@kernel.org>
Cc: linux-spi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Serge Semin (3):
spi: dw: Convert to using BITS_TO_BYTES() macro
spi: dw: Add a number of native CS auto-detection
spi: dw: Drop default number of CS setting
drivers/spi/spi-dw-core.c | 20 ++++++++++++++++----
drivers/spi/spi-dw-mmio.c | 7 ++-----
2 files changed, 18 insertions(+), 9 deletions(-)