linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] arm/imx6q: add core definitions and low-level debug uart
Date: Sat, 17 Sep 2011 12:59:41 +0100	[thread overview]
Message-ID: <20110917115941.GF16381@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20110912141440.GC7007@n2100.arm.linux.org.uk>

On Mon, Sep 12, 2011 at 03:14:41PM +0100, Russell King - ARM Linux wrote:
> On Mon, Sep 12, 2011 at 10:44:39AM +0200, Sascha Hauer wrote:
> > I vote to skip params_phys and initrd_phys now. Every recent bootloader
> > does not need them. As the i.MX6 is a new SoC, we have no reason to
> > handle legacy bootloaders.
> 
> Can we stop this misunderstanding right now.
> 
> It's NOT about legacy boot loaders.  It's about the bootp code which
> allows an initrd to be packaged up together with a zImage file as one
> single file.
> 
> That's used to be able to boot with an initrd on platforms which can
> only obtain one file from the boot media, and they specify where the
> parameters are expected to be (which can be solved by updating the
> code to use r2) and where to place the initrd image (which can't be
> solved as it would mean encoding memory information for every platform
> into the bootp code.)
> 
> An example of a current boot loader which requires this: Simtec's Able
> boot loader.

Here's a patch to reduce the reliance of arch/arm/boot/bootp on having
a correct initrd image location passed from the platform Makefile.boot.
It doesn't get rid of it, as it's required if the platform does not
pass a valid value in r2 to the kernel.

Note - I have a new code for a platform (of the nommu variety) which
requires this to be able to boot.  Also note that we're probably going
to have to find a way to make this work with DT too (if not then I may
be submitting this platform without DT any support.)

---
 arch/arm/boot/bootp/init.S |   34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/bootp/init.S b/arch/arm/boot/bootp/init.S
index 78b5080..d1cb5a9 100644
--- a/arch/arm/boot/bootp/init.S
+++ b/arch/arm/boot/bootp/init.S
@@ -16,6 +16,14 @@
  *  size immediately following the kernel, we could build this into
  *  a binary blob, and concatenate the zImage using the cat command.
  */
+
+#define ATAG_CORE 0x54410001
+#define ATAG_CORE_SIZE ((2*4 + 3*4) >> 2)
+#define ATAG_CORE_SIZE_EMPTY ((2*4) >> 2)
+
+#define ATAG_INITRD2 0x54420005
+#define ATAG_INITRD2_SIZE ((4*4) >> 2)
+
 		.section .start,#alloc,#execinstr
 		.type	_start, #function
 		.globl	_start
@@ -37,13 +45,31 @@ _start:		add	lr, pc, #-0x8		@ lr = current load addr
 						@ r8 = initrd end
 						@ r9 = param_struct address
 
