Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754710AbbEOLBq (ORCPT ); Fri, 15 May 2015 07:01:46 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:58953 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751117AbbEOLBm (ORCPT ); Fri, 15 May 2015 07:01:42 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: tthayer@opensource.altera.com, bp@alien8.de, dougthompson@xmission.com, m.chehab@samsung.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, linux@arm.linux.org.uk, dinguyen@opensource.altera.com, grant.likely@linaro.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, tthayer.linux@gmail.com, linux-edac@vger.kernel.org Subject: Re: [PATCH 1/4] edac, altera: Generalize driver to use DT Memory size Date: Fri, 15 May 2015 13:00:42 +0200 Message-ID: <2878194.MyPRW1b9ti@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1431553787-27741-2-git-send-email-tthayer@opensource.altera.com> References: <1431553787-27741-1-git-send-email-tthayer@opensource.altera.com> <1431553787-27741-2-git-send-email-tthayer@opensource.altera.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:rOjmpZO90dUNnBVTNDMrXnKF8JUgw0QX80wUJ79IBkOH67WeNEA InAOXlb1saG4iuX9B+wqBF5DjgNwDFU+lNaN4JNjQUzdjRxxfSW47jD+eaxMauov9oUmG5T hatnVni0Id/V/2o7LhEjyhsfSmBoDXgZSF5igq5FEeoZsrzAxO2TLQKsPdjfycfK4WSH9/v n4HZC42kvEKgYpUskSX+w== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 984 Lines: 26 On Wednesday 13 May 2015 16:49:44 tthayer@opensource.altera.com wrote: > -static u32 altr_sdram_get_total_mem_size(struct regmap *mc_vbase) > +/* Get total memory size from Open Firmware DTB */ > +static unsigned long get_total_mem(void) > { > - u32 size, read_reg, row, bank, col, cs, width; > + struct device_node *np = NULL; > + const unsigned int *reg, *reg_end; > + int len, sw, aw; > + unsigned long start, size, total_mem; > > - if (regmap_read(mc_vbase, DRAMADDRW_OFST, &read_reg) < 0) > + np = of_find_node_by_type(NULL, "memory"); > + if (!np) > return 0; There can be multiple memory nodes, I think you need to have a loop using for_each_node_by_type. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/