Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3554030ybk; Tue, 19 May 2020 07:29:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz9Zz7GcZVqrXPEwVmB5P7r2/Ev4msIEnTj+kNHJlCtAswPR/ACTGHC15IhdpPTxVQ3mtu X-Received: by 2002:aa7:cd69:: with SMTP id ca9mr4921774edb.370.1589898550479; Tue, 19 May 2020 07:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589898550; cv=none; d=google.com; s=arc-20160816; b=DXbM2W0H4UPFnekNcMWopD5R2gPewRtsfgOP7f5N/X+JThpVeoInZp+rkmtQywxxS7 RcIugZDOVAXkAiZvyD9UXThyNx05VzlNkiMaCuu1/x8gdHT1RRpGXTdKSs3rSgqOBIjp Dvr0stoLM3cWr7ToticALoxuDJ0Hwd+WPZXqNKgKephFMPZ5mfj9t5ZCKr4uEE0De3LR uWxKnXbjB2g2ETZwIXBYpdM14ElnRzDch3f71H1p9xdGTWdETiTLOkdYxRMuQ9bj25vg wiN2xWoG1OgYI0/7WL9QdGGCv5uDBzIkFG9vqctSUKm2HYDe+uaK/U6P2q5CKIFfkVho XzYQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QVVBkRYpNpHNnM3DtoOcxGwPAsP60fEAqbUuQ94mGJM=; b=q8TOJAkKx6PUufWPH67LQNroRekEjuuOotTHjtXkEqXduFAsYl1dP/SpDsz17zkBsi Kkb+IM7ef7NGUpeQA/2Fk+1PZ4HC6KxbU8YnC5GhhqEAyRJT/yd54D08636Sxd7Pxc1X 7NEHX4ZUyAts3DxhV7QyXHJvuLhwSM+BypycK6WD2UIyIBLPlWjdl+2hqzLO/vRq998H /gV/Se2slIoeixZ421o2xyVLd6QRhuzrkMlttzdzuoSdIJwI+yGLEMQU6gravS+911uh HiXLN2FfMVepn3FVvuy0ao++cGRSl4tnY6kQc8UkdZUKtSAbAQ+JSuC01a5rZwXupXc/ WICg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=J11HR8sY; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w25si8440083edl.165.2020.05.19.07.28.46; Tue, 19 May 2020 07:29:10 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=J11HR8sY; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729059AbgESO1V (ORCPT + 99 others); Tue, 19 May 2020 10:27:21 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:53718 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728737AbgESO1U (ORCPT ); Tue, 19 May 2020 10:27:20 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04JEQr1e123253; Tue, 19 May 2020 09:26:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1589898413; bh=QVVBkRYpNpHNnM3DtoOcxGwPAsP60fEAqbUuQ94mGJM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=J11HR8sYbfzI3GRPUy1a2d4louwsxCRnv5r2AQ7s8ONaSJe/h6cWR0/AhGtrLQ1Dl 5/0Kq5W2ooUPXAqtd66Mg3DfRFD8vdkikTltoLXvlwIfbJKVkfxLRB3McRk69aXKYJ gJre9stiY8d1OJLJ0nZwygyIm8qBertZgy47a8UQ= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04JEQrG6080762 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 19 May 2020 09:26:53 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 19 May 2020 09:26:52 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 19 May 2020 09:26:52 -0500 Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04JEQgjJ008313; Tue, 19 May 2020 09:26:48 -0500 From: Pratyush Yadav To: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Mark Brown , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Matthias Brugger , , , , , CC: Pratyush Yadav , Sekhar Nori , Boris Brezillon , Mason Yang Subject: [PATCH v5 01/19] spi: spi-mem: allow specifying whether an op is DTR or not Date: Tue, 19 May 2020 19:56:23 +0530 Message-ID: <20200519142642.24131-2-p.yadav@ti.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200519142642.24131-1-p.yadav@ti.com> References: <20200519142642.24131-1-p.yadav@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Each phase is given a separate 'dtr' field so mixed protocols like 4S-4D-4D can be supported. Signed-off-by: Pratyush Yadav --- drivers/spi/spi-mem.c | 3 +++ include/linux/spi/spi-mem.h | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index 9a86cc27fcc0..93e255287ab9 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -156,6 +156,9 @@ bool spi_mem_default_supports_op(struct spi_mem *mem, op->data.dir == SPI_MEM_DATA_OUT)) return false; + if (op->cmd.dtr || op->addr.dtr || op->dummy.dtr || op->data.dtr) + return false; + return true; } EXPORT_SYMBOL_GPL(spi_mem_default_supports_op); diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h index af9ff2f0f1b2..e3dcb956bf61 100644 --- a/include/linux/spi/spi-mem.h +++ b/include/linux/spi/spi-mem.h @@ -71,9 +71,11 @@ enum spi_mem_data_dir { * struct spi_mem_op - describes a SPI memory operation * @cmd.buswidth: number of IO lines used to transmit the command * @cmd.opcode: operation opcode + * @cmd.dtr: whether the command opcode should be sent in DTR mode or not * @addr.nbytes: number of address bytes to send. Can be zero if the operation * does not need to send an address * @addr.buswidth: number of IO lines used to transmit the address cycles + * @addr.dtr: whether the address should be sent in DTR mode or not * @addr.val: address value. This value is always sent MSB first on the bus. * Note that only @addr.nbytes are taken into account in this * address value, so users should make sure the value fits in the @@ -81,7 +83,9 @@ enum spi_mem_data_dir { * @dummy.nbytes: number of dummy bytes to send after an opcode or address. Can * be zero if the operation does not require dummy bytes * @dummy.buswidth: number of IO lanes used to transmit the dummy bytes + * @dummy.dtr: whether the dummy bytes should be sent in DTR mode or not * @data.buswidth: number of IO lanes used to send/receive the data + * @data.dtr: whether the data should be sent in DTR mode or not * @data.dir: direction of the transfer * @data.nbytes: number of data bytes to send/receive. Can be zero if the * operation does not involve transferring data @@ -91,22 +95,26 @@ enum spi_mem_data_dir { struct spi_mem_op { struct { u8 buswidth; + u8 dtr : 1; u8 opcode; } cmd; struct { u8 nbytes; u8 buswidth; + u8 dtr : 1; u64 val; } addr; struct { u8 nbytes; u8 buswidth; + u8 dtr : 1; } dummy; struct { u8 buswidth; + u8 dtr : 1; enum spi_mem_data_dir dir; unsigned int nbytes; union { -- 2.26.2