From patchwork Fri Oct 12 07:22:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 191062 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 32AE22C008B for ; Fri, 12 Oct 2012 18:23:42 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMZZt-0003Jh-UE; Fri, 12 Oct 2012 07:22:38 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TMZZq-0003JT-Cx for linux-mtd@lists.infradead.org; Fri, 12 Oct 2012 07:22:35 +0000 Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:21e:67ff:fe11:9c5c]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1TMZZg-0000EQ-Tu; Fri, 12 Oct 2012 09:22:24 +0200 Received: from ukl by dude.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1TMZZd-0008QR-PV; Fri, 12 Oct 2012 09:22:21 +0200 Date: Fri, 12 Oct 2012 09:22:21 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Greg Ungerer Subject: Re: [PATCH] [RFC] mtd/uclinux: support ROM and allow passing the base address Message-ID: <20121012072221.GB639@pengutronix.de> References: <1349709952-4332-1-git-send-email-u.kleine-koenig@pengutronix.de> <50739A2A.9070405@snapgear.com> <20121009084418.GH18531@pengutronix.de> <5073FE55.2000402@snapgear.com> <5077B167.40009@snapgear.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5077B167.40009@snapgear.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:6f8:1178:2:21e:67ff:fe11:9c5c X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mtd@lists.infradead.org X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.0 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.1 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: Artem Bityutskiy , linux-mtd@lists.infradead.org, kernel@pengutronix.de, Mike Frysinger , Greg Ungerer X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hello, On Fri, Oct 12, 2012 at 03:57:59PM +1000, Greg Ungerer wrote: > >so to be clear, Uwe's patch hasn't been picked up by anyone yet so we > >can get it fixed first ? ok, so for blackfin uclinux_ram_map must not be static because it is used in arch/blackfin/kernel/setup.c. If I tried to introduce such code for an ARM platform people would run away scared maybe after telling me I should fix my boot loader. I really don't know the situation on blackfin, but this really has potential for generalisation. But I don't even know if you have/need a boot loader at all there. Here is what I found quickly: If you had a boot loader, my patch (making the location of the uclinux map settable by a kernel parameter) should be a move in the right direction for you, too. I will fix my patch keeping uclinux_ram_map non-static and resend. Best regards Uwe diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index fb96e60..24478a2 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c @@ -583,7 +583,7 @@ static __init void memory_setup(void) #ifdef CONFIG_MPU /* Round up to multiple of 4MB */ - memory_start = (_ramstart + 0x3fffff) & ~0x3fffff; + memory_start = ALIGN(_ramstart, 0x400000); #else memory_start = PAGE_ALIGN(_ramstart); #endif @@ -593,6 +593,13 @@ static __init void memory_setup(void) memory_mtd_end = memory_end; mtd_phys = _ramstart; + + /* + * Since the default MTD_UCLINUX has no magic number, we just blindly + * read 8 past the end of the kernel's image, and look at it. + * When no image is attached, mtd_size is set to a random number. + * So do some basic sanity checks before operating on things. + */ mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 8))); # if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS) @@ -621,11 +628,6 @@ static __init void memory_setup(void) } # endif /* CONFIG_ROMFS_FS */ - /* Since the default MTD_UCLINUX has no magic number, we just blindly - * read 8 past the end of the kernel's image, and look at it. - * When no image is attached, mtd_size is set to a random number - * Do some basic sanity checks before operating on things - */ if (mtd_size == 0 || memory_end <= mtd_size) { pr_emerg("Could not find valid ram mtd attached.\n"); } else {