+/*
+ * Check whether we were given a valid ATAG list from the boot loader.
+ * If it looks like a valid pointer, then use that rather than the
+ * hard-coded value.
+ */
+		tst	r2, #3			@ aligned
+		bne	1f
+		ldr	r10, [r2, #0]		@ get first tag size
+		teq	r10, #ATAG_CORE_SIZE
+		teqne	r10, #ATAG_CORE_SIZE_EMPTY
+		bne	1f
+		ldr	r10, [r2, #4]		@ get first tag type
+		teq	r10, r5			@ is it ATAG_CORE?
+		bne	1f
+		mov	r9, r2
+		b	taglist
+
+1:		mov	r2, r9			@ params for the kernel
 		ldr	r10, [r9, #4]		@ get first tag
 		teq	r10, r5			@ is it ATAG_CORE?
 /*
  * If we didn't find a valid tag list, create a dummy ATAG_CORE entry.
  */
 		movne	r10, #0			@ terminator
-		movne	r4, #2			@ Size of this entry (2 words)
+		movne	r4, #ATAG_CORE_SIZE_EMPTY @ Size of this entry (2 words)
 		stmneia	r9, {r4, r5, r10}	@ Size, ATAG_CORE, terminator
 
 /*
@@ -56,7 +82,7 @@ taglist:	ldr	r10, [r9, #0]		@ tag length
 		addne	r9, r9, r10, lsl #2
 		bne	taglist
 
-		mov	r5, #4			@ Size of initrd tag (4 words)
+		mov	r5, #ATAG_INITRD2_SIZE	@ Size of initrd tag (4 words)
 		stmia	r9, {r5, r6, r7, r8, r10}
 		b	kernel_start		@ call kernel
 
@@ -80,8 +106,8 @@ data:		.word	initrd_start		@ source initrd address
 		.word	initrd_phys		@ destination initrd address
 		.word	initrd_size		@ initrd size
 
-		.word	0x54410001		@ r5 = ATAG_CORE
-		.word	0x54420005		@ r6 = ATAG_INITRD2
+		.word	ATAG_CORE		@ r5
+		.word	ATAG_INITRD2		@ r6
 		.word	initrd_phys		@ r7
 		.word	initrd_size		@ r8
 		.word	params_phys		@ r9

  reply	other threads:[~2011-09-17 11:59 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-06  9:58 [PATCH 0/6] add initial imx6q support Shawn Guo
2011-09-06  9:58 ` [PATCH 1/6] arm/imx6q: add device tree source Shawn Guo
2011-09-06 18:31   ` Arnd Bergmann
2011-09-07 11:16     ` Shawn Guo
2011-09-06  9:58 ` [PATCH 2/6] arm/imx6q: add core definitions and low-level debug uart Shawn Guo
2011-09-06 18:39   ` Arnd Bergmann
2011-09-07  8:50     ` Shawn Guo
2011-09-06 20:25   ` Uwe Kleine-König
2011-09-07 11:00     ` Shawn Guo
2011-09-07 12:36       ` Uwe Kleine-König
2011-09-07 14:23         ` Russell King - ARM Linux
2011-09-07 15:36           ` Nicolas Pitre
2011-09-08 14:56             ` Arnd Bergmann
2011-09-09 17:28               ` Tony Lindgren
2011-09-12  2:30         ` Shawn Guo
2011-09-12  7:41           ` Uwe Kleine-König
2011-09-12  8:43             ` Shawn Guo
2011-09-12  8:44       ` Sascha Hauer
2011-09-12 11:36         ` Shawn Guo
2011-09-12 14:14         ` Russell King - ARM Linux
2011-09-17 11:59           ` Russell King - ARM Linux [this message]
2011-09-15  1:24     ` Shawn Guo
2011-09-06  9:58 ` [PATCH 3/6] arm/imx6q: add core drivers clock, gpc, mmdc and src Shawn Guo
2011-09-06 19:14   ` Arnd Bergmann
2011-09-07  6:05     ` Shawn Guo
2011-09-07  7:56       ` Arnd Bergmann
2011-09-12 16:12         ` Shawn Guo
2011-09-12 19:40           ` Grant Likely
2011-09-12 20:28             ` Arnd Bergmann
2011-09-12 21:04               ` Grant Likely
2011-09-13  0:07             ` Shawn Guo
2011-09-07 12:43       ` Barry Song
2011-09-08  6:48         ` Shawn Guo
2011-09-11  2:28           ` Barry Song
2011-09-12 19:16           ` Grant Likely
2011-09-12  9:46   ` Sascha Hauer
2011-09-12 11:49     ` Shawn Guo
2011-09-12 12:36       ` Uwe Kleine-König
2011-09-12 12:40         ` Arnd Bergmann
2011-09-12 14:27           ` Shawn Guo
2011-09-15  1:26             ` Shawn Guo
2011-09-06  9:58 ` [PATCH 4/6] arm/imx6q: add smp and cpu hotplug support Shawn Guo
2011-09-06 18:53   ` Arnd Bergmann
2011-09-07  4:41     ` Shawn Guo
2011-09-07  5:08       ` Shilimkar, Santosh
2011-09-07  7:46         ` Shawn Guo
2011-09-06  9:58 ` [PATCH 5/6] arm/imx6q: add device tree machine support Shawn Guo
2011-09-06 18:55   ` Arnd Bergmann
2011-09-07  3:07     ` Shawn Guo
2011-09-07  7:26       ` Arnd Bergmann
2011-09-06  9:58 ` [PATCH 6/6] arm/imx6q: add suspend/resume support Shawn Guo
2011-09-06 18:56   ` Arnd Bergmann
2011-09-07 13:50   ` Barry Song
2011-09-08  6:23     ` Shawn Guo
2011-09-08  7:47       ` Russell King - ARM Linux
2011-09-08 15:22         ` Shawn Guo
2011-09-08 16:24           ` Russell King - ARM Linux
2011-09-08 17:09             ` Lorenzo Pieralisi
2011-09-09  7:40               ` Shawn Guo
2011-09-09  6:31             ` Barry Song
2011-09-09  7:32             ` Shawn Guo
2011-09-09  8:15               ` Russell King - ARM Linux
2011-09-09 10:15                 ` Shawn Guo
2011-09-09 18:47                   ` Russell King - ARM Linux
2011-09-06 18:28 ` [PATCH 0/6] add initial imx6q support Arnd Bergmann
2011-09-06 19:42   ` Uwe Kleine-König
2011-09-07  2:55     ` Shawn Guo
2011-09-07  9:39       ` Arnd Bergmann
2011-09-07  2:51   ` Shawn Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110917115941.GF16381@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).