2019-06-04 11:11:33 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2013-01-21 01:01:05 +04:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
|
|
|
|
* Copyright (C) 2010 Joonas Lahtinen <joonas.lahtinen@gmail.com>
|
2016-05-05 10:57:56 +03:00
|
|
|
* Copyright (C) 2013 John Crispin <john@phrozen.org>
|
2013-01-21 01:01:05 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/of_fdt.h>
|
|
|
|
#include <linux/of_platform.h>
|
|
|
|
|
|
|
|
#include <asm/bootinfo.h>
|
|
|
|
#include <asm/addrspace.h>
|
|
|
|
|
2015-11-04 13:50:07 +03:00
|
|
|
#include <asm/mach-ralink/ralink_regs.h>
|
|
|
|
|
2013-01-21 01:01:05 +04:00
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
struct ralink_soc_info soc_info;
|
|
|
|
|
2015-11-04 13:50:07 +03:00
|
|
|
enum ralink_soc_type ralink_soc;
|
|
|
|
EXPORT_SYMBOL_GPL(ralink_soc);
|
|
|
|
|
2013-01-21 01:01:05 +04:00
|
|
|
const char *get_system_type(void)
|
|
|
|
{
|
|
|
|
return soc_info.sys_type;
|
|
|
|
}
|
|
|
|
|
2016-12-20 21:12:46 +03:00
|
|
|
static __init void prom_init_cmdline(void)
|
2013-01-21 01:01:05 +04:00
|
|
|
{
|
2016-12-20 21:12:46 +03:00
|
|
|
int argc;
|
|
|
|
char **argv;
|
2013-01-21 01:01:05 +04:00
|
|
|
int i;
|
|
|
|
|
|
|
|
pr_debug("prom: fw_arg0=%08x fw_arg1=%08x fw_arg2=%08x fw_arg3=%08x\n",
|
|
|
|
(unsigned int)fw_arg0, (unsigned int)fw_arg1,
|
|
|
|
(unsigned int)fw_arg2, (unsigned int)fw_arg3);
|
|
|
|
|
|
|
|
argc = fw_arg0;
|
|
|
|
argv = (char **) KSEG1ADDR(fw_arg1);
|
|
|
|
|
|
|
|
if (!argv) {
|
|
|
|
pr_debug("argv=%p is invalid, skipping\n",
|
|
|
|
argv);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < argc; i++) {
|
|
|
|
char *p = (char *) KSEG1ADDR(argv[i]);
|
|
|
|
|
|
|
|
if (CPHYSADDR(p) && *p) {
|
|
|
|
pr_debug("argv[%d]: %s\n", i, p);
|
|
|
|
strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
|
|
|
|
strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void __init prom_init(void)
|
|
|
|
{
|
|
|
|
prom_soc_init(&soc_info);
|
|
|
|
|
|
|
|
pr_info("SoC Type: %s\n", get_system_type());
|
|
|
|
|
2016-12-20 21:12:46 +03:00
|
|
|
prom_init_cmdline();
|
2013-01-21 01:01:05 +04:00
|
|
|
}
|