18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  init.c, Common initialization routines for NEC VR4100 series.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 2003-2009  Yoichi Yuasa <yuasa@linux-mips.org>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci#include <linux/init.h>
88c2ecf20Sopenharmony_ci#include <linux/ioport.h>
98c2ecf20Sopenharmony_ci#include <linux/irq.h>
108c2ecf20Sopenharmony_ci#include <linux/string.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <asm/bootinfo.h>
138c2ecf20Sopenharmony_ci#include <asm/time.h>
148c2ecf20Sopenharmony_ci#include <asm/vr41xx/irq.h>
158c2ecf20Sopenharmony_ci#include <asm/vr41xx/vr41xx.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define IO_MEM_RESOURCE_START	0UL
188c2ecf20Sopenharmony_ci#define IO_MEM_RESOURCE_END	0x1fffffffUL
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistatic void __init iomem_resource_init(void)
218c2ecf20Sopenharmony_ci{
228c2ecf20Sopenharmony_ci	iomem_resource.start = IO_MEM_RESOURCE_START;
238c2ecf20Sopenharmony_ci	iomem_resource.end = IO_MEM_RESOURCE_END;
248c2ecf20Sopenharmony_ci}
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_civoid __init plat_time_init(void)
278c2ecf20Sopenharmony_ci{
288c2ecf20Sopenharmony_ci	unsigned long tclock;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	vr41xx_calculate_clock_frequency();
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci	tclock = vr41xx_get_tclock_frequency();
338c2ecf20Sopenharmony_ci	if (current_cpu_data.processor_id == PRID_VR4131_REV2_0 ||
348c2ecf20Sopenharmony_ci	    current_cpu_data.processor_id == PRID_VR4131_REV2_1)
358c2ecf20Sopenharmony_ci		mips_hpt_frequency = tclock / 2;
368c2ecf20Sopenharmony_ci	else
378c2ecf20Sopenharmony_ci		mips_hpt_frequency = tclock / 4;
388c2ecf20Sopenharmony_ci}
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_civoid __init plat_mem_setup(void)
418c2ecf20Sopenharmony_ci{
428c2ecf20Sopenharmony_ci	iomem_resource_init();
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	vr41xx_siu_setup();
458c2ecf20Sopenharmony_ci}
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_civoid __init prom_init(void)
488c2ecf20Sopenharmony_ci{
498c2ecf20Sopenharmony_ci	int argc, i;
508c2ecf20Sopenharmony_ci	char **argv;
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci	argc = fw_arg0;
538c2ecf20Sopenharmony_ci	argv = (char **)fw_arg1;
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci	for (i = 1; i < argc; i++) {
568c2ecf20Sopenharmony_ci		strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE);
578c2ecf20Sopenharmony_ci		if (i < (argc - 1))
588c2ecf20Sopenharmony_ci			strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
598c2ecf20Sopenharmony_ci	}
608c2ecf20Sopenharmony_ci}
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_civoid __init prom_free_prom_memory(void)
638c2ecf20Sopenharmony_ci{
648c2ecf20Sopenharmony_ci}
65