xref: /openbmc/linux/arch/sh/include/asm/processor.h (revision e82da214d2fe3dc2610df966100c4f36bc0fad91)
1f15cbe6fSPaul Mundt #ifndef __ASM_SH_PROCESSOR_H
2f15cbe6fSPaul Mundt #define __ASM_SH_PROCESSOR_H
3f15cbe6fSPaul Mundt 
4f15cbe6fSPaul Mundt #include <asm/cpu-features.h>
5f15cbe6fSPaul Mundt #include <asm/segment.h>
681b66995SPaul Mundt #include <asm/cache.h>
7f15cbe6fSPaul Mundt 
8f15cbe6fSPaul Mundt #ifndef __ASSEMBLY__
9f15cbe6fSPaul Mundt /*
10f15cbe6fSPaul Mundt  *  CPU type and hardware bug flags. Kept separately for each CPU.
11f15cbe6fSPaul Mundt  *
12f15cbe6fSPaul Mundt  *  Each one of these also needs a CONFIG_CPU_SUBTYPE_xxx entry
13f15cbe6fSPaul Mundt  *  in arch/sh/mm/Kconfig, as well as an entry in arch/sh/kernel/setup.c
14f15cbe6fSPaul Mundt  *  for parsing the subtype in get_cpu_subtype().
15f15cbe6fSPaul Mundt  */
16f15cbe6fSPaul Mundt enum cpu_type {
17f15cbe6fSPaul Mundt 	/* SH-2 types */
18f15cbe6fSPaul Mundt 	CPU_SH7619,
19f15cbe6fSPaul Mundt 
20f15cbe6fSPaul Mundt 	/* SH-2A types */
212825999eSPeter Griffin 	CPU_SH7201, CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_MXG,
22f15cbe6fSPaul Mundt 
23f15cbe6fSPaul Mundt 	/* SH-3 types */
24f15cbe6fSPaul Mundt 	CPU_SH7705, CPU_SH7706, CPU_SH7707,
25f15cbe6fSPaul Mundt 	CPU_SH7708, CPU_SH7708S, CPU_SH7708R,
26f15cbe6fSPaul Mundt 	CPU_SH7709, CPU_SH7709A, CPU_SH7710, CPU_SH7712,
27f15cbe6fSPaul Mundt 	CPU_SH7720, CPU_SH7721, CPU_SH7729,
28f15cbe6fSPaul Mundt 
29f15cbe6fSPaul Mundt 	/* SH-4 types */
30f15cbe6fSPaul Mundt 	CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
31f15cbe6fSPaul Mundt 	CPU_SH7760, CPU_SH4_202, CPU_SH4_501,
32f15cbe6fSPaul Mundt 
33f15cbe6fSPaul Mundt 	/* SH-4A types */
3455ba99ebSKuninori Morimoto 	CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SH7786,
350207a2efSKuninori Morimoto 	CPU_SH7723, CPU_SH7724, CPU_SHX3,
36f15cbe6fSPaul Mundt 
37f15cbe6fSPaul Mundt 	/* SH4AL-DSP types */
38f15cbe6fSPaul Mundt 	CPU_SH7343, CPU_SH7722, CPU_SH7366,
39f15cbe6fSPaul Mundt 
40f15cbe6fSPaul Mundt 	/* SH-5 types */
41f15cbe6fSPaul Mundt         CPU_SH5_101, CPU_SH5_103,
42f15cbe6fSPaul Mundt 
43f15cbe6fSPaul Mundt 	/* Unknown subtype */
44f15cbe6fSPaul Mundt 	CPU_SH_NONE
45f15cbe6fSPaul Mundt };
46f15cbe6fSPaul Mundt 
47*e82da214SPaul Mundt enum cpu_family {
48*e82da214SPaul Mundt 	CPU_FAMILY_SH2,
49*e82da214SPaul Mundt 	CPU_FAMILY_SH2A,
50*e82da214SPaul Mundt 	CPU_FAMILY_SH3,
51*e82da214SPaul Mundt 	CPU_FAMILY_SH4,
52*e82da214SPaul Mundt 	CPU_FAMILY_SH4A,
53*e82da214SPaul Mundt 	CPU_FAMILY_SH4AL_DSP,
54*e82da214SPaul Mundt 	CPU_FAMILY_SH5,
55*e82da214SPaul Mundt 	CPU_FAMILY_UNKNOWN,
56*e82da214SPaul Mundt };
57*e82da214SPaul Mundt 
5881b66995SPaul Mundt /*
5981b66995SPaul Mundt  * TLB information structure
6081b66995SPaul Mundt  *
6181b66995SPaul Mundt  * Defined for both I and D tlb, per-processor.
6281b66995SPaul Mundt  */
6381b66995SPaul Mundt struct tlb_info {
6481b66995SPaul Mundt 	unsigned long long next;
6581b66995SPaul Mundt 	unsigned long long first;
6681b66995SPaul Mundt 	unsigned long long last;
6781b66995SPaul Mundt 
6881b66995SPaul Mundt 	unsigned int entries;
6981b66995SPaul Mundt 	unsigned int step;
7081b66995SPaul Mundt 
7181b66995SPaul Mundt 	unsigned long flags;
7281b66995SPaul Mundt };
7381b66995SPaul Mundt 
7481b66995SPaul Mundt struct sh_cpuinfo {
75*e82da214SPaul Mundt 	unsigned int type, family;
7681b66995SPaul Mundt 	int cut_major, cut_minor;
7781b66995SPaul Mundt 	unsigned long loops_per_jiffy;
7881b66995SPaul Mundt 	unsigned long asid_cache;
7981b66995SPaul Mundt 
8081b66995SPaul Mundt 	struct cache_info icache;	/* Primary I-cache */
8181b66995SPaul Mundt 	struct cache_info dcache;	/* Primary D-cache */
8281b66995SPaul Mundt 	struct cache_info scache;	/* Secondary cache */
8381b66995SPaul Mundt 
8481b66995SPaul Mundt 	/* TLB info */
8581b66995SPaul Mundt 	struct tlb_info itlb;
8681b66995SPaul Mundt 	struct tlb_info dtlb;
8781b66995SPaul Mundt 
8881b66995SPaul Mundt 	unsigned long flags;
8981b66995SPaul Mundt } __attribute__ ((aligned(L1_CACHE_BYTES)));
9081b66995SPaul Mundt 
9181b66995SPaul Mundt extern struct sh_cpuinfo cpu_data[];
9281b66995SPaul Mundt #define boot_cpu_data cpu_data[0]
9381b66995SPaul Mundt #define current_cpu_data cpu_data[smp_processor_id()]
9481b66995SPaul Mundt #define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
9581b66995SPaul Mundt 
96eb67cf14SPaul Mundt #define cpu_sleep()	__asm__ __volatile__ ("sleep" : : : "memory")
97eb67cf14SPaul Mundt #define cpu_relax()	barrier()
98eb67cf14SPaul Mundt 
99f15cbe6fSPaul Mundt /* Forward decl */
100fa43972fSPaul Mundt struct seq_operations;
101fa43972fSPaul Mundt 
102fa43972fSPaul Mundt extern struct pt_regs fake_swapper_regs;
103f15cbe6fSPaul Mundt 
104f15cbe6fSPaul Mundt /* arch/sh/kernel/setup.c */
105f15cbe6fSPaul Mundt const char *get_cpu_subtype(struct sh_cpuinfo *c);
106fa43972fSPaul Mundt extern const struct seq_operations cpuinfo_op;
107f15cbe6fSPaul Mundt 
108eb9b9b56SMagnus Damm /* processor boot mode configuration */
1090d4fdbb6SMagnus Damm #define MODE_PIN0 (1 << 0)
1100d4fdbb6SMagnus Damm #define MODE_PIN1 (1 << 1)
1110d4fdbb6SMagnus Damm #define MODE_PIN2 (1 << 2)
1120d4fdbb6SMagnus Damm #define MODE_PIN3 (1 << 3)
1130d4fdbb6SMagnus Damm #define MODE_PIN4 (1 << 4)
1140d4fdbb6SMagnus Damm #define MODE_PIN5 (1 << 5)
1150d4fdbb6SMagnus Damm #define MODE_PIN6 (1 << 6)
1160d4fdbb6SMagnus Damm #define MODE_PIN7 (1 << 7)
1170d4fdbb6SMagnus Damm #define MODE_PIN8 (1 << 8)
1180d4fdbb6SMagnus Damm #define MODE_PIN9 (1 << 9)
1190d4fdbb6SMagnus Damm #define MODE_PIN10 (1 << 10)
1200d4fdbb6SMagnus Damm #define MODE_PIN11 (1 << 11)
1210d4fdbb6SMagnus Damm #define MODE_PIN12 (1 << 12)
1220d4fdbb6SMagnus Damm #define MODE_PIN13 (1 << 13)
1230d4fdbb6SMagnus Damm #define MODE_PIN14 (1 << 14)
1240d4fdbb6SMagnus Damm #define MODE_PIN15 (1 << 15)
1250d4fdbb6SMagnus Damm 
126eb9b9b56SMagnus Damm int generic_mode_pins(void);
127eb9b9b56SMagnus Damm int test_mode_pin(int pin);
128eb9b9b56SMagnus Damm 
129f15cbe6fSPaul Mundt #ifdef CONFIG_VSYSCALL
130f15cbe6fSPaul Mundt int vsyscall_init(void);
131f15cbe6fSPaul Mundt #else
132f15cbe6fSPaul Mundt #define vsyscall_init() do { } while (0)
133f15cbe6fSPaul Mundt #endif
134f15cbe6fSPaul Mundt 
135f15cbe6fSPaul Mundt #endif /* __ASSEMBLY__ */
136f15cbe6fSPaul Mundt 
137f15cbe6fSPaul Mundt #ifdef CONFIG_SUPERH32
138f15cbe6fSPaul Mundt # include "processor_32.h"
139f15cbe6fSPaul Mundt #else
140f15cbe6fSPaul Mundt # include "processor_64.h"
141f15cbe6fSPaul Mundt #endif
142f15cbe6fSPaul Mundt 
143f15cbe6fSPaul Mundt #endif /* __ASM_SH_PROCESSOR_H */
144