From patchwork Mon Nov 12 08:52:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenyou Yang X-Patchwork-Id: 1726961 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id B709D3FCAE for ; Mon, 12 Nov 2012 08:58:39 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TXpom-0003dY-KY; Mon, 12 Nov 2012 08:56:32 +0000 Received: from newsmtp5.atmel.com ([204.2.163.5] helo=sjogate2.atmel.com) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TXpoO-0003Vs-Jv for linux-arm-kernel@lists.infradead.org; Mon, 12 Nov 2012 08:56:09 +0000 Received: from penbh01.corp.atmel.com ([10.168.5.31]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id qAC8oZEB029478; Mon, 12 Nov 2012 00:50:48 -0800 (PST) Received: from penmb01.corp.atmel.com ([10.168.5.33]) by penbh01.corp.atmel.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 12 Nov 2012 16:55:44 +0800 Received: from shaarm01.corp.atmel.com ([10.217.6.34]) by penmb01.corp.atmel.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 12 Nov 2012 16:55:44 +0800 From: Wenyou Yang To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 01/17] of: add dma-mask binding Date: Mon, 12 Nov 2012 16:52:21 +0800 Message-Id: <1352710357-3265-2-git-send-email-wenyou.yang@atmel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1352710357-3265-1-git-send-email-wenyou.yang@atmel.com> References: <1352710357-3265-1-git-send-email-wenyou.yang@atmel.com> X-OriginalArrivalTime: 12 Nov 2012 08:55:44.0363 (UTC) FILETIME=[800D0BB0:01CDC0B3] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121112_035609_009915_8A574339 X-CRM114-Status: GOOD ( 11.56 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: JM.Lin@atmel.com, nicolas.ferre@atmel.com, rob.herring@calxeda.com, wenyou.yang@atmel.com, grant.likely@secretlab.ca, Jean-Christophe PLAGNIOL-VILLARD , devicetree-discuss@lists.ozlabs.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 Cc: grant.likely@secretlab.ca Cc: rob.herring@calxeda.com Cc: devicetree-discuss@lists.ozlabs.org --- drivers/of/platform.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index b80891b..31ed405 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -130,6 +130,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 @@ -171,10 +186,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) @@ -211,10 +224,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;