Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp419337lqb; Tue, 4 Jun 2024 15:57:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXSsXgBugu76Z7ULIRnuj+mByjChkepOYdBt37bKhQjGZpyDixymr8yKeLOY1NIxfP4ZLwRM0aYGf6ujbDcmPqP5X7Mjq6DN41NTFTcJw== X-Google-Smtp-Source: AGHT+IGZfSptatN9/zNP9a6rvlR+uOOpBgpRjPrqWqoTn63Z5iaZsnwJvDnGmcDwXr6Li6GYDd8q X-Received: by 2002:a05:6a00:130f:b0:6f4:56d1:2fbe with SMTP id d2e1a72fcca58-703e594acffmr906811b3a.11.1717541832014; Tue, 04 Jun 2024 15:57:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717541832; cv=pass; d=google.com; s=arc-20160816; b=Jpr5qwzAKBfMGTV8bFtNHWyY50l18BncPglSSuvyCExN2Nl7Bt9GCPQRI9up5aVrQj HFDizZbwp9MVuNTLjLHEDEZVF8rbhAQvy3swpEBLUpI/0hHQTNEKvtwo2jTr+0T74+9J gM1XFQQ9H3CGvrf1zg9UckVDBEuLm3UCUfz7BS19N7cwGR+FcdWS4udkd903PC2cPMuk wnVYpQNoVcY/hWLpMLGXJxDGA08j9wXHQ6SgMMROxH6G5hqJbnDevqKdZitXATJbT/AT I5/xqWZins05ti+qJ3Hu/3OJvsyQRbHE7Kh9tnFiS1U9pc4XupENShraGdhBBFJkZIFi ulcg== 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=xL97q+jQ4u3SlwDZQenxOlqwGsbI4/Nn3jT75ZtbLBc=; fh=yiyhowXsdmjdsRMxtNs14ebKrjK5yzXbB3teBSdOs0w=; b=zy7T1MlYAlam1wt1BIyua2m3Z6vU+87Tn3/iRha0MtV5WwgfggHMhJicwq8P7KlQ7g NS0YxAWM7Vr5NbyCLrpje50L1f2dmr9sXuZ08gW1naOQSxJHuOKjQpEv4ndxlhbJWfzG CcBPmZs2vJW4BmiBAfBHuCfzVMJlLRI8dcThb0CqYzqdHdFiscCKww+fkW6TtHytfgHp sBA3PSqXRm+Bd2aJn0NAn3qQmQLdBqA0tXa8CQlWkhbEcMixG3iVZEMb53MyAL+jKXSx iGMniM6s1TadYIG2ngum3OYZfWKUNBDt7bHU7aj/9pgWI2OnDFAPadUqEnXGPpDAXX9b rGHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@analog.com header.s=DKIM header.b=K3n3iQBJ; arc=pass (i=1 spf=pass spfdomain=analog.com dkim=pass dkdomain=analog.com dmarc=pass fromdomain=analog.com); spf=pass (google.com: domain of linux-kernel+bounces-201506-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201506-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=analog.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-70242b09612si8896609b3a.207.2024.06.04.15.57.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 15:57:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201506-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@analog.com header.s=DKIM header.b=K3n3iQBJ; arc=pass (i=1 spf=pass spfdomain=analog.com dkim=pass dkdomain=analog.com dmarc=pass fromdomain=analog.com); spf=pass (google.com: domain of linux-kernel+bounces-201506-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201506-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=analog.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4D531B27262 for ; Tue, 4 Jun 2024 22:44:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A2B014D29D; Tue, 4 Jun 2024 22:44:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="K3n3iQBJ" Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0447414D280; Tue, 4 Jun 2024 22:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717541042; cv=none; b=a5YX3qPIrCWWw1KFe07xxJdW1LxcvIhwlKV8hGCqt0dPePgrUbDAGsJnRVZ4qJuvqvsmTOPvmnzYVxv1POsPNNLg/4zrrW2E+/MYGQMmzpfUjcAPlupr2srpwGJuA3b7/M+5XES5WLO7WGgJtX+oBNQ8bsIpEgKfv2yRvAQGAIE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717541042; c=relaxed/simple; bh=KPLFsuxbLJbSe0NAlvozvC6hvGT606LETzi95E7ckN0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kEly8k49AZa9MBtb04Qo+/s3WA393o7zvlA74ezockd+9hUuuF8l/OriVn4NQvSgsf3UsOKQSMsLoQ+2aG33aSLrAZkg5C8Yeh5vtUgx4Iv+kwVP9Ke2OQg19wrZ4/x1D/hcs8TAMhpufx1v56I7lQD3jVEFYmRsbV2x91hgdb0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=K3n3iQBJ; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 454KLAH2030415; Tue, 4 Jun 2024 18:43:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=xL97q +jQ4u3SlwDZQenxOlqwGsbI4/Nn3jT75ZtbLBc=; b=K3n3iQBJbCiS91Xgl4Md1 VGkMo1ptAjteIFj1cUoxqvoOb80ufaYxBMFpTyx4Mhk4OqJEe2SAmntKpkWS6s+l BxwylUrBbLLCN0kzSw/fIQd18ee67bYdmXbeTt8PDri8ZQJtf9rWhXtE1KUL6Js9 QGOBs7SPI1HSkfYIM5fd+A68l24ARaP6neBYkbiGSMnvdLBsZ0M+VarHwGu1iCzG fkaPwskLVJsDkyn/XNKChHrw06Sp50FdfESpP90Qg2x2lmyqUCW+XGJszSsc/Wmi Vfb8dKq36/VJ/+B4i9PYsJ0R4No99qwGUSwgqNf5QXe8cUafzvj75kKUtV7BMs/X Q== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3yg0j1ms3j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 04 Jun 2024 18:43:45 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 454Mhiun025156 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Jun 2024 18:43:44 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Tue, 4 Jun 2024 18:43:43 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Tue, 4 Jun 2024 18:43:43 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Tue, 4 Jun 2024 18:43:43 -0400 Received: from work.ad.analog.com (HYB-hERzalRezfV.ad.analog.com [10.65.205.129]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 454MhRj4001211; Tue, 4 Jun 2024 18:43:30 -0400 From: Marcelo Schmitt To: , , , , , , , , , CC: , , , Subject: [PATCH v3 4/6] spi: spi-axi-spi-engine: Add support for MOSI idle configuration Date: Tue, 4 Jun 2024 19:43:26 -0300 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-ORIG-GUID: TLJyh7FPKCr0rAg9zbE8pTozA5fyhcd_ X-Proofpoint-GUID: TLJyh7FPKCr0rAg9zbE8pTozA5fyhcd_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-04_11,2024-06-04_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406040183 Implement MOSI idle low and MOSI idle high to better support peripherals that request specific MOSI behavior. Signed-off-by: Marcelo Schmitt --- drivers/spi/spi-axi-spi-engine.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c index 0aa31d745734..549f03069d0e 100644 --- a/drivers/spi/spi-axi-spi-engine.c +++ b/drivers/spi/spi-axi-spi-engine.c @@ -41,6 +41,7 @@ #define SPI_ENGINE_CONFIG_CPHA BIT(0) #define SPI_ENGINE_CONFIG_CPOL BIT(1) #define SPI_ENGINE_CONFIG_3WIRE BIT(2) +#define SPI_ENGINE_CONFIG_SDO_IDLE BIT(3) #define SPI_ENGINE_INST_TRANSFER 0x0 #define SPI_ENGINE_INST_ASSERT 0x1 @@ -132,6 +133,10 @@ static unsigned int spi_engine_get_config(struct spi_device *spi) config |= SPI_ENGINE_CONFIG_CPHA; if (spi->mode & SPI_3WIRE) config |= SPI_ENGINE_CONFIG_3WIRE; + if (spi->mode & SPI_MOSI_IDLE_HIGH) + config |= SPI_ENGINE_CONFIG_SDO_IDLE; + if (spi->mode & SPI_MOSI_IDLE_LOW) + config &= ~SPI_ENGINE_CONFIG_SDO_IDLE; return config; } @@ -645,7 +650,8 @@ static int spi_engine_probe(struct platform_device *pdev) return ret; host->dev.of_node = pdev->dev.of_node; - host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE; + host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_3WIRE | SPI_MOSI_IDLE_LOW + | SPI_MOSI_IDLE_HIGH; host->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32); host->max_speed_hz = clk_get_rate(spi_engine->ref_clk) / 2; host->transfer_one_message = spi_engine_transfer_one_message; -- 2.43.0