From patchwork Fri Jun 25 05:22:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 466821 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1106849jao; Thu, 24 Jun 2021 22:22:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf/EXfHGoUEDAY4aYHm730mnT+YEIPS3ZfC+Cccl7no3jlR9/USHdxCGdsL6eYKD1o5XW5 X-Received: by 2002:a02:838c:: with SMTP id z12mr7988261jag.89.1624598562373; Thu, 24 Jun 2021 22:22:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624598562; cv=none; d=google.com; s=arc-20160816; b=mMeXdLr1/2OcO2eRaZP9EmSGQ6e1XWQxGJDGPgrYfb9zpku/YTiQHYfzVQ+TtWsJEH 8DlegRMSgWNUi/XafUwGyphJnq4CDXtzfwk4fupyDMum9L5BWGBhR0F2gHoaSZ3nyaN2 eLqWa+eEf37voTd4jjqsQM1B8olYikk9EZajv81C8bH+fHEGCtnY+/5Q+eZH1jxw5JOp rNcPhkNG9Hm8sBV1b8Ugi44/7o8SF9H2/9ktxczvjz3KwfdGwmcgg8TocaeOPpTsbEke t87EYxuStmwf12UxiH48hIH6CCm+FEzEVCLS/j4Ik8Wgqwe2WN98IngI9n6srUW5tqZl 76iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3cA96SeJPATJ32N5iRt4FpFY1OrA/yMP666/lTPf4ks=; b=eNX3KGD0/vaCELLAKyNIPMDvb2/XAGo10xYRlK89dPHMNwDdQE64GEHttKw04GI6Tl mLdqfxYDJ7k5SlkdO5+q1M/Wnh6W6E06ldO3PJmQv7r7ruQCcOe+LuUcuWAOJgTEdhgq qAQOkWop0/1YpXgy+YQkBGsvYE3SW4C1yeQgzt3QrSJCSi4a1NK+EC5XcGHXMiX5dOJt z1tvEfpVAt5hyNhyC8BjTOy3tPZL1RwSlIKTdGWVTntW6Rkbf9OCuq7sI/DncJEcek+x y9BZ3/xyE+IvnysuCgy5y02jxRk9iJHsVh4XSXJgeq8mm3PckPPd2dXgWLiEVqBPc1Fu Xt8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A32ePgDy; spf=pass (google.com: domain of linux-spi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p15si5765539ilp.35.2021.06.24.22.22.42; Thu, 24 Jun 2021 22:22:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-spi-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=@kernel.org header.s=k20201202 header.b=A32ePgDy; spf=pass (google.com: domain of linux-spi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233169AbhFYFZB (ORCPT + 1 other); Fri, 25 Jun 2021 01:25:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:46324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233133AbhFYFZA (ORCPT ); Fri, 25 Jun 2021 01:25:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C54B56140B; Fri, 25 Jun 2021 05:22:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624598560; bh=MPl3vTAAEWf4+fP0ly5QUJMsJvvm/k1y8noRL42CSiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A32ePgDycnk16AQJ9ftY5wD76rBy/xHphLZ0/ePtzUmNAAgeC0CfleSfg2G5pFSZA /h1SYvGeFn7dUIDaeQjW6AV5Uo/Fiok8d0NTBhASL3DoMvgcbYVVmye+ebcQbD04Gj guqoKhh6Gt7CPVoPCTPZ2yGXXjZZ8VBzqRUjCSHAUa+8LmeqDKMgzWqNW6tYyqb3Tx w2nxVetxHq2PFEvZSUTqp5L6hsxBvxTJfLHZ+AXkD26cQtJRE7Dnw4SHIAr5h80w/U o6vBqeHtQ5etL4H56CKEW8F6ULlba0ZqJP7BN/JQsn/ojD0exaTbV1f47GC9wVEAxl BvkAjYJUho1Zg== From: Vinod Koul To: Bjorn Andersson , Mark Brown , Wolfram Sang Cc: Vinod Koul , Andy Gross , Sumit Semwal , Douglas Anderson , Matthias Kaehlcke , linux-spi@vger.kernel.org, linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/5] spi: core: add dma_map_dev for dma device Date: Fri, 25 Jun 2021 10:52:11 +0530 Message-Id: <20210625052213.32260-4-vkoul@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210625052213.32260-1-vkoul@kernel.org> References: <20210625052213.32260-1-vkoul@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Some controllers like qcom geni need the parent device to be used for dma mapping, so add a dma_map_dev field and let drivers fill this to be used as mapping device Signed-off-by: Vinod Koul --- drivers/spi/spi.c | 4 ++++ include/linux/spi/spi.h | 1 + 2 files changed, 5 insertions(+) -- 2.31.1 diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index e353b7a9e54e..315f7e7545f7 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -961,11 +961,15 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg) if (ctlr->dma_tx) tx_dev = ctlr->dma_tx->device->dev; + else if (ctlr->dma_map_dev) + tx_dev = ctlr->dma_map_dev; else tx_dev = ctlr->dev.parent; if (ctlr->dma_rx) rx_dev = ctlr->dma_rx->device->dev; + else if (ctlr->dma_map_dev) + rx_dev = ctlr->dma_map_dev; else rx_dev = ctlr->dev.parent; diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 74239d65c7fd..4d3f116f5723 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -586,6 +586,7 @@ struct spi_controller { bool (*can_dma)(struct spi_controller *ctlr, struct spi_device *spi, struct spi_transfer *xfer); + struct device *dma_map_dev; /* * These hooks are for drivers that want to use the generic