From patchwork Wed Jun 19 20:07:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 2751981 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 49BA6C0AB1 for ; Wed, 19 Jun 2013 20:13:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3693120497 for ; Wed, 19 Jun 2013 20:13:20 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5455F20197 for ; Wed, 19 Jun 2013 20:13:18 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpOhk-0002Y5-1Z; Wed, 19 Jun 2013 20:10:08 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpOgm-0004dz-4P; Wed, 19 Jun 2013 20:09:08 +0000 Received: from mail.free-electrons.com ([94.23.35.102]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UpOfv-0004Wy-Gj for linux-arm-kernel@lists.infradead.org; Wed, 19 Jun 2013 20:08:16 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 21E1E812; Wed, 19 Jun 2013 22:07:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost.localdomain (unknown [190.2.109.25]) by mail.free-electrons.com (Postfix) with ESMTPA id EBBA8739; Wed, 19 Jun 2013 22:07:51 +0200 (CEST) From: Ezequiel Garcia To: , Subject: [PATCH v4 06/12] memory: mvebu-devbus: Remove address decoding window workaround Date: Wed, 19 Jun 2013 17:07:20 -0300 Message-Id: <1371672446-21583-7-git-send-email-ezequiel.garcia@free-electrons.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1371672446-21583-1-git-send-email-ezequiel.garcia@free-electrons.com> References: <1371672446-21583-1-git-send-email-ezequiel.garcia@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130619_160815_853357_6AAE3132 X-CRM114-Status: GOOD ( 16.11 ) X-Spam-Score: -3.2 (---) Cc: Thomas Petazzoni , Andrew Lunn , Jason Cooper , Arnd Bergmann , Greg Kroah-Hartman , Grant Likely , Jason Gunthorpe , Maen Suleiman , Lior Amsalem , Ezequiel Garcia , Gregory Clement , Sebastian Hesselbarth X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now that mbus device tree binding has been introduced, remove the address decoding window management from this driver. A suitable 'ranges' entry should be added to the devbus-compatible node in the device tree, as described by the mbus binding documentation. Cc: Greg Kroah-Hartman Signed-off-by: Ezequiel Garcia --- Greg, I'm Ccing you, since you're carrying the mvebu-devbus driver in your trees. This patch should be applied only after the MBus DT binding is accepted and/or merged; although I doubt we will see that happening any time soon. drivers/memory/mvebu-devbus.c | 64 ++----------------------------------------- 1 file changed, 2 insertions(+), 62 deletions(-) diff --git a/drivers/memory/mvebu-devbus.c b/drivers/memory/mvebu-devbus.c index 978e8e3..94c9248 100644 --- a/drivers/memory/mvebu-devbus.c +++ b/drivers/memory/mvebu-devbus.c @@ -208,16 +208,11 @@ static int mvebu_devbus_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *node = pdev->dev.of_node; - struct device_node *parent; struct devbus *devbus; struct resource *res; struct clk *clk; unsigned long rate; - const __be32 *ranges; - int err, cs; - int addr_cells, p_addr_cells, size_cells; - int ranges_len, tuple_len; - u32 base, size; + int err; devbus = devm_kzalloc(&pdev->dev, sizeof(struct devbus), GFP_KERNEL); if (!devbus) @@ -248,68 +243,13 @@ static int mvebu_devbus_probe(struct platform_device *pdev) return err; /* - * Allocate an address window for this device. - * If the device probing fails, then we won't be able to - * remove the allocated address decoding window. - * - * FIXME: This is only a temporary hack! We need to do this here - * because we still don't have device tree bindings for mbus. - * Once that support is added, we will declare these address windows - * statically in the device tree, and remove the window configuration - * from here. - */ - - /* - * Get the CS to choose the window string. - * This is a bit hacky, but it will be removed once the - * address windows are declared in the device tree. - */ - cs = (((unsigned long)devbus->base) % 0x400) / 8; - - /* - * Parse 'ranges' property to obtain a (base,size) window tuple. - * This will be removed once the address windows - * are declared in the device tree. - */ - parent = of_get_parent(node); - if (!parent) - return -EINVAL; - - p_addr_cells = of_n_addr_cells(parent); - of_node_put(parent); - - addr_cells = of_n_addr_cells(node); - size_cells = of_n_size_cells(node); - tuple_len = (p_addr_cells + addr_cells + size_cells) * sizeof(__be32); - - ranges = of_get_property(node, "ranges", &ranges_len); - if (ranges == NULL || ranges_len != tuple_len) - return -EINVAL; - - base = of_translate_address(node, ranges + addr_cells); - if (base == OF_BAD_ADDR) - return -EINVAL; - size = of_read_number(ranges + addr_cells + p_addr_cells, size_cells); - - /* - * Create an mbus address windows. - * FIXME: Remove this, together with the above code, once the - * address windows are declared in the device tree. - */ - err = mvebu_mbus_add_window(devbus_wins[cs], base, size); - if (err < 0) - return err; - - /* * We need to create a child device explicitly from here to * guarantee that the child will be probed after the timing * parameters for the bus are written. */ err = of_platform_populate(node, NULL, NULL, dev); - if (err < 0) { - mvebu_mbus_del_window(base, size); + if (err < 0) return err; - } return 0; }