Linux Audio

Check our new training course

Loading...
v4.17
  1/*
  2 * Arch related setup for Hexagon
  3 *
  4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
  5 *
  6 * This program is free software; you can redistribute it and/or modify
  7 * it under the terms of the GNU General Public License version 2 and
  8 * only version 2 as published by the Free Software Foundation.
  9 *
 10 * This program is distributed in the hope that it will be useful,
 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13 * GNU General Public License for more details.
 14 *
 15 * You should have received a copy of the GNU General Public License
 16 * along with this program; if not, write to the Free Software
 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 18 * 02110-1301, USA.
 19 */
 20
 21#include <linux/init.h>
 22#include <linux/delay.h>
 23#include <linux/bootmem.h>
 24#include <linux/mmzone.h>
 25#include <linux/mm.h>
 26#include <linux/seq_file.h>
 27#include <linux/console.h>
 28#include <linux/of_fdt.h>
 29#include <asm/io.h>
 30#include <asm/sections.h>
 31#include <asm/setup.h>
 32#include <asm/processor.h>
 33#include <asm/hexagon_vm.h>
 34#include <asm/vm_mmu.h>
 35#include <asm/time.h>
 36
 37char cmd_line[COMMAND_LINE_SIZE];
 38static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
 39
 40int on_simulator;
 41
 42void calibrate_delay(void)
 43{
 44	loops_per_jiffy = thread_freq_mhz * 1000000 / HZ;
 45}
 46
 47/*
 48 * setup_arch -  high level architectural setup routine
 49 * @cmdline_p: pointer to pointer to command-line arguments
 50 */
 51
 52void __init setup_arch(char **cmdline_p)
 53{
 54	char *p = &external_cmdline_buffer;
 55
 56	/*
 57	 * These will eventually be pulled in via either some hypervisor
 58	 * or devicetree description.  Hardwiring for now.
 59	 */
 60	pcycle_freq_mhz = 600;
 61	thread_freq_mhz = 100;
 62	sleep_clk_freq = 32000;
 63
 64	/*
 65	 * Set up event bindings to handle exceptions and interrupts.
 66	 */
 67	__vmsetvec(_K_VM_event_vector);
 68
 69	printk(KERN_INFO "PHYS_OFFSET=0x%08x\n", PHYS_OFFSET);
 70
 71	/*
 72	 * Simulator has a few differences from the hardware.
 73	 * For now, check uninitialized-but-mapped memory
 74	 * prior to invoking setup_arch_memory().
 75	 */
 76	if (*(int *)((unsigned long)_end + 8) == 0x1f1f1f1f)
 77		on_simulator = 1;
 78	else
 79		on_simulator = 0;
 80
 81	if (p[0] != '\0')
 82		strlcpy(boot_command_line, p, COMMAND_LINE_SIZE);
 83	else
 84		strlcpy(boot_command_line, default_command_line,
 85			COMMAND_LINE_SIZE);
 86
 87	/*
 88	 * boot_command_line and the value set up by setup_arch
 89	 * are both picked up by the init code. If no reason to
 90	 * make them different, pass the same pointer back.
 91	 */
 92	strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
 93	*cmdline_p = cmd_line;
 94
 95	parse_early_param();
 96
 97	setup_arch_memory();
 98
 99#ifdef CONFIG_SMP
100	smp_start_cpus();
101#endif
102}
103
104/*
105 * Functions for dumping CPU info via /proc
106 * Probably should move to kernel/proc.c or something.
107 */
108static void *c_start(struct seq_file *m, loff_t *pos)
109{
110	return *pos < nr_cpu_ids ? (void *)((unsigned long) *pos + 1) : NULL;
111}
112
113static void *c_next(struct seq_file *m, void *v, loff_t *pos)
114{
115	++*pos;
116	return c_start(m, pos);
117}
118
119static void c_stop(struct seq_file *m, void *v)
120{
121}
122
123/*
124 * Eventually this will dump information about
125 * CPU properties like ISA level, TLB size, etc.
126 */
127static int show_cpuinfo(struct seq_file *m, void *v)
128{
129	int cpu = (unsigned long) v - 1;
130
131#ifdef CONFIG_SMP
132	if (!cpu_online(cpu))
133		return 0;
134#endif
135
136	seq_printf(m, "processor\t: %d\n", cpu);
137	seq_printf(m, "model name\t: Hexagon Virtual Machine\n");
138	seq_printf(m, "BogoMips\t: %lu.%02lu\n",
139		(loops_per_jiffy * HZ) / 500000,
140		((loops_per_jiffy * HZ) / 5000) % 100);
141	seq_printf(m, "\n");
142	return 0;
143}
144
145const struct seq_operations cpuinfo_op = {
146	.start  = &c_start,
147	.next   = &c_next,
148	.stop   = &c_stop,
149	.show   = &show_cpuinfo,
150};
v3.15
  1/*
  2 * Arch related setup for Hexagon
  3 *
  4 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
  5 *
  6 * This program is free software; you can redistribute it and/or modify
  7 * it under the terms of the GNU General Public License version 2 and
  8 * only version 2 as published by the Free Software Foundation.
  9 *
 10 * This program is distributed in the hope that it will be useful,
 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13 * GNU General Public License for more details.
 14 *
 15 * You should have received a copy of the GNU General Public License
 16 * along with this program; if not, write to the Free Software
 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 18 * 02110-1301, USA.
 19 */
 20
 21#include <linux/init.h>
 
 22#include <linux/bootmem.h>
 23#include <linux/mmzone.h>
 24#include <linux/mm.h>
 25#include <linux/seq_file.h>
 26#include <linux/console.h>
 27#include <linux/of_fdt.h>
 28#include <asm/io.h>
 29#include <asm/sections.h>
 30#include <asm/setup.h>
 31#include <asm/processor.h>
 32#include <asm/hexagon_vm.h>
 33#include <asm/vm_mmu.h>
 34#include <asm/time.h>
 35
 36char cmd_line[COMMAND_LINE_SIZE];
 37static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
 38
 39int on_simulator;
 40
 41void calibrate_delay(void)
 42{
 43	loops_per_jiffy = thread_freq_mhz * 1000000 / HZ;
 44}
 45
 46/*
 47 * setup_arch -  high level architectural setup routine
 48 * @cmdline_p: pointer to pointer to command-line arguments
 49 */
 50
 51void __init setup_arch(char **cmdline_p)
 52{
 53	char *p = &external_cmdline_buffer;
 54
 55	/*
 56	 * These will eventually be pulled in via either some hypervisor
 57	 * or devicetree description.  Hardwiring for now.
 58	 */
 59	pcycle_freq_mhz = 600;
 60	thread_freq_mhz = 100;
 61	sleep_clk_freq = 32000;
 62
 63	/*
 64	 * Set up event bindings to handle exceptions and interrupts.
 65	 */
 66	__vmsetvec(_K_VM_event_vector);
 67
 68	printk(KERN_INFO "PHYS_OFFSET=0x%08x\n", PHYS_OFFSET);
 69
 70	/*
 71	 * Simulator has a few differences from the hardware.
 72	 * For now, check uninitialized-but-mapped memory
 73	 * prior to invoking setup_arch_memory().
 74	 */
 75	if (*(int *)((unsigned long)_end + 8) == 0x1f1f1f1f)
 76		on_simulator = 1;
 77	else
 78		on_simulator = 0;
 79
 80	if (p[0] != '\0')
 81		strlcpy(boot_command_line, p, COMMAND_LINE_SIZE);
 82	else
 83		strlcpy(boot_command_line, default_command_line,
 84			COMMAND_LINE_SIZE);
 85
 86	/*
 87	 * boot_command_line and the value set up by setup_arch
 88	 * are both picked up by the init code. If no reason to
 89	 * make them different, pass the same pointer back.
 90	 */
 91	strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
 92	*cmdline_p = cmd_line;
 93
 94	parse_early_param();
 95
 96	setup_arch_memory();
 97
 98#ifdef CONFIG_SMP
 99	smp_start_cpus();
100#endif
101}
102
103/*
104 * Functions for dumping CPU info via /proc
105 * Probably should move to kernel/proc.c or something.
106 */
107static void *c_start(struct seq_file *m, loff_t *pos)
108{
109	return *pos < nr_cpu_ids ? (void *)((unsigned long) *pos + 1) : NULL;
110}
111
112static void *c_next(struct seq_file *m, void *v, loff_t *pos)
113{
114	++*pos;
115	return c_start(m, pos);
116}
117
118static void c_stop(struct seq_file *m, void *v)
119{
120}
121
122/*
123 * Eventually this will dump information about
124 * CPU properties like ISA level, TLB size, etc.
125 */
126static int show_cpuinfo(struct seq_file *m, void *v)
127{
128	int cpu = (unsigned long) v - 1;
129
130#ifdef CONFIG_SMP
131	if (!cpu_online(cpu))
132		return 0;
133#endif
134
135	seq_printf(m, "processor\t: %d\n", cpu);
136	seq_printf(m, "model name\t: Hexagon Virtual Machine\n");
137	seq_printf(m, "BogoMips\t: %lu.%02lu\n",
138		(loops_per_jiffy * HZ) / 500000,
139		((loops_per_jiffy * HZ) / 5000) % 100);
140	seq_printf(m, "\n");
141	return 0;
142}
143
144const struct seq_operations cpuinfo_op = {
145	.start  = &c_start,
146	.next   = &c_next,
147	.stop   = &c_stop,
148	.show   = &show_cpuinfo,
149};