From patchwork Fri Apr 22 22:17:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Gross X-Patchwork-Id: 8916051 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 358FFBF29F for ; Fri, 22 Apr 2016 22:20:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 670BC200E6 for ; Fri, 22 Apr 2016 22:20:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A21B1200D4 for ; Fri, 22 Apr 2016 22:20:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1atjPK-0000IS-8N; Fri, 22 Apr 2016 22:18:38 +0000 Received: from mail-ob0-x232.google.com ([2607:f8b0:4003:c01::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1atjOZ-00086C-PB for linux-arm-kernel@lists.infradead.org; Fri, 22 Apr 2016 22:17:52 +0000 Received: by mail-ob0-x232.google.com with SMTP id n10so49133450obb.2 for ; Fri, 22 Apr 2016 15:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H/uvj2/5sOClQN8MclD4xWBX10uYGRcyJ9KWrW04odQ=; b=IjMgtEToyiUzIMwCfwWCSU/rffcFndd02lfuRh8DpHCXjXooiIY+0H2eenJYp1Aj3C wWhQsFwqyJlDngmomnj6vkk19OYDqcTDBFbgXqg6zisIk70NDyweQPgP7Y0zARthBnzF qqUEjEdkyiWloQul/JRpmod88hfS5W0u5IRgY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H/uvj2/5sOClQN8MclD4xWBX10uYGRcyJ9KWrW04odQ=; b=Ie3+R+D/HzTDpl0VzgkFzetyFTNVjyz9zNaKjtQO+TK5+wK88EJTZatQmX6GrivuBd efKMhkGSMnOnbe6re1t+/6XAO9Tf+QnR4a5/SAsugyrfrCXDw4IwYklO2lpO7by7p6fw AIUDxwbN17BP+78jX/cU9OUjXzgcoq1l8wNXlR7OCXVJZHGQVr/akJ97fVwe87Eb5eBX tM2jM/DGVajQPT0BfqauJohLU4JRQvcAJnYojoKFov3MUQ7zyKqEYPcb7ihgD2WMAQx+ hMNMrlFq6ZlQEX4WtKNq0KbDASNR7H1C3psak44rouGVmETEgxsLsoCn3CP1+IkGjTHR Y98w== X-Gm-Message-State: AOPr4FVrWz2M4Tqm4Lu7MAN1mouM99OKgZjpWSqlU59iHYcp/KIkEPDu0h6dzxPok1JXbtUJ X-Received: by 10.182.105.65 with SMTP id gk1mr9670759obb.37.1461363450851; Fri, 22 Apr 2016 15:17:30 -0700 (PDT) Received: from localhost ([2602:306:c558:19b0:a419:15a3:ad7f:f979]) by smtp.gmail.com with ESMTPSA id xt3sm2651996obc.28.2016.04.22.15.17.30 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 22 Apr 2016 15:17:30 -0700 (PDT) From: Andy Gross To: linux-arm-msm@vger.kernel.org Subject: [PATCH 6/8] firmware: qcom: scm: Add memory allocation API Date: Fri, 22 Apr 2016 17:17:10 -0500 Message-Id: <1461363432-5730-7-git-send-email-andy.gross@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461363432-5730-1-git-send-email-andy.gross@linaro.org> References: <1461363432-5730-1-git-send-email-andy.gross@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160422_151751_946384_428476F2 X-CRM114-Status: GOOD ( 10.65 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Stephen Boyd , linux-kernel@vger.kernel.org, Andy Gross , Bjorn Andersson , jilai wang , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds APIs for the scm-32 and scm-64 to use for coherent memory allocation. Signed-off-by: Andy Gross --- drivers/firmware/qcom_scm.c | 17 +++++++++++++++++ drivers/firmware/qcom_scm.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 7d7b12b..6e3defb 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "qcom_scm.h" @@ -171,6 +172,22 @@ static void qcom_scm_init(void) __qcom_scm_init(); } +void *qcom_scm_alloc_buffer(size_t size, dma_addr_t *dma_addr, + gfp_t gfp) +{ + if (__scm) + return dma_alloc_writecombine(__scm->dev, size, dma_addr, gfp); + else + return ERR_PTR(-ENODEV); +} + +void qcom_scm_free_buffer(size_t size, void *cpu_addr, + dma_addr_t dma_addr) +{ + if (__scm) + dma_free_writecombine(__scm->dev, size, cpu_addr, dma_addr); +} + static int qcom_scm_probe(struct platform_device *pdev) { struct qcom_scm *scm; diff --git a/drivers/firmware/qcom_scm.h b/drivers/firmware/qcom_scm.h index d3f1f0a..33215b4 100644 --- a/drivers/firmware/qcom_scm.h +++ b/drivers/firmware/qcom_scm.h @@ -37,6 +37,10 @@ extern int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp); extern void __qcom_scm_init(void); +extern void *qcom_scm_alloc_buffer(size_t size, dma_addr_t *dma_addr, + gfp_t gfp); +extern void qcom_scm_free_buffer(size_t size, void *virt_addr, + dma_addr_t dma_addr); /* common error codes */ #define QCOM_SCM_V2_EBUSY -12 #define QCOM_SCM_ENOMEM -5