diff options
author | Markos Chandras <markos.chandras@imgtec.com> | 2014-07-18 05:51:32 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-09-22 07:35:53 -0400 |
commit | 4f12b91d2da577d81c580da62373fd37b31e0da1 (patch) | |
tree | cb479c8808fdb05a00fa7d816fea0e5af4cbcfbb | |
parent | 80bc94d10466c710158d5f30c43625ed9fa59e78 (diff) |
MIPS: cpu-probe: Set the write-combine CCA value on per core basis
Different cores use different CCA values to achieve write-combine
memory writes. For cores that do not support write-combine we
set the default value to CCA:2 (uncached, non-coherent) which is the
default value as set by the kernel.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7402/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/include/asm/cpu-info.h | 5 | ||||
-rw-r--r-- | arch/mips/kernel/cpu-probe.c | 21 |
2 files changed, 26 insertions, 0 deletions
diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h index d5f42c168001..a6c9ccb33c5c 100644 --- a/arch/mips/include/asm/cpu-info.h +++ b/arch/mips/include/asm/cpu-info.h | |||
@@ -79,6 +79,11 @@ struct cpuinfo_mips { | |||
79 | #define NUM_WATCH_REGS 4 | 79 | #define NUM_WATCH_REGS 4 |
80 | u16 watch_reg_masks[NUM_WATCH_REGS]; | 80 | u16 watch_reg_masks[NUM_WATCH_REGS]; |
81 | unsigned int kscratch_mask; /* Usable KScratch mask. */ | 81 | unsigned int kscratch_mask; /* Usable KScratch mask. */ |
82 | /* | ||
83 | * Cache Coherency attribute for write-combine memory writes. | ||
84 | * (shifted by _CACHE_SHIFT) | ||
85 | */ | ||
86 | unsigned int writecombine; | ||
82 | } __attribute__((aligned(SMP_CACHE_BYTES))); | 87 | } __attribute__((aligned(SMP_CACHE_BYTES))); |
83 | 88 | ||
84 | extern struct cpuinfo_mips cpu_data[]; | 89 | extern struct cpuinfo_mips cpu_data[]; |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index e34b10be782e..94c4a0c0a577 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/msa.h> | 27 | #include <asm/msa.h> |
28 | #include <asm/watch.h> | 28 | #include <asm/watch.h> |
29 | #include <asm/elf.h> | 29 | #include <asm/elf.h> |
30 | #include <asm/pgtable-bits.h> | ||
30 | #include <asm/spram.h> | 31 | #include <asm/spram.h> |
31 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
32 | 33 | ||
@@ -764,6 +765,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
764 | break; | 765 | break; |
765 | case PRID_REV_LOONGSON3A: | 766 | case PRID_REV_LOONGSON3A: |
766 | c->cputype = CPU_LOONGSON3; | 767 | c->cputype = CPU_LOONGSON3; |
768 | c->writecombine = _CACHE_UNCACHED_ACCELERATED; | ||
767 | __cpu_name[cpu] = "ICT Loongson-3"; | 769 | __cpu_name[cpu] = "ICT Loongson-3"; |
768 | set_elf_platform(cpu, "loongson3a"); | 770 | set_elf_platform(cpu, "loongson3a"); |
769 | break; | 771 | break; |
@@ -798,67 +800,83 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
798 | 800 | ||
799 | static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) | 801 | static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) |
800 | { | 802 | { |
803 | c->writecombine = _CACHE_UNCACHED_ACCELERATED; | ||
801 | switch (c->processor_id & PRID_IMP_MASK) { | 804 | switch (c->processor_id & PRID_IMP_MASK) { |
802 | case PRID_IMP_4KC: | 805 | case PRID_IMP_4KC: |
803 | c->cputype = CPU_4KC; | 806 | c->cputype = CPU_4KC; |
807 | c->writecombine = _CACHE_UNCACHED; | ||
804 | __cpu_name[cpu] = "MIPS 4Kc"; | 808 | __cpu_name[cpu] = "MIPS 4Kc"; |
805 | break; | 809 | break; |
806 | case PRID_IMP_4KEC: | 810 | case PRID_IMP_4KEC: |
807 | case PRID_IMP_4KECR2: | 811 | case PRID_IMP_4KECR2: |
808 | c->cputype = CPU_4KEC; | 812 | c->cputype = CPU_4KEC; |
813 | c->writecombine = _CACHE_UNCACHED; | ||
809 | __cpu_name[cpu] = "MIPS 4KEc"; | 814 | __cpu_name[cpu] = "MIPS 4KEc"; |
810 | break; | 815 | break; |
811 | case PRID_IMP_4KSC: | 816 | case PRID_IMP_4KSC: |
812 | case PRID_IMP_4KSD: | 817 | case PRID_IMP_4KSD: |
813 | c->cputype = CPU_4KSC; | 818 | c->cputype = CPU_4KSC; |
819 | c->writecombine = _CACHE_UNCACHED; | ||
814 | __cpu_name[cpu] = "MIPS 4KSc"; | 820 | __cpu_name[cpu] = "MIPS 4KSc"; |
815 | break; | 821 | break; |
816 | case PRID_IMP_5KC: | 822 | case PRID_IMP_5KC: |
817 | c->cputype = CPU_5KC; | 823 | c->cputype = CPU_5KC; |
824 | c->writecombine = _CACHE_UNCACHED; | ||
818 | __cpu_name[cpu] = "MIPS 5Kc"; | 825 | __cpu_name[cpu] = "MIPS 5Kc"; |
819 | break; | 826 | break; |
820 | case PRID_IMP_5KE: | 827 | case PRID_IMP_5KE: |
821 | c->cputype = CPU_5KE; | 828 | c->cputype = CPU_5KE; |
829 | c->writecombine = _CACHE_UNCACHED; | ||
822 | __cpu_name[cpu] = "MIPS 5KE"; | 830 | __cpu_name[cpu] = "MIPS 5KE"; |
823 | break; | 831 | break; |
824 | case PRID_IMP_20KC: | 832 | case PRID_IMP_20KC: |
825 | c->cputype = CPU_20KC; | 833 | c->cputype = CPU_20KC; |
834 | c->writecombine = _CACHE_UNCACHED; | ||
826 | __cpu_name[cpu] = "MIPS 20Kc"; | 835 | __cpu_name[cpu] = "MIPS 20Kc"; |
827 | break; | 836 | break; |
828 | case PRID_IMP_24K: | 837 | case PRID_IMP_24K: |
829 | c->cputype = CPU_24K; | 838 | c->cputype = CPU_24K; |
839 | c->writecombine = _CACHE_UNCACHED; | ||
830 | __cpu_name[cpu] = "MIPS 24Kc"; | 840 | __cpu_name[cpu] = "MIPS 24Kc"; |
831 | break; | 841 | break; |
832 | case PRID_IMP_24KE: | 842 | case PRID_IMP_24KE: |
833 | c->cputype = CPU_24K; | 843 | c->cputype = CPU_24K; |
844 | c->writecombine = _CACHE_UNCACHED; | ||
834 | __cpu_name[cpu] = "MIPS 24KEc"; | 845 | __cpu_name[cpu] = "MIPS 24KEc"; |
835 | break; | 846 | break; |
836 | case PRID_IMP_25KF: | 847 | case PRID_IMP_25KF: |
837 | c->cputype = CPU_25KF; | 848 | c->cputype = CPU_25KF; |
849 | c->writecombine = _CACHE_UNCACHED; | ||
838 | __cpu_name[cpu] = "MIPS 25Kc"; | 850 | __cpu_name[cpu] = "MIPS 25Kc"; |
839 | break; | 851 | break; |
840 | case PRID_IMP_34K: | 852 | case PRID_IMP_34K: |
841 | c->cputype = CPU_34K; | 853 | c->cputype = CPU_34K; |
854 | c->writecombine = _CACHE_UNCACHED; | ||
842 | __cpu_name[cpu] = "MIPS 34Kc"; | 855 | __cpu_name[cpu] = "MIPS 34Kc"; |
843 | break; | 856 | break; |
844 | case PRID_IMP_74K: | 857 | case PRID_IMP_74K: |
845 | c->cputype = CPU_74K; | 858 | c->cputype = CPU_74K; |
859 | c->writecombine = _CACHE_UNCACHED; | ||
846 | __cpu_name[cpu] = "MIPS 74Kc"; | 860 | __cpu_name[cpu] = "MIPS 74Kc"; |
847 | break; | 861 | break; |
848 | case PRID_IMP_M14KC: | 862 | case PRID_IMP_M14KC: |
849 | c->cputype = CPU_M14KC; | 863 | c->cputype = CPU_M14KC; |
864 | c->writecombine = _CACHE_UNCACHED; | ||
850 | __cpu_name[cpu] = "MIPS M14Kc"; | 865 | __cpu_name[cpu] = "MIPS M14Kc"; |
851 | break; | 866 | break; |
852 | case PRID_IMP_M14KEC: | 867 | case PRID_IMP_M14KEC: |
853 | c->cputype = CPU_M14KEC; | 868 | c->cputype = CPU_M14KEC; |
869 | c->writecombine = _CACHE_UNCACHED; | ||
854 | __cpu_name[cpu] = "MIPS M14KEc"; | 870 | __cpu_name[cpu] = "MIPS M14KEc"; |
855 | break; | 871 | break; |
856 | case PRID_IMP_1004K: | 872 | case PRID_IMP_1004K: |
857 | c->cputype = CPU_1004K; | 873 | c->cputype = CPU_1004K; |
874 | c->writecombine = _CACHE_UNCACHED; | ||
858 | __cpu_name[cpu] = "MIPS 1004Kc"; | 875 | __cpu_name[cpu] = "MIPS 1004Kc"; |
859 | break; | 876 | break; |
860 | case PRID_IMP_1074K: | 877 | case PRID_IMP_1074K: |
861 | c->cputype = CPU_1074K; | 878 | c->cputype = CPU_1074K; |
879 | c->writecombine = _CACHE_UNCACHED; | ||
862 | __cpu_name[cpu] = "MIPS 1074Kc"; | 880 | __cpu_name[cpu] = "MIPS 1074Kc"; |
863 | break; | 881 | break; |
864 | case PRID_IMP_INTERAPTIV_UP: | 882 | case PRID_IMP_INTERAPTIV_UP: |
@@ -932,6 +950,7 @@ static inline void cpu_probe_sibyte(struct cpuinfo_mips *c, unsigned int cpu) | |||
932 | { | 950 | { |
933 | decode_configs(c); | 951 | decode_configs(c); |
934 | 952 | ||
953 | c->writecombine = _CACHE_UNCACHED_ACCELERATED; | ||
935 | switch (c->processor_id & PRID_IMP_MASK) { | 954 | switch (c->processor_id & PRID_IMP_MASK) { |
936 | case PRID_IMP_SB1: | 955 | case PRID_IMP_SB1: |
937 | c->cputype = CPU_SB1; | 956 | c->cputype = CPU_SB1; |
@@ -1063,6 +1082,7 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu) | |||
1063 | switch (c->processor_id & PRID_IMP_MASK) { | 1082 | switch (c->processor_id & PRID_IMP_MASK) { |
1064 | case PRID_IMP_JZRISC: | 1083 | case PRID_IMP_JZRISC: |
1065 | c->cputype = CPU_JZRISC; | 1084 | c->cputype = CPU_JZRISC; |
1085 | c->writecombine = _CACHE_UNCACHED_ACCELERATED; | ||
1066 | __cpu_name[cpu] = "Ingenic JZRISC"; | 1086 | __cpu_name[cpu] = "Ingenic JZRISC"; |
1067 | break; | 1087 | break; |
1068 | default: | 1088 | default: |
@@ -1169,6 +1189,7 @@ void cpu_probe(void) | |||
1169 | c->processor_id = PRID_IMP_UNKNOWN; | 1189 | c->processor_id = PRID_IMP_UNKNOWN; |
1170 | c->fpu_id = FPIR_IMP_NONE; | 1190 | c->fpu_id = FPIR_IMP_NONE; |
1171 | c->cputype = CPU_UNKNOWN; | 1191 | c->cputype = CPU_UNKNOWN; |
1192 | c->writecombine = _CACHE_UNCACHED; | ||
1172 | 1193 | ||
1173 | c->processor_id = read_c0_prid(); | 1194 | c->processor_id = read_c0_prid(); |
1174 | switch (c->processor_id & PRID_COMP_MASK) { | 1195 | switch (c->processor_id & PRID_COMP_MASK) { |