Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2246706yba; Fri, 10 May 2019 08:28:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2UarBMRJa2fbg7eJrIuWwCWNgt9dKynnfel5crgqlHcyNr+qJtXcUusc8EbpPU8GVPc3q X-Received: by 2002:a17:902:2862:: with SMTP id e89mr13982747plb.203.1557502091344; Fri, 10 May 2019 08:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557502091; cv=none; d=google.com; s=arc-20160816; b=X/bjrd7ctJscAhI5U9A2z9N+/NWWxoq9CGz4bCp78wi9/iqJoFGyofXdi+SCgln2A2 YL16hHzvbFiYV1MNwWoKUHDHqsmyHRnR0kPq+RWrw7BuO9wV9NrvJV8YDw0xIdGdkax3 YwqZhXqdWFlgKehi2aAmLEHn6y6VUcap7Da7S1YKGbzzskSrvbvDACk8DiILahMc4CBf onlUTyGper+DR3z2t8BX7gibrgsKsPVGHgzpsOfiTorPG2iORMR4kwYLy8CBCD+sp7XL 0VOFVcrNva2Y1omrbl4LNjeyliKWe1eNzca6Cjd1fGMbi9lrahsOxcvwUrHWsQtTlNsI As6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=OOkMMrNA8PP0GlB6V6hw8fPcLZsC4fjBLgkRyETBcjg=; b=Evesrp+jdvj2gwZXUS+ris+bjXUXVh9PnzVn3k4UVnsMqXzqkRNTUskHrb25j4SPs/ BFmYPDzkwHQ9K291Z+BQE2SQtZ8o/toXasQvc44v8f5b4LqNH9IH3LthOstTlm1260iP r/NiUSl8FceXGE4DR9FrBMFtHqLIzwNsgv08mWBWP4P/rVtnZmWwHS6xhqp8E7yMJdO7 toA5sMW2mDilqV3S2MDXbRvhNbT4/gfkqI4qgSE7O1NLUX6wy5okNGHxnyTRObPtK2jk R4ruQJQJ3xxrSJZfTLbcdtl/FElZ+yHdOB7EQIbIH77Pfc+CCRui3HANs3sWSxnxZivR xm+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si7978488pgh.367.2019.05.10.08.27.54; Fri, 10 May 2019 08:28:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727555AbfEJO4z (ORCPT + 99 others); Fri, 10 May 2019 10:56:55 -0400 Received: from inva020.nxp.com ([92.121.34.13]:35360 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727492AbfEJO4x (ORCPT ); Fri, 10 May 2019 10:56:53 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id F1D5B1A0040; Fri, 10 May 2019 16:56:51 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E59971A00D0; Fri, 10 May 2019 16:56:51 +0200 (CEST) Received: from fsr-ub1864-101.ea.freescale.net (fsr-ub1864-101.ea.freescale.net [10.171.82.13]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 77957205ED; Fri, 10 May 2019 16:56:51 +0200 (CEST) From: laurentiu.tudor@nxp.com To: hch@lst.de, stern@rowland.harvard.edu, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, marex@denx.de Cc: leoyang.li@nxp.com, linux-kernel@vger.kernel.org, robin.murphy@arm.com, Laurentiu Tudor Subject: [RFC PATCH 3/3] usb: host: ohci-tmio: init genalloc for local memory Date: Fri, 10 May 2019 17:56:46 +0300 Message-Id: <20190510145646.10078-4-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190510145646.10078-1-laurentiu.tudor@nxp.com> References: <20190510145646.10078-1-laurentiu.tudor@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Laurentiu Tudor In preparation for dropping the existing "coherent" dma mem declaration APIs, replace the current dma_declare_coherent_memory() based mechanism with the creation of a genalloc pool that will be used in the OHCI subsystem as replacement for the DMA APIs. For context, see thread here: https://lkml.org/lkml/2019/4/22/357 Signed-off-by: Laurentiu Tudor --- drivers/usb/host/ohci-tmio.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c index f88a0370659f..16ff99b56fd3 100644 --- a/drivers/usb/host/ohci-tmio.c +++ b/drivers/usb/host/ohci-tmio.c @@ -30,6 +30,7 @@ #include #include #include +#include /*-------------------------------------------------------------------------*/ @@ -224,11 +225,6 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev) goto err_ioremap_regs; } - ret = dma_declare_coherent_memory(&dev->dev, sram->start, sram->start, - resource_size(sram)); - if (ret) - goto err_dma_declare; - if (cell->enable) { ret = cell->enable(dev); if (ret) @@ -239,6 +235,20 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev) ohci = hcd_to_ohci(hcd); ohci_hcd_init(ohci); + ohci->localmem_pool = devm_gen_pool_create(&dev->dev, PAGE_SHIFT, + dev_to_node(&dev->dev), + "ohci-sm501"); + if (IS_ERR(ohci->localmem_pool)) { + ret = PTR_ERR(ohci->localmem_pool); + goto err_enable; + } + ret = gen_pool_add_virt(ohci->localmem_pool, sram->start, sram->start, + resource_size(sram), dev_to_node(&dev->dev)); + if (ret < 0) { + dev_err(&dev->dev, "failed to add to pool: %d\n", ret); + goto err_enable; + } + ret = usb_add_hcd(hcd, irq, 0); if (ret) goto err_add_hcd; @@ -254,8 +264,6 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev) if (cell->disable) cell->disable(dev); err_enable: - dma_release_declared_memory(&dev->dev); -err_dma_declare: iounmap(hcd->regs); err_ioremap_regs: iounmap(tmio->ccr); @@ -276,7 +284,6 @@ static int ohci_hcd_tmio_drv_remove(struct platform_device *dev) tmio_stop_hc(dev); if (cell->disable) cell->disable(dev); - dma_release_declared_memory(&dev->dev); iounmap(hcd->regs); iounmap(tmio->ccr); usb_put_hcd(hcd); -- 2.17.1