1 // SPDX-License-Identifier: GPL-2.0-only
3 * Arch related setup for Hexagon
5 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
8 #include <linux/init.h>
9 #include <linux/delay.h>
10 #include <linux/memblock.h>
11 #include <linux/mmzone.h>
13 #include <linux/seq_file.h>
14 #include <linux/console.h>
15 #include <linux/of_fdt.h>
17 #include <asm/sections.h>
18 #include <asm/setup.h>
19 #include <asm/processor.h>
20 #include <asm/hexagon_vm.h>
21 #include <asm/vm_mmu.h>
24 char cmd_line[COMMAND_LINE_SIZE];
25 static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
29 void calibrate_delay(void)
31 loops_per_jiffy = thread_freq_mhz * 1000000 / HZ;
35 * setup_arch - high level architectural setup routine
36 * @cmdline_p: pointer to pointer to command-line arguments
39 void __init setup_arch(char **cmdline_p)
41 char *p = &external_cmdline_buffer;
44 * These will eventually be pulled in via either some hypervisor
45 * or devicetree description. Hardwiring for now.
47 pcycle_freq_mhz = 600;
48 thread_freq_mhz = 100;
49 sleep_clk_freq = 32000;
52 * Set up event bindings to handle exceptions and interrupts.
54 __vmsetvec(_K_VM_event_vector);
56 printk(KERN_INFO "PHYS_OFFSET=0x%08lx\n", PHYS_OFFSET);
59 * Simulator has a few differences from the hardware.
60 * For now, check uninitialized-but-mapped memory
61 * prior to invoking setup_arch_memory().
63 if (*(int *)((unsigned long)_end + 8) == 0x1f1f1f1f)
69 strlcpy(boot_command_line, p, COMMAND_LINE_SIZE);
71 strlcpy(boot_command_line, default_command_line,
75 * boot_command_line and the value set up by setup_arch
76 * are both picked up by the init code. If no reason to
77 * make them different, pass the same pointer back.
79 strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
80 *cmdline_p = cmd_line;
92 * Functions for dumping CPU info via /proc
93 * Probably should move to kernel/proc.c or something.
95 static void *c_start(struct seq_file *m, loff_t *pos)
97 return *pos < nr_cpu_ids ? (void *)((unsigned long) *pos + 1) : NULL;
100 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
103 return c_start(m, pos);
106 static void c_stop(struct seq_file *m, void *v)
111 * Eventually this will dump information about
112 * CPU properties like ISA level, TLB size, etc.
114 static int show_cpuinfo(struct seq_file *m, void *v)
116 int cpu = (unsigned long) v - 1;
119 if (!cpu_online(cpu))
123 seq_printf(m, "processor\t: %d\n", cpu);
124 seq_printf(m, "model name\t: Hexagon Virtual Machine\n");
125 seq_printf(m, "BogoMips\t: %lu.%02lu\n",
126 (loops_per_jiffy * HZ) / 500000,
127 ((loops_per_jiffy * HZ) / 5000) % 100);
132 const struct seq_operations cpuinfo_op = {
136 .show = &show_cpuinfo,