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

rogan at dawes.za.net
2011-03-18T08:10:01Z

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
+
+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;
--
1.7.1