From patchwork Fri May 6 03:58:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 619125 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3r1J1947kxz9t43 for ; Fri, 6 May 2016 13:58:52 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 24BCEA754E; Fri, 6 May 2016 05:58:47 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oSQ5ulRAVXJF; Fri, 6 May 2016 05:58:46 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 188CCA74E0; Fri, 6 May 2016 05:58:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 843CCA74E0 for ; Fri, 6 May 2016 05:58:43 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CUdmNv2AdgOF for ; Fri, 6 May 2016 05:58:43 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by theia.denx.de (Postfix) with ESMTPS id 09896A74A8 for ; Fri, 6 May 2016 05:58:38 +0200 (CEST) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id u463wYxa007438; Thu, 5 May 2016 22:58:34 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u463wYGd028600; Thu, 5 May 2016 22:58:34 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Thu, 5 May 2016 22:58:33 -0500 Received: from uda0132425.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u463wUrw014593; Thu, 5 May 2016 22:58:31 -0500 From: Vignesh R To: Albert Aribaud , Vitaly Andrianov , Simon Glass , Jagan Teki Date: Fri, 6 May 2016 09:28:25 +0530 Message-ID: <1462507105-28131-1-git-send-email-vigneshr@ti.com> X-Mailer: git-send-email 2.8.2 In-Reply-To: <1462360772-27542-2-git-send-email-vigneshr@ti.com> References: <1462360772-27542-2-git-send-email-vigneshr@ti.com> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v4] dm: core: implement dev_map_phsymem() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This API helps to map physical register addresss pace of device to virtual address space easily. Its just a wrapper around map_physmem() with MAP_NOCACHE flag. Signed-off-by: Vignesh R Suggested-by: Simon Glass Reviewed-by: Jagan Teki --- v4: Reorder include files to avoid build warning on dra7xx. drivers/core/device.c | 6 ++++++ include/dm/device.h | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/core/device.c b/drivers/core/device.c index 1322991d6c7b..6b19b4b8c7a0 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include @@ -678,6 +679,11 @@ void *dev_get_addr_ptr(struct udevice *dev) return (void *)(uintptr_t)dev_get_addr_index(dev, 0); } +void *dev_map_physmem(struct udevice *dev, unsigned long size) +{ + return map_physmem(dev_get_addr(dev), size, MAP_NOCACHE); +} + bool device_has_children(struct udevice *dev) { return !list_empty(&dev->child_head); diff --git a/include/dm/device.h b/include/dm/device.h index 8970fc015c7e..5253b5410d9a 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -463,6 +463,15 @@ fdt_addr_t dev_get_addr(struct udevice *dev); */ void *dev_get_addr_ptr(struct udevice *dev); +/* * dev_map_physmem() - Map bus memory into CPU space + * + * @dev: Pointer to device + * @size: size of the memory to map + * + * @return addr + */ +void *dev_map_physmem(struct udevice *dev, unsigned long size); + /** * dev_get_addr_index() - Get the indexed reg property of a device *