Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp933080rdb; Thu, 15 Feb 2024 23:07:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW3ty11iPfG8IcFvlQI24pxAwxOu7znw1fpFzTOqEA7mVuvuOuSS1gezd0+Rd+a2hLoKvG/9IWxB3YadGWnOfiwRoKhEKMrB6XTLDn+cQ== X-Google-Smtp-Source: AGHT+IFJj8uPVcIjeNBlrrjJQ/+rTVLWDGshSepVnSa8smXfZJ9KKNdG08z4eRnmx6x5RkJX7tso X-Received: by 2002:a17:902:da87:b0:1d9:53ca:e651 with SMTP id j7-20020a170902da8700b001d953cae651mr4763009plx.33.1708067267904; Thu, 15 Feb 2024 23:07:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708067267; cv=pass; d=google.com; s=arc-20160816; b=Rw2lbnIjjRHn7kCgbkZC+Rq0eGjZrH1iySgXxqx8VaKXMykrCUF1+I+WyBjVLfBbtc bMGWifumbyyODtjyuwJvnMudBw8dedAcMe0dB0Ru5W2Vzd91U52iFmQY2JLGyNyGYnpc O7K//cw0t9/UnsbQ01Y4kInpYIfgJcqlbSenp/b/MW4TcOD+XJx7MdHFvWQN11orb4tC TZRgv0GoVe07slITRr/QjTUzO9SZQ4y05Sdtr61d9W/OQJGOh0rAU7sJfj5sZWI8+Pe1 wT/TsxvB4eooRtqnz+rp9O5OOcSC24BYrMxvFzen9GU0/K88bdKQqOt3phSptAwXNIPK TFBg== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hp4R5FqMMv454plXIhV7qJWhdTsbC/ksc+0K6w+UCm0=; fh=Ma21SGjngTjR8lwrD7uToZRcDOGKWObfYfpIikgIWIU=; b=Xfk/3/UksRQtm/nM6uUIkSjHrU2j6/lok5m/Q79OdJfB29FeQVFBQU2RKxIKT28cLu W71buxD8jPMZxjhpx6vg08wntJEn5NJGskVZ+HE6dJV8YOKw0wgjvhJ2vYVmKPzeLrmv pETMwFltxC+ChCv8mb9ygx1qSfsnP2S+NQnv5hq32rZX65wO/Rs3IQRYROFwUqP1mLx9 0ChHHnXpDEnsHoQ2YZYuGDDNbKBKFJrFkCGMa1wqxXiDz1sz3GX8Kt58XOojOG1NcpJH qDslHVx1BjMLM3w1rzHFZkUsPLEIN/044IyijGDvNKW7LvQxNnVY8ygostv+FxdGXeJJ gw0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i2iFqbvO; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-68148-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68148-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o17-20020a170902d4d100b001d71c8871fasi2543489plg.504.2024.02.15.23.07.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 23:07:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68148-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i2iFqbvO; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-68148-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68148-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9B87F284EDB for ; Fri, 16 Feb 2024 07:07:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE7601BC3C; Fri, 16 Feb 2024 07:06:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="i2iFqbvO" Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 031F91AACD for ; Fri, 16 Feb 2024 07:06:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708067171; cv=none; b=G+xgApQuQFzXDd2SNX/P7LZituYm/RdaHG4KFbMfRwMKQ0yYlkaXDoOElacGDoFgrkwN5srKLjanxnzLkzutg6lk/GmHYhyH2Qq4KvPCbuNAJEYoqOyKC4RnHAeOLyWSkS0Ml9PxajYJJm6ci08+PkuApI/+jttFGI+U+UNnI0o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708067171; c=relaxed/simple; bh=mG+75mZLgRp2agc33t7IrmsrcHEZ055Yeb5TSZ4C1wc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KEaOK6MHQ44gcHRvG9KXhtHsMm96nYbk21XyRig5B0J5wmJo5ij3QHpKHBKZ8wDHbFaCKjyzhi6mySO8mrLUk+zcMrq2DzbPjR4L4CaVuUeaDNEa7xhJ9+oQCds1QhO1HhWWQRu+J5JuwgkZ19MSBgVJTXq4ixmr+vwcAamGPM0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=i2iFqbvO; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2d0e5212559so20538981fa.0 for ; Thu, 15 Feb 2024 23:06:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708067167; x=1708671967; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hp4R5FqMMv454plXIhV7qJWhdTsbC/ksc+0K6w+UCm0=; b=i2iFqbvOeKwQD5zMQJ9oYr25OJbv7aAv3D7fTaCHNudCbgUVaafnzztbD275XrJZ5j vyiRtH5HMafClu5mZJeZWU/5wDXabk7Umq/6HaTif8tKBZ5JnXfm2TYk18Vn+uc8gKRd eug8Wj4iyjIco3PGdOnLG4eKc37gs+Amj5h3Yty7mqLt1YmwaM+VTslJse93iMml5eRI UqSECjEXO9F9EpUdOSmwhJKUrCJqe9ZsiwB6gV3plUq1p/3ciA7nzaOkLQOO8ToHp1k/ usU4LzPGQl//zaflzeZ1hL4O/L7tqiWa5sRws4jPKYKz1PGWdsJNCEifKhIBoW+3J1Xz 4QpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708067167; x=1708671967; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hp4R5FqMMv454plXIhV7qJWhdTsbC/ksc+0K6w+UCm0=; b=GMDvXqPMsoNCpounJ0yiPqEyrkdNqG7DwLYkTL70nGX6h1S+5f/Ydg8YCzB9CfCKZk iGjUMH0YM3UbJhfxn5m9bcbGlCGURHD1UIhilgYHeBx4SS9NhZd+N21h0FWXEgjLIe53 4BFrSMCK6naFXl9nNDLamO7nTI3NUZ0zqEjeSEz+U0QHEgKKZHBPsxAK+wIh/F2TyLQR rrOxP5a3rc7ucR/5cALXpgbk3pTTjRHsIKzrkuQzcjIjWbKz71ad1gsEY3awlHYpxutS EUcy/GnBenOII4irSlV6IzN67gMS+EU2QoQDfd+jJpFQ8MInhDgudKyhfkgEf83Zyk2H 7eXQ== X-Forwarded-Encrypted: i=1; AJvYcCWmKj59D6651FLXoaHtvasbYzxWRFAH9BjzM1lbcjMOedSb1NHE9zjBtLxetBH5k3u5CWMn0uTpvpyoj57dn5LvsFb48t67BpoQ/+/8 X-Gm-Message-State: AOJu0YzvGw2SVpnGypw6LjHeNWFnSr1ckyA1Njd/WgwXhk5Q3e2t3H/1 juNmSLgk8NuAMVZXdXK6KFQFmHonXeuDOqtWKTz2CmfPkABfYI+8NRlnkhifQKQ= X-Received: by 2002:a2e:889a:0:b0:2d2:ccc:ac28 with SMTP id k26-20020a2e889a000000b002d20cccac28mr2399275lji.38.1708067166715; Thu, 15 Feb 2024 23:06:06 -0800 (PST) Received: from ta2.c.googlers.com.com (105.168.195.35.bc.googleusercontent.com. [35.195.168.105]) by smtp.gmail.com with ESMTPSA id k18-20020a5d66d2000000b0033940016d6esm1298839wrw.93.2024.02.15.23.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 23:06:05 -0800 (PST) From: Tudor Ambarus To: broonie@kernel.org, robh@kernel.org, andi.shyti@kernel.org, krzysztof.kozlowski@linaro.org, semen.protsenko@linaro.org, conor+dt@kernel.org Cc: alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com, devicetree@vger.kernel.org, Tudor Ambarus Subject: [PATCH v3 06/12] spi: s3c64xx: allow FIFO depth to be determined from the compatible Date: Fri, 16 Feb 2024 07:05:49 +0000 Message-ID: <20240216070555.2483977-7-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240216070555.2483977-1-tudor.ambarus@linaro.org> References: <20240216070555.2483977-1-tudor.ambarus@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit There are SoCs that use the same FIFO depth for all the instances of the SPI IP. See the fifo_lvl_mask defined for gs101 for example: .fifo_lvl_mask = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f}, Instead of specifying the FIFO depth with the same value for all 16 nodes in this case, allow such SoCs to infer the FIFO depth from the compatible. There are other SoCs than can benefit of this, see: {gs101, fsd, exynos850, s3c641, s3c2443}_spi_port_config. The FIFO depth inferred from the compatible has a higher precedence than the one that might be specified via device tree, the driver shall know better. Signed-off-by: Tudor Ambarus --- drivers/spi/spi-s3c64xx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index b1c63f75021d..68f95c04d092 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -137,6 +137,7 @@ struct s3c64xx_spi_dma_data { * struct s3c64xx_spi_port_config - SPI Controller hardware info * @fifo_lvl_mask: Bit-mask for {TX|RX}_FIFO_LVL bits in SPI_STATUS register. * @rx_lvl_offset: Bit offset of RX_FIFO_LVL bits in SPI_STATUS regiter. + * @fifo_depth: depth of the FIFO. * @rx_fifomask: SPI_STATUS.RX_FIFO_LVL mask. Shifted mask defining the field's * length and position. * @tx_fifomask: SPI_STATUS.TX_FIFO_LVL mask. Shifted mask defining the field's @@ -159,6 +160,7 @@ struct s3c64xx_spi_dma_data { struct s3c64xx_spi_port_config { int fifo_lvl_mask[MAX_SPI_PORTS]; int rx_lvl_offset; + unsigned int fifo_depth; u32 rx_fifomask; u32 tx_fifomask; int tx_st_done; @@ -1263,8 +1265,10 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) sdd->port_id = pdev->id; } - if (of_property_read_u32(pdev->dev.of_node, "fifo-depth", - &sdd->fifo_depth)) + if (sdd->port_conf->fifo_depth) + sdd->fifo_depth = sdd->port_conf->fifo_depth; + else if (of_property_read_u32(pdev->dev.of_node, "fifo-depth", + &sdd->fifo_depth)) sdd->fifo_depth = FIFO_DEPTH(sdd); s3c64xx_spi_set_fifomask(sdd); -- 2.44.0.rc0.258.g7320e95886-goog