| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 2 | /* |
| 3 | * init.c, Common initialization routines for NEC VR4100 series. |
| 4 | * |
| 5 | * Copyright (C) 2003-2009 Yoichi Yuasa <yuasa@linux-mips.org> |
| 6 | */ |
| 7 | #include <linux/init.h> |
| 8 | #include <linux/ioport.h> |
| 9 | #include <linux/irq.h> |
| 10 | #include <linux/string.h> |
| 11 | |
| 12 | #include <asm/bootinfo.h> |
| 13 | #include <asm/time.h> |
| 14 | #include <asm/vr41xx/irq.h> |
| 15 | #include <asm/vr41xx/vr41xx.h> |
| 16 | |
| 17 | #define IO_MEM_RESOURCE_START 0UL |
| 18 | #define IO_MEM_RESOURCE_END 0x1fffffffUL |
| 19 | |
| 20 | static void __init iomem_resource_init(void) |
| 21 | { |
| 22 | iomem_resource.start = IO_MEM_RESOURCE_START; |
| 23 | iomem_resource.end = IO_MEM_RESOURCE_END; |
| 24 | } |
| 25 | |
| 26 | void __init plat_time_init(void) |
| 27 | { |
| 28 | unsigned long tclock; |
| 29 | |
| 30 | vr41xx_calculate_clock_frequency(); |
| 31 | |
| 32 | tclock = vr41xx_get_tclock_frequency(); |
| 33 | if (current_cpu_data.processor_id == PRID_VR4131_REV2_0 || |
| 34 | current_cpu_data.processor_id == PRID_VR4131_REV2_1) |
| 35 | mips_hpt_frequency = tclock / 2; |
| 36 | else |
| 37 | mips_hpt_frequency = tclock / 4; |
| 38 | } |
| 39 | |
| 40 | void __init plat_mem_setup(void) |
| 41 | { |
| 42 | iomem_resource_init(); |
| 43 | |
| 44 | vr41xx_siu_setup(); |
| 45 | } |
| 46 | |
| 47 | void __init prom_init(void) |
| 48 | { |
| 49 | int argc, i; |
| 50 | char **argv; |
| 51 | |
| 52 | argc = fw_arg0; |
| 53 | argv = (char **)fw_arg1; |
| 54 | |
| 55 | for (i = 1; i < argc; i++) { |
| 56 | strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE); |
| 57 | if (i < (argc - 1)) |
| 58 | strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | void __init prom_free_prom_memory(void) |
| 63 | { |
| 64 | } |