spi-topcliff-pch: Fix issue for transmitting over 4KByte
[zen-stable.git] / arch / hexagon / kernel / setup.c
blob1202f78d25cb9ab8ca08f6ea339546424f20b497
1 /*
2 * Arch related setup for Hexagon
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
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.
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.
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.
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 #ifdef CONFIG_OF
36 #include <asm/prom.h>
37 #endif
39 char cmd_line[COMMAND_LINE_SIZE];
40 static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
42 int on_simulator;
44 void __cpuinit calibrate_delay(void)
46 loops_per_jiffy = thread_freq_mhz * 1000000 / HZ;
50 * setup_arch - high level architectural setup routine
51 * @cmdline_p: pointer to pointer to command-line arguments
54 void __init setup_arch(char **cmdline_p)
56 char *p = &external_cmdline_buffer;
59 * These will eventually be pulled in via either some hypervisor
60 * or devicetree description. Hardwiring for now.
62 pcycle_freq_mhz = 600;
63 thread_freq_mhz = 100;
64 sleep_clk_freq = 32000;
67 * Set up event bindings to handle exceptions and interrupts.
69 __vmsetvec(_K_VM_event_vector);
72 * Simulator has a few differences from the hardware.
73 * For now, check uninitialized-but-mapped memory
74 * prior to invoking setup_arch_memory().
76 if (*(int *)((unsigned long)_end + 8) == 0x1f1f1f1f)
77 on_simulator = 1;
78 else
79 on_simulator = 0;
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);
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.
92 strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
93 *cmdline_p = cmd_line;
95 parse_early_param();
97 setup_arch_memory();
99 #ifdef CONFIG_SMP
100 smp_start_cpus();
101 #endif
105 * Functions for dumping CPU info via /proc
106 * Probably should move to kernel/proc.c or something.
108 static void *c_start(struct seq_file *m, loff_t *pos)
110 return *pos < nr_cpu_ids ? (void *)((unsigned long) *pos + 1) : NULL;
113 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
115 ++*pos;
116 return c_start(m, pos);
119 static void c_stop(struct seq_file *m, void *v)
124 * Eventually this will dump information about
125 * CPU properties like ISA level, TLB size, etc.
127 static int show_cpuinfo(struct seq_file *m, void *v)
129 int cpu = (unsigned long) v - 1;
131 seq_printf(m, "processor\t: %d\n", cpu);
132 seq_printf(m, "model name\t: Hexagon Virtual Machine\n");
133 seq_printf(m, "BogoMips\t: %lu.%02lu\n",
134 (loops_per_jiffy * HZ) / 500000,
135 ((loops_per_jiffy * HZ) / 5000) % 100);
136 seq_printf(m, "\n");
137 return 0;
140 const struct seq_operations cpuinfo_op = {
141 .start = &c_start,
142 .next = &c_next,
143 .stop = &c_stop,
144 .show = &show_cpuinfo,