From patchwork Tue Aug 14 13:49:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Genoud X-Patchwork-Id: 1319501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id BEE22DF215 for ; Tue, 14 Aug 2012 13:56:55 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T1HVr-0000ZJ-8T; Tue, 14 Aug 2012 13:50:27 +0000 Received: from mail-we0-f177.google.com ([74.125.82.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T1HVn-0000YQ-EU for linux-arm-kernel@lists.infradead.org; Tue, 14 Aug 2012 13:50:24 +0000 Received: by weyr3 with SMTP id r3so277672wey.36 for ; Tue, 14 Aug 2012 06:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=KsLpjEoOBmxzwY6tA2Oi9Bez3x9ibZMIix0h5R+hwtk=; b=kylhW7Y0k2VPrX0y2vNhkVrMW9/jqSxW3zoK3zOx5OaFxWvZ3ayTySfhFnh8PRZBXs S0H94YhfqOHGqQGcyIXkZmfExwIeeDsD7gdq4vHvWBndhZ2GceXpnskrN8L05uZUXsEL wdD519SrXVZ5i5hb7apHIC/RE8nAtDvZBS/KV9XFHEX0tvlkMxC3qyI7wAcckp5PMkzU Ne8/OBJf9eMbYxycrEf3+DvSrv6LzUjpnG/+rzFHUpgKy/1dVjeN8kmoQ8aiGXu5ntnL a1WDs/RT+2/s2mcXCoA49MUq8ToBBM40G/gOkprvNVLnQTm9vNS5AIgDchljJ64AboVp +vQQ== Received: by 10.180.80.134 with SMTP id r6mr28085362wix.1.1344952221429; Tue, 14 Aug 2012 06:50:21 -0700 (PDT) Received: from localhost.localdomain (lyon.paratronic.fr. [213.41.177.106]) by mx.google.com with ESMTPS id eu4sm22509397wib.2.2012.08.14.06.50.20 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Aug 2012 06:50:20 -0700 (PDT) From: Richard Genoud To: Nicolas Ferre Subject: [PATCH 01/23] of: add dma-mask binding Date: Tue, 14 Aug 2012 15:49:15 +0200 Message-Id: <1344952177-18385-2-git-send-email-richard.genoud@gmail.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1344952177-18385-1-git-send-email-richard.genoud@gmail.com> References: <1344952177-18385-1-git-send-email-richard.genoud@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (richard.genoud[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Jean-Christophe PLAGNIOL-VILLARD , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Jean-Christophe PLAGNIOL-VILLARD This will allow each device to specify its dma-mask for this we use the coherent_dma_mask as pointer. By default the dma-mask will be set to DMA_BIT_MASK(32). The microblaze architecture hook is drop Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- drivers/of/platform.c | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index e44f8c2..11c765c 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -121,6 +121,21 @@ void of_device_make_bus_id(struct device *dev) dev_set_name(dev, "%s.%d", node->name, magic - 1); } +static void of_get_dma_mask(struct device *dev, struct device_node *np) +{ + const __be32 *prop; + int len; + + prop = of_get_property(np, "dma-mask", &len); + + dev->dma_mask = &dev->coherent_dma_mask; + + if (!prop) + dev->coherent_dma_mask = DMA_BIT_MASK(32); + else + dev->coherent_dma_mask = of_read_number(prop, len / 4); +} + /** * of_device_alloc - Allocate and initialize an of_device * @np: device node to assign to device @@ -161,10 +176,8 @@ struct platform_device *of_device_alloc(struct device_node *np, WARN_ON(of_irq_to_resource_table(np, res, num_irq) != num_irq); } + of_get_dma_mask(&dev->dev, np); dev->dev.of_node = of_node_get(np); -#if defined(CONFIG_MICROBLAZE) - dev->dev.dma_mask = &dev->archdata.dma_mask; -#endif dev->dev.parent = parent; if (bus_id) @@ -201,10 +214,6 @@ struct platform_device *of_platform_device_create_pdata( if (!dev) return NULL; -#if defined(CONFIG_MICROBLAZE) - dev->archdata.dma_mask = 0xffffffffUL; -#endif - dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); dev->dev.bus = &platform_bus_type; dev->dev.platform_data = platform_data;