1 From 36424b3f1f184c752562d19d0df1a427c8c584a2 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sun, 20 Jan 2013 22:01:05 +0100
4 Subject: [PATCH 04/79] MIPS: ralink: adds prom and cmdline code
6 Add minimal code to handle commandlines.
8 Signed-off-by: John Crispin <blogic@openwrt.org>
9 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
10 Patchwork: http://patchwork.linux-mips.org/patch/4892/
12 arch/mips/ralink/prom.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++
13 1 file changed, 69 insertions(+)
14 create mode 100644 arch/mips/ralink/prom.c
16 diff --git a/arch/mips/ralink/prom.c b/arch/mips/ralink/prom.c
18 index 0000000..9c64f02
20 +++ b/arch/mips/ralink/prom.c
23 + * This program is free software; you can redistribute it and/or modify it
24 + * under the terms of the GNU General Public License version 2 as published
25 + * by the Free Software Foundation.
27 + * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
28 + * Copyright (C) 2010 Joonas Lahtinen <joonas.lahtinen@gmail.com>
29 + * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
32 +#include <linux/string.h>
33 +#include <linux/of_fdt.h>
34 +#include <linux/of_platform.h>
36 +#include <asm/bootinfo.h>
37 +#include <asm/addrspace.h>
41 +struct ralink_soc_info soc_info;
43 +const char *get_system_type(void)
45 + return soc_info.sys_type;
48 +static __init void prom_init_cmdline(int argc, char **argv)
52 + pr_debug("prom: fw_arg0=%08x fw_arg1=%08x fw_arg2=%08x fw_arg3=%08x\n",
53 + (unsigned int)fw_arg0, (unsigned int)fw_arg1,
54 + (unsigned int)fw_arg2, (unsigned int)fw_arg3);
57 + argv = (char **) KSEG1ADDR(fw_arg1);
60 + pr_debug("argv=%p is invalid, skipping\n",
65 + for (i = 0; i < argc; i++) {
66 + char *p = (char *) KSEG1ADDR(argv[i]);
68 + if (CPHYSADDR(p) && *p) {
69 + pr_debug("argv[%d]: %s\n", i, p);
70 + strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
71 + strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
76 +void __init prom_init(void)
81 + prom_soc_init(&soc_info);
83 + pr_info("SoC Type: %s\n", get_system_type());
85 + prom_init_cmdline(argc, argv);
88 +void __init prom_free_prom_memory(void)