From patchwork Fri Mar 18 22:48:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 87585 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B9336B6F72 for ; Sat, 19 Mar 2011 09:47:59 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932577Ab1CRWr6 (ORCPT ); Fri, 18 Mar 2011 18:47:58 -0400 Received: from 74-93-104-97-Washington.hfc.comcastbusiness.net ([74.93.104.97]:53517 "EHLO sunset.davemloft.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932176Ab1CRWr6 (ORCPT ); Fri, 18 Mar 2011 18:47:58 -0400 Received: from localhost (localhost [127.0.0.1]) by sunset.davemloft.net (Postfix) with ESMTP id 0758224C087 for ; Fri, 18 Mar 2011 15:48:36 -0700 (PDT) Date: Fri, 18 Mar 2011 15:48:35 -0700 (PDT) Message-Id: <20110318.154835.232902675.davem@davemloft.net> To: sparclinux@vger.kernel.org Subject: [PATCH] sparc: Implement of_iomap(). From: David Miller X-Mailer: Mew version 6.3 on Emacs 23.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org Grab the pre-computed resource and map using of_ioremap(). Signed-off-by: David S. Miller --- arch/sparc/kernel/of_device_common.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c index 0ed0321..cb15bbf 100644 --- a/arch/sparc/kernel/of_device_common.c +++ b/arch/sparc/kernel/of_device_common.c @@ -35,6 +35,20 @@ int of_address_to_resource(struct device_node *node, int index, } EXPORT_SYMBOL_GPL(of_address_to_resource); +void __iomem *of_iomap(struct device_node *node, int index) +{ + struct platform_device *op = of_find_device_by_node(node); + struct resource *r; + + if (!op || index >= op->num_resources) + return NULL; + + r = &op->archdata.resource[index]; + + return of_ioremap(r, 0, resource_size(r), (char *) r->name); +} +EXPORT_SYMBOL(of_iomap); + /* Take the archdata values for IOMMU, STC, and HOSTDATA found in * BUS and propagate to all child platform_device objects. */