Patchwork [U-Boot,5/7] Support passing a Marvell-specific ATAG

login
register
mail settings
Submitter Rogan Dawes
Date March 18, 2011, 8:10 a.m.
Message ID <1300435803-4940-6-git-send-email-rogan@dawes.za.net>
Download mbox | patch
Permalink /patch/87504/
State Rejected
Headers show

Comments

Rogan Dawes - March 18, 2011, 8:10 a.m.
From: Rogan Dawes <rogan@dawes.za.net>

---
 arch/arm/include/asm/setup.h |   18 ++++++++++++++++++
 arch/arm/lib/bootm.c         |   31 +++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 0 deletions(-)
Prafulla Wadaskar - March 18, 2011, 10:44 a.m.
> -----Original Message-----
> From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de]
> On Behalf Of rogan@dawes.za.net
> Sent: Friday, March 18, 2011 1:40 PM
> To: u-boot@lists.denx.de
> Subject: [U-Boot] [PATCH 5/7] Support passing a Marvell-specific ATAG
> 
> From: Rogan Dawes <rogan@dawes.za.net>
> 
> ---
>  arch/arm/include/asm/setup.h |   18 ++++++++++++++++++
>  arch/arm/lib/bootm.c         |   31 +++++++++++++++++++++++++++++++
>  2 files changed, 49 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
> index 89df4dc..bd6229a 100644
> --- a/arch/arm/include/asm/setup.h
> +++ b/arch/arm/include/asm/setup.h
> @@ -198,6 +198,19 @@ struct tag_acorn {
>  	u8 adfsdrives;
>  };
> 
> +/* Marvell specific information
> + * requred for compatability with vendor kernels
> + */
> +#define ATAG_MV_UBOOT   0x41000403

What is a need for this ATAG?
Open source Linux Kernel does not have any implementation to support this ATAG.
Nor u-boot have any vendor specific ATAGs

NACK, if this is specific to support any custom implementation.

Regards..
Prafulla . .
Rogan Dawes - March 18, 2011, 11:44 a.m.
On 2011/03/18 12:44 PM, Prafulla Wadaskar wrote:
> 
>> +/* Marvell specific information
>> + * requred for compatability with vendor kernels
>> + */
>> +#define ATAG_MV_UBOOT   0x41000403
> 
> What is a need for this ATAG?
> Open source Linux Kernel does not have any implementation to support this ATAG.
> Nor u-boot have any vendor specific ATAGs
> 
> NACK, if this is specific to support any custom implementation.
> 
> Regards..
> Prafulla . .

Hi Prafulla,

I was simply trying to mirror what the vendor U-Boot was passing to the
vendor kernel flashed on the device. My theory was that by comparing the
boot logs of the vendor U-Boot and vendor kernel, with the boot logs of
custom U-Boot and vendor kernel, I could make sure that my custom U-Boot
was doing the right thing. Including this ATAG allowed my to obtain
identical kernel boot logs.

That said, I'm happy to leave this portion out if it is not acceptable.
Especially if mainline kernel doesn't recognise that ATAG anyway.

Regards,

Rogan

Patch

diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index 89df4dc..bd6229a 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -198,6 +198,19 @@  struct tag_acorn {
 	u8 adfsdrives;
 };
 
+/* Marvell specific information
+ * requred for compatability with vendor kernels
+ */
+#define ATAG_MV_UBOOT   0x41000403
+ 
+struct tag_mv_uboot {
+	u32 uboot_version;
+	u32 tclk;
+	u32 sysclk;
+	u32 isUsbHost;
+	u32 overEthAddr;
+};
+
 /* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */
 #define ATAG_MEMCLK	0x41000402
 
@@ -227,6 +240,11 @@  struct tag {
 		 * DC21285 specific
 		 */
 		struct tag_memclk	memclk;
+
+		/*
+		 * Marvell specific
+		 */
+		struct tag_mv_uboot	mv_uboot;
 	} u;
 };
 
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 7734953..9b4aaa1 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -48,6 +48,11 @@  static void setup_commandline_tag (bd_t *bd, char *commandline);
 static void setup_initrd_tag (bd_t *bd, ulong initrd_start,
 			      ulong initrd_end);
 # endif
+
+#ifdef CONFIG_MARVELL_TAG
+static void setup_marvell_tag(void);
+#endif
+
 static void setup_end_tag (bd_t *bd);
 
 static struct tag *params;
@@ -128,6 +133,7 @@  int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 #if defined (CONFIG_SETUP_MEMORY_TAGS) || \
     defined (CONFIG_CMDLINE_TAG) || \
     defined (CONFIG_INITRD_TAG) || \
+    defined (CONFIG_MARVELL_TAG) || \
     defined (CONFIG_SERIAL_TAG) || \
     defined (CONFIG_REVISION_TAG)
 	setup_start_tag (bd);
@@ -147,6 +153,9 @@  int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 	if (images->rd_start && images->rd_end)
 		setup_initrd_tag (bd, images->rd_start, images->rd_end);
 #endif
+#ifdef CONFIG_MARVELL_TAG
+	setup_marvell_tag();
+#endif
 	setup_end_tag(bd);
 #endif
 
@@ -327,6 +336,28 @@  void setup_revision_tag(struct tag **in_params)
 }
 #endif  /* CONFIG_REVISION_TAG */
 
+#ifdef CONFIG_MARVELL_TAG
+#define ATAG_MARVELL	0x41000403
+#define VER_NUM 	0x01070300
+
+void setup_marvell_tag(void) {
+	debug("Setting up Marvell tag\n");
+	params->hdr.tag = ATAG_MARVELL;
+	params->hdr.size = tag_size (tag_mv_uboot);
+
+	params->u.mv_uboot.uboot_version = VER_NUM;
+	params->u.mv_uboot.uboot_version |= 0xB; // RD_88F5182_2XSATA
+	params->u.mv_uboot.tclk = 166000000;
+	params->u.mv_uboot.sysclk = 166000000;
+	params->u.mv_uboot.isUsbHost = 1;
+	params->u.mv_uboot.isUsbHost |= 2;
+
+	params->u.mv_uboot.overEthAddr = 0;
+
+	params = tag_next (params);
+}
+#endif
+
 static void setup_end_tag (bd_t *bd)
 {
 	params->hdr.tag = ATAG_NONE;