Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'mips_6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux

Pull MIPS updates from Thomas Bogendoerfer:

- added support for Huawei B593u-12

- added support for virt board aligned to QEMU MIPS virt board

- added support for doing DMA coherence on a per device base

- reworked handling of RALINK SoCs

- cleanup for Loongon64 barriers

- removed deprecated support for MIPS_CMP SMP handling method

- removed support Sibyte CARMEL and CHRINE boards

- cleanups and fixes

* tag 'mips_6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (59 commits)
MIPS: uprobes: Restore thread.trap_nr
MIPS: Don't clear _PAGE_SPECIAL in _PAGE_CHG_MASK
MIPS: Sink body of check_bugs_early() into its only call site
MIPS: Mark check_bugs() as __init
Revert "MIPS: generic: Enable all CPUs supported by virt board in Kconfig"
MIPS: octeon_switch: Remove duplicated labels
MIPS: loongson2ef: Add missing break in cs5536_isa
MIPS: Remove set_swbp() in uprobes.c
MIPS: Use def_bool y for ARCH_SUPPORTS_UPROBES
MIPS: fw: Allow firmware to pass a empty env
MIPS: Remove deprecated CONFIG_MIPS_CMP
MIPS: lantiq: remove unused function declaration
MIPS: Drop unused positional parameter in local_irq_{dis,en}able
MIPS: mm: Remove local_cache_flush_page
MIPS: Remove no longer used ide.h
MIPS: mm: Remove unused *cache_page_indexed flush functions
MIPS: generic: Enable all CPUs supported by virt board in Kconfig
MIPS: Add board config for virt board
MIPS: Octeon: Disable CVMSEG by default on other platforms
MIPS: Loongson: Don't select platform features with CPU
...

+659 -1358
+12
Documentation/devicetree/bindings/mips/loongson/devices.yaml
··· 37 37 items: 38 38 - const: loongson,loongson64v-4core-virtio 39 39 40 + - description: LS1B based boards 41 + items: 42 + - enum: 43 + - loongson,lsgz-1b-dev 44 + - const: loongson,ls1b 45 + 46 + - description: LS1C based boards 47 + items: 48 + - enum: 49 + - loongmasses,smartloong-1c 50 + - const: loongson,ls1c 51 + 40 52 additionalProperties: true 41 53 42 54 ...
+2
Documentation/devicetree/bindings/vendor-prefixes.yaml
··· 777 777 description: Lontium Semiconductor Corporation 778 778 "^loongson,.*": 779 779 description: Loongson Technology Corporation Limited 780 + "^loongmasses,.*": 781 + description: Nanjing Loongmasses Ltd. 780 782 "^lsi,.*": 781 783 description: LSI Corp. (LSI Logic) 782 784 "^lwn,.*":
-1
arch/mips/Kbuild.platforms
··· 29 29 platform-$(CONFIG_SGI_IP32) += sgi-ip32/ 30 30 platform-$(CONFIG_SIBYTE_BCM112X) += sibyte/ 31 31 platform-$(CONFIG_SIBYTE_SB1250) += sibyte/ 32 - platform-$(CONFIG_SIBYTE_BCM1x55) += sibyte/ 33 32 platform-$(CONFIG_SIBYTE_BCM1x80) += sibyte/ 34 33 platform-$(CONFIG_SNI_RM) += sni/ 35 34 platform-$(CONFIG_MACH_TX49XX) += txx9/
+6 -71
arch/mips/Kconfig
··· 16 16 select ARCH_HAS_UBSAN_SANITIZE_ALL 17 17 select ARCH_HAS_GCOV_PROFILE_ALL 18 18 select ARCH_KEEP_MEMBLOCK 19 - select ARCH_SUPPORTS_UPROBES 20 19 select ARCH_USE_BUILTIN_BSWAP 21 20 select ARCH_USE_CMPXCHG_LOCKREF if 64BIT 22 21 select ARCH_USE_MEMTEST ··· 112 113 select SYS_SUPPORTS_LITTLE_ENDIAN 113 114 select SYS_SUPPORTS_ZBOOT 114 115 select DMA_NONCOHERENT 115 - select ARCH_HAS_SYNC_DMA_FOR_CPU 116 116 select IRQ_MIPS_CPU 117 117 select PINCTRL 118 118 select GPIOLIB ··· 130 132 131 133 config MIPS_GENERIC_KERNEL 132 134 bool "Generic board-agnostic MIPS kernel" 133 - select ARCH_HAS_SETUP_DMA_OPS 134 135 select MIPS_GENERIC 135 136 select BOOT_RAW 136 137 select BUILTIN_DTB ··· 485 488 select BOARD_SCACHE 486 489 select CSRC_R4K 487 490 select CEVT_R4K 488 - select CPU_HAS_WB 489 491 select FORCE_PCI 490 492 select ISA 491 493 select I8259 ··· 561 565 select SYS_SUPPORTS_LITTLE_ENDIAN 562 566 select SYS_SUPPORTS_MICROMIPS 563 567 select SYS_SUPPORTS_MIPS16 564 - select SYS_SUPPORTS_MIPS_CMP 565 568 select SYS_SUPPORTS_MIPS_CPS 566 569 select SYS_SUPPORTS_MULTITHREADING 567 570 select SYS_SUPPORTS_RELOCATABLE ··· 788 793 help 789 794 If you want this kernel to run on SGI O2 workstation, say Y here. 790 795 791 - config SIBYTE_CRHINE 792 - bool "Sibyte BCM91120C-CRhine" 793 - select BOOT_ELF32 794 - select SIBYTE_BCM1120 795 - select SWAP_IO_SPACE 796 - select SYS_HAS_CPU_SB1 797 - select SYS_SUPPORTS_BIG_ENDIAN 798 - select SYS_SUPPORTS_LITTLE_ENDIAN 799 - 800 - config SIBYTE_CARMEL 801 - bool "Sibyte BCM91120x-Carmel" 802 - select BOOT_ELF32 803 - select SIBYTE_BCM1120 804 - select SWAP_IO_SPACE 805 - select SYS_HAS_CPU_SB1 806 - select SYS_SUPPORTS_BIG_ENDIAN 807 - select SYS_SUPPORTS_LITTLE_ENDIAN 808 - 809 796 config SIBYTE_CRHONE 810 797 bool "Sibyte BCM91125C-CRhone" 811 798 select BOOT_ELF32 ··· 801 824 config SIBYTE_RHONE 802 825 bool "Sibyte BCM91125E-Rhone" 803 826 select BOOT_ELF32 804 - select SIBYTE_BCM1125H 827 + select SIBYTE_SB1250 805 828 select SWAP_IO_SPACE 806 829 select SYS_HAS_CPU_SB1 807 830 select SYS_SUPPORTS_BIG_ENDIAN ··· 1052 1075 bool 1053 1076 1054 1077 config ARCH_SUPPORTS_UPROBES 1055 - bool 1078 + def_bool y 1056 1079 1057 1080 config DMA_NONCOHERENT 1058 1081 bool ··· 1063 1086 # by pgprot_writcombine can be mixed, and the latter sometimes provides 1064 1087 # significant advantages. 1065 1088 # 1089 + select ARCH_HAS_SETUP_DMA_OPS 1066 1090 select ARCH_HAS_DMA_WRITE_COMBINE 1067 1091 select ARCH_HAS_DMA_PREP_COHERENT 1092 + select ARCH_HAS_SYNC_DMA_FOR_CPU 1068 1093 select ARCH_HAS_SYNC_DMA_FOR_DEVICE 1069 1094 select ARCH_HAS_DMA_SET_UNCACHED 1070 1095 select DMA_NONCOHERENT_MMAP ··· 1159 1180 1160 1181 config MIPS_HUGE_TLB_SUPPORT 1161 1182 def_bool HUGETLB_PAGE || TRANSPARENT_HUGEPAGE 1162 - 1163 - config IRQ_MSP_SLP 1164 - bool 1165 - 1166 - config IRQ_MSP_CIC 1167 - bool 1168 1183 1169 1184 config IRQ_TXX9 1170 1185 bool ··· 1337 1364 bool "Loongson 2F" 1338 1365 depends on SYS_HAS_CPU_LOONGSON2F 1339 1366 select CPU_LOONGSON2EF 1340 - select GPIOLIB 1341 1367 help 1342 1368 The Loongson 2F processor implements the MIPS III instruction set 1343 1369 with many extensions. ··· 1758 1786 select CPU_SUPPORTS_64BIT_KERNEL 1759 1787 select CPU_SUPPORTS_HIGHMEM 1760 1788 select CPU_SUPPORTS_HUGEPAGES 1761 - select ARCH_HAS_PHYS_TO_DMA 1762 1789 1763 1790 config CPU_LOONGSON32 1764 1791 bool ··· 1822 1851 1823 1852 config SYS_HAS_CPU_MIPS32_R5 1824 1853 bool 1825 - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT 1826 1854 1827 1855 config SYS_HAS_CPU_MIPS32_R6 1828 1856 bool 1829 - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT 1830 1857 1831 1858 config SYS_HAS_CPU_MIPS64_R1 1832 1859 bool ··· 1834 1865 1835 1866 config SYS_HAS_CPU_MIPS64_R5 1836 1867 bool 1837 - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT 1838 1868 1839 1869 config SYS_HAS_CPU_MIPS64_R6 1840 1870 bool 1841 - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT 1842 1871 1843 1872 config SYS_HAS_CPU_P5600 1844 1873 bool 1845 - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT 1846 1874 1847 1875 config SYS_HAS_CPU_R3000 1848 1876 bool ··· 1864 1898 1865 1899 config SYS_HAS_CPU_R10000 1866 1900 bool 1867 - select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT 1868 1901 1869 1902 config SYS_HAS_CPU_RM7000 1870 1903 bool ··· 1892 1927 config SYS_HAS_CPU_BMIPS5000 1893 1928 bool 1894 1929 select SYS_HAS_CPU_BMIPS 1895 - select ARCH_HAS_SYNC_DMA_FOR_CPU 1896 1930 1897 1931 # 1898 1932 # CPU may reorder R->R, R->W, W->R, W->W ··· 2262 2298 Includes a loader for loading an elf relocatable object 2263 2299 onto another VPE and running it. 2264 2300 2265 - config MIPS_VPE_LOADER_CMP 2266 - bool 2267 - default "y" 2268 - depends on MIPS_VPE_LOADER && MIPS_CMP 2269 - 2270 2301 config MIPS_VPE_LOADER_MT 2271 2302 bool 2272 2303 default "y" 2273 - depends on MIPS_VPE_LOADER && !MIPS_CMP 2304 + depends on MIPS_VPE_LOADER 2274 2305 2275 2306 config MIPS_VPE_LOADER_TOM 2276 2307 bool "Load VPE program into memory hidden from linux" ··· 2281 2322 bool "Enable support for AP/SP API (RTLX)" 2282 2323 depends on MIPS_VPE_LOADER 2283 2324 2284 - config MIPS_VPE_APSP_API_CMP 2285 - bool 2286 - default "y" 2287 - depends on MIPS_VPE_APSP_API && MIPS_CMP 2288 - 2289 2325 config MIPS_VPE_APSP_API_MT 2290 2326 bool 2291 2327 default "y" 2292 - depends on MIPS_VPE_APSP_API && !MIPS_CMP 2293 - 2294 - config MIPS_CMP 2295 - bool "MIPS CMP framework support (DEPRECATED)" 2296 - depends on SYS_SUPPORTS_MIPS_CMP && !CPU_MIPSR6 2297 - select SMP 2298 - select SYNC_R4K 2299 - select SYS_SUPPORTS_SMP 2300 - select WEAK_ORDERING 2301 - default n 2302 - help 2303 - Select this if you are using a bootloader which implements the "CMP 2304 - framework" protocol (ie. YAMON) and want your kernel to make use of 2305 - its ability to start secondary CPUs. 2306 - 2307 - Unless you have a specific need, you should use CONFIG_MIPS_CPS 2308 - instead of this. 2328 + depends on MIPS_VPE_APSP_API 2309 2329 2310 2330 config MIPS_CPS 2311 2331 bool "MIPS Coherent Processing System support" ··· 2738 2800 Say N if you want to disable CPU hotplug. 2739 2801 2740 2802 config SMP_UP 2741 - bool 2742 - 2743 - config SYS_SUPPORTS_MIPS_CMP 2744 2803 bool 2745 2804 2746 2805 config SYS_SUPPORTS_MIPS_CPS
+38
arch/mips/Makefile
··· 181 181 cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1 182 182 cflags-$(CONFIG_CPU_BMIPS) += -march=mips32 -Wa,-mips32 -Wa,--trap 183 183 184 + cflags-$(CONFIG_CPU_LOONGSON2E) += -march=loongson2e -Wa,--trap 185 + cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f -Wa,--trap 186 + # Some -march= flags enable MMI instructions, and GCC complains about that 187 + # support being enabled alongside -msoft-float. Thus explicitly disable MMI. 188 + cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-mno-loongson-mmi) 189 + ifdef CONFIG_CPU_LOONGSON64 190 + cflags-$(CONFIG_CPU_LOONGSON64) += -Wa,--trap 191 + cflags-$(CONFIG_CC_IS_GCC) += -march=loongson3a 192 + cflags-$(CONFIG_CC_IS_CLANG) += -march=mips64r2 193 + endif 194 + cflags-$(CONFIG_CPU_LOONGSON64) += $(call cc-option,-mno-loongson-mmi) 195 + 184 196 cflags-$(CONFIG_CPU_R4000_WORKAROUNDS) += $(call cc-option,-mfix-r4000,) 185 197 cflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,) 186 198 cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,) 199 + ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS 200 + cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa,-mfix-loongson2f-nop 201 + cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa,-mfix-loongson2f-jump 202 + endif 203 + 204 + # 205 + # Some versions of binutils, not currently mainline as of 2019/02/04, support 206 + # an -mfix-loongson3-llsc flag which emits a sync prior to each ll instruction 207 + # to work around a CPU bug (see __SYNC_loongson3_war in asm/sync.h for a 208 + # description). 209 + # 210 + # We disable this in order to prevent the assembler meddling with the 211 + # instruction that labels refer to, ie. if we label an ll instruction: 212 + # 213 + # 1: ll v0, 0(a0) 214 + # 215 + # ...then with the assembler fix applied the label may actually point at a sync 216 + # instruction inserted by the assembler, and if we were using the label in an 217 + # exception table the table would no longer contain the address of the ll 218 + # instruction. 219 + # 220 + # Avoid this by explicitly disabling that assembler behaviour. If upstream 221 + # binutils does not merge support for the flag then we can revisit & remove 222 + # this later - for now it ensures vendor toolchains don't cause problems. 223 + # 224 + cflags-$(CONFIG_CPU_LOONGSON64) += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,) 187 225 188 226 # For smartmips configurations, there are hundreds of warnings due to ISA overrides 189 227 # in assembly and header files. smartmips is only supported for MIPS32r1 onwards
-16
arch/mips/ath79/Kconfig
··· 29 29 config PCI_AR724X 30 30 def_bool n 31 31 32 - config ATH79_DEV_GPIO_BUTTONS 33 - def_bool n 34 - 35 - config ATH79_DEV_LEDS_GPIO 36 - def_bool n 37 - 38 - config ATH79_DEV_SPI 39 - def_bool n 40 - 41 - config ATH79_DEV_USB 42 - def_bool n 43 - 44 - config ATH79_DEV_WMAC 45 - depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA955X) 46 - def_bool n 47 - 48 32 endif
+1
arch/mips/bcm47xx/board.c
··· 193 193 /* boardtype, boardnum, boardrev */ 194 194 static const 195 195 struct bcm47xx_board_type_list3 bcm47xx_board_list_board[] __initconst = { 196 + {{BCM47XX_BOARD_HUAWEI_B593U_12, "Huawei B593u-12"}, "0x053d", "1234", "0x1301"}, 196 197 {{BCM47XX_BOARD_HUAWEI_E970, "Huawei E970"}, "0x048e", "0x5347", "0x11"}, 197 198 {{BCM47XX_BOARD_PHICOMM_M1, "Phicomm M1"}, "0x0590", "80", "0x1104"}, 198 199 {{BCM47XX_BOARD_ZTE_H218N, "ZTE H218N"}, "0x053d", "1234", "0x1305"},
+8
arch/mips/bcm47xx/leds.c
··· 223 223 /* Huawei */ 224 224 225 225 static const struct gpio_led 226 + bcm47xx_leds_huawei_b593u_12[] __initconst = { 227 + BCM47XX_GPIO_LED(5, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), 228 + }; 229 + 230 + static const struct gpio_led 226 231 bcm47xx_leds_huawei_e970[] __initconst = { 227 232 BCM47XX_GPIO_LED(0, "unk", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF), 228 233 }; ··· 677 672 bcm47xx_set_pdata(bcm47xx_leds_dlink_dir330); 678 673 break; 679 674 675 + case BCM47XX_BOARD_HUAWEI_B593U_12: 676 + bcm47xx_set_pdata(bcm47xx_leds_huawei_b593u_12); 677 + break; 680 678 case BCM47XX_BOARD_HUAWEI_E970: 681 679 bcm47xx_set_pdata(bcm47xx_leds_huawei_e970); 682 680 break;
+2 -1
arch/mips/cavium-octeon/Kconfig
··· 14 14 config CAVIUM_OCTEON_CVMSEG_SIZE 15 15 int "Number of L1 cache lines reserved for CVMSEG memory" 16 16 range 0 54 17 - default 1 17 + default 0 if !CAVIUM_OCTEON_SOC 18 + default 1 if CAVIUM_OCTEON_SOC 18 19 help 19 20 CVMSEG LM is a segment that accesses portions of the dcache as a 20 21 local memory; the larger CVMSEG is, the smaller the cache is.
+15 -20
arch/mips/cavium-octeon/octeon-irq.c
··· 2290 2290 static int __init octeon_irq_init_cib(struct device_node *ciu_node, 2291 2291 struct device_node *parent) 2292 2292 { 2293 - const __be32 *addr; 2293 + struct resource res; 2294 2294 u32 val; 2295 2295 struct octeon_irq_cib_host_data *host_data; 2296 2296 int parent_irq; ··· 2309 2309 return -ENOMEM; 2310 2310 raw_spin_lock_init(&host_data->lock); 2311 2311 2312 - addr = of_get_address(ciu_node, 0, NULL, NULL); 2313 - if (!addr) { 2312 + r = of_address_to_resource(ciu_node, 0, &res); 2313 + if (r) { 2314 2314 pr_err("ERROR: Couldn't acquire reg(0) %pOFn\n", ciu_node); 2315 - return -EINVAL; 2315 + return r; 2316 2316 } 2317 - host_data->raw_reg = (u64)phys_to_virt( 2318 - of_translate_address(ciu_node, addr)); 2317 + host_data->raw_reg = (u64)phys_to_virt(res.start); 2319 2318 2320 - addr = of_get_address(ciu_node, 1, NULL, NULL); 2321 - if (!addr) { 2319 + r = of_address_to_resource(ciu_node, 1, &res); 2320 + if (r) { 2322 2321 pr_err("ERROR: Couldn't acquire reg(1) %pOFn\n", ciu_node); 2323 - return -EINVAL; 2322 + return r; 2324 2323 } 2325 - host_data->en_reg = (u64)phys_to_virt( 2326 - of_translate_address(ciu_node, addr)); 2324 + host_data->en_reg = (u64)phys_to_virt(res.start); 2327 2325 2328 2326 r = of_property_read_u32(ciu_node, "cavium,max-bits", &val); 2329 2327 if (r) { ··· 2872 2874 static int __init octeon_irq_init_ciu3(struct device_node *ciu_node, 2873 2875 struct device_node *parent) 2874 2876 { 2875 - int i; 2877 + int i, ret; 2876 2878 int node; 2877 2879 struct irq_domain *domain; 2878 2880 struct octeon_ciu3_info *ciu3_info; 2879 - const __be32 *zero_addr; 2881 + struct resource res; 2880 2882 u64 base_addr; 2881 2883 union cvmx_ciu3_const consts; 2882 2884 ··· 2886 2888 if (!ciu3_info) 2887 2889 return -ENOMEM; 2888 2890 2889 - zero_addr = of_get_address(ciu_node, 0, NULL, NULL); 2890 - if (WARN_ON(!zero_addr)) 2891 - return -EINVAL; 2891 + ret = of_address_to_resource(ciu_node, 0, &res); 2892 + if (WARN_ON(ret)) 2893 + return ret; 2892 2894 2893 - base_addr = of_translate_address(ciu_node, zero_addr); 2894 - base_addr = (u64)phys_to_virt(base_addr); 2895 - 2896 - ciu3_info->ciu3_addr = base_addr; 2895 + ciu3_info->ciu3_addr = base_addr = (u64)phys_to_virt(res.start); 2897 2896 ciu3_info->node = node; 2898 2897 2899 2898 consts.u64 = cvmx_read_csr(base_addr + CIU3_CONST);
+38
arch/mips/configs/generic/board-virt.config
··· 1 + CONFIG_COMMON_CLK=y 2 + 3 + CONFIG_GOLDFISH=y 4 + CONFIG_GOLDFISH_PIC=y 5 + 6 + CONFIG_PCI=y 7 + CONFIG_PCI_MSI=y 8 + CONFIG_PCI_HOST_GENERIC=y 9 + 10 + CONFIG_POWER_RESET=y 11 + CONFIG_POWER_RESET_SYSCON=y 12 + CONFIG_POWER_RESET_SYSCON_POWEROFF=y 13 + CONFIG_SYSCON_REBOOT_MODE=y 14 + 15 + CONFIG_RTC_CLASS=y 16 + CONFIG_RTC_DRV_GOLDFISH=y 17 + 18 + CONFIG_SERIAL_8250=y 19 + CONFIG_SERIAL_8250_CONSOLE=y 20 + CONFIG_SERIAL_OF_PLATFORM=y 21 + 22 + CONFIG_MTD=y 23 + CONFIG_MTD_CFI=y 24 + 25 + CONFIG_USB=y 26 + CONFIG_USB_EHCI_HCD=y 27 + CONFIG_USB_OHCI_HCD=y 28 + CONFIG_USB_XHCI_HCD=y 29 + 30 + CONFIG_VIRTIO_CONSOLE=y 31 + CONFIG_VIRTIO_PCI=y 32 + CONFIG_VIRTIO_MMIO=y 33 + CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y 34 + CONFIG_VIRTIO_BALLOON=y 35 + CONFIG_VIRTIO_BLK=y 36 + CONFIG_VIRTIO_NET=y 37 + CONFIG_NET_9P=y 38 + CONFIG_NET_9P_VIRTIO=y
+1 -1
arch/mips/fw/lib/cmdline.c
··· 53 53 { 54 54 char *result = NULL; 55 55 56 - if (_fw_envp != NULL) { 56 + if (_fw_envp != NULL && fw_envp(0) != NULL) { 57 57 /* 58 58 * Return a pointer to the given environment variable. 59 59 * YAMON uses "name", "value" pairs, while U-Boot uses
+2 -2
arch/mips/include/asm/asmmacro.h
··· 45 45 #endif 46 46 47 47 #ifdef CONFIG_CPU_HAS_DIEI 48 - .macro local_irq_enable reg=t0 48 + .macro local_irq_enable 49 49 ei 50 50 irq_enable_hazard 51 51 .endm 52 52 53 - .macro local_irq_disable reg=t0 53 + .macro local_irq_disable 54 54 di 55 55 irq_disable_hazard 56 56 .endm
+1 -7
arch/mips/include/asm/bugs.h
··· 24 24 extern void check_bugs32(void); 25 25 extern void check_bugs64(void); 26 26 27 - static inline void check_bugs_early(void) 28 - { 29 - if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64)) 30 - check_bugs64_early(); 31 - } 32 - 33 - static inline void check_bugs(void) 27 + static inline void __init check_bugs(void) 34 28 { 35 29 unsigned int cpu = smp_processor_id(); 36 30
+2
arch/mips/include/asm/cache.h
··· 16 16 17 17 #define __read_mostly __section(".data..read_mostly") 18 18 19 + extern void cache_noop(void); 20 + 19 21 #endif /* _ASM_CACHE_H */
-1
arch/mips/include/asm/cacheflush.h
··· 110 110 unsigned long len); 111 111 112 112 extern void (*flush_icache_all)(void); 113 - extern void (*local_flush_data_cache_page)(void * addr); 114 113 extern void (*flush_data_cache_page)(unsigned long addr); 115 114 116 115 /* Run kernel code uncached, useful for cache probing functions. */
+19 -2
arch/mips/include/asm/cpu-features.h
··· 118 118 #define cpu_has_3k_cache __isa_lt_and_opt(1, MIPS_CPU_3K_CACHE) 119 119 #endif 120 120 #ifndef cpu_has_4k_cache 121 - #define cpu_has_4k_cache __isa_ge_or_opt(1, MIPS_CPU_4K_CACHE) 121 + #define cpu_has_4k_cache __opt(MIPS_CPU_4K_CACHE) 122 122 #endif 123 123 #ifndef cpu_has_octeon_cache 124 - #define cpu_has_octeon_cache 0 124 + #define cpu_has_octeon_cache \ 125 + ({ \ 126 + int __res; \ 127 + \ 128 + switch (current_cpu_type()) { \ 129 + case CPU_CAVIUM_OCTEON: \ 130 + case CPU_CAVIUM_OCTEON_PLUS: \ 131 + case CPU_CAVIUM_OCTEON2: \ 132 + case CPU_CAVIUM_OCTEON3: \ 133 + __res = 1; \ 134 + break; \ 135 + \ 136 + default: \ 137 + __res = 0; \ 138 + } \ 139 + \ 140 + __res; \ 141 + }) 125 142 #endif 126 143 /* Don't override `cpu_has_fpu' to 1 or the "nofpu" option won't work. */ 127 144 #ifndef cpu_has_fpu
-13
arch/mips/include/asm/ide.h
··· 1 - /* 2 - * This file is subject to the terms and conditions of the GNU General Public 3 - * License. See the file "COPYING" in the main directory of this archive 4 - * for more details. 5 - * 6 - * This file contains the MIPS architecture specific IDE code. 7 - */ 8 - #ifndef __ASM_IDE_H 9 - #define __ASM_IDE_H 10 - 11 - #include <ide.h> 12 - 13 - #endif /* __ASM_IDE_H */
+1 -1
arch/mips/include/asm/io.h
··· 210 210 #define ioremap_wc(offset, size) \ 211 211 ioremap_prot((offset), (size), boot_cpu_data.writecombine) 212 212 213 - #if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_CPU_LOONGSON64) 213 + #if defined(CONFIG_CPU_CAVIUM_OCTEON) 214 214 #define war_io_reorder_wmb() wmb() 215 215 #else 216 216 #define war_io_reorder_wmb() barrier()
+1
arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
··· 53 53 BCM47XX_BOARD_DLINK_DIR130, 54 54 BCM47XX_BOARD_DLINK_DIR330, 55 55 56 + BCM47XX_BOARD_HUAWEI_B593U_12, 56 57 BCM47XX_BOARD_HUAWEI_E970, 57 58 58 59 BCM47XX_BOARD_LINKSYS_E900V1,
-138
arch/mips/include/asm/mach-generic/ide.h
··· 1 - /* 2 - * This file is subject to the terms and conditions of the GNU General Public 3 - * License. See the file "COPYING" in the main directory of this archive 4 - * for more details. 5 - * 6 - * Copyright (C) 1994-1996 Linus Torvalds & authors 7 - * 8 - * Copied from i386; many of the especially older MIPS or ISA-based platforms 9 - * are basically identical. Using this file probably implies i8259 PIC 10 - * support in a system but the very least interrupt numbers 0 - 15 need to 11 - * be put aside for legacy devices. 12 - */ 13 - #ifndef __ASM_MACH_GENERIC_IDE_H 14 - #define __ASM_MACH_GENERIC_IDE_H 15 - 16 - #ifdef __KERNEL__ 17 - 18 - #include <linux/pci.h> 19 - #include <linux/stddef.h> 20 - #include <asm/processor.h> 21 - 22 - /* MIPS port and memory-mapped I/O string operations. */ 23 - static inline void __ide_flush_prologue(void) 24 - { 25 - #ifdef CONFIG_SMP 26 - if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) 27 - preempt_disable(); 28 - #endif 29 - } 30 - 31 - static inline void __ide_flush_epilogue(void) 32 - { 33 - #ifdef CONFIG_SMP 34 - if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) 35 - preempt_enable(); 36 - #endif 37 - } 38 - 39 - static inline void __ide_flush_dcache_range(unsigned long addr, unsigned long size) 40 - { 41 - if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) { 42 - unsigned long end = addr + size; 43 - 44 - while (addr < end) { 45 - local_flush_data_cache_page((void *)addr); 46 - addr += PAGE_SIZE; 47 - } 48 - } 49 - } 50 - 51 - /* 52 - * insw() and gang might be called with interrupts disabled, so we can't 53 - * send IPIs for flushing due to the potencial of deadlocks, see the comment 54 - * above smp_call_function() in arch/mips/kernel/smp.c. We work around the 55 - * problem by disabling preemption so we know we actually perform the flush 56 - * on the processor that actually has the lines to be flushed which hopefully 57 - * is even better for performance anyway. 58 - */ 59 - static inline void __ide_insw(unsigned long port, void *addr, 60 - unsigned int count) 61 - { 62 - __ide_flush_prologue(); 63 - insw(port, addr, count); 64 - __ide_flush_dcache_range((unsigned long)addr, count * 2); 65 - __ide_flush_epilogue(); 66 - } 67 - 68 - static inline void __ide_insl(unsigned long port, void *addr, unsigned int count) 69 - { 70 - __ide_flush_prologue(); 71 - insl(port, addr, count); 72 - __ide_flush_dcache_range((unsigned long)addr, count * 4); 73 - __ide_flush_epilogue(); 74 - } 75 - 76 - static inline void __ide_outsw(unsigned long port, const void *addr, 77 - unsigned long count) 78 - { 79 - __ide_flush_prologue(); 80 - outsw(port, addr, count); 81 - __ide_flush_dcache_range((unsigned long)addr, count * 2); 82 - __ide_flush_epilogue(); 83 - } 84 - 85 - static inline void __ide_outsl(unsigned long port, const void *addr, 86 - unsigned long count) 87 - { 88 - __ide_flush_prologue(); 89 - outsl(port, addr, count); 90 - __ide_flush_dcache_range((unsigned long)addr, count * 4); 91 - __ide_flush_epilogue(); 92 - } 93 - 94 - static inline void __ide_mm_insw(void __iomem *port, void *addr, u32 count) 95 - { 96 - __ide_flush_prologue(); 97 - readsw(port, addr, count); 98 - __ide_flush_dcache_range((unsigned long)addr, count * 2); 99 - __ide_flush_epilogue(); 100 - } 101 - 102 - static inline void __ide_mm_insl(void __iomem *port, void *addr, u32 count) 103 - { 104 - __ide_flush_prologue(); 105 - readsl(port, addr, count); 106 - __ide_flush_dcache_range((unsigned long)addr, count * 4); 107 - __ide_flush_epilogue(); 108 - } 109 - 110 - static inline void __ide_mm_outsw(void __iomem *port, void *addr, u32 count) 111 - { 112 - __ide_flush_prologue(); 113 - writesw(port, addr, count); 114 - __ide_flush_dcache_range((unsigned long)addr, count * 2); 115 - __ide_flush_epilogue(); 116 - } 117 - 118 - static inline void __ide_mm_outsl(void __iomem * port, void *addr, u32 count) 119 - { 120 - __ide_flush_prologue(); 121 - writesl(port, addr, count); 122 - __ide_flush_dcache_range((unsigned long)addr, count * 4); 123 - __ide_flush_epilogue(); 124 - } 125 - 126 - /* ide_insw calls insw, not __ide_insw. Why? */ 127 - #undef insw 128 - #undef insl 129 - #undef outsw 130 - #undef outsl 131 - #define insw(port, addr, count) __ide_insw(port, addr, count) 132 - #define insl(port, addr, count) __ide_insl(port, addr, count) 133 - #define outsw(port, addr, count) __ide_outsw(port, addr, count) 134 - #define outsl(port, addr, count) __ide_outsl(port, addr, count) 135 - 136 - #endif /* __KERNEL__ */ 137 - 138 - #endif /* __ASM_MACH_GENERIC_IDE_H */
-3
arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
··· 94 94 #define LTQ_MPS_BASE_ADDR (KSEG1 + 0x1F107000) 95 95 #define LTQ_MPS_CHIPID ((u32 *)(LTQ_MPS_BASE_ADDR + 0x0344)) 96 96 97 - /* allow booting xrx200 phys */ 98 - int xrx200_gphy_boot(struct device *dev, unsigned int id, dma_addr_t dev_addr); 99 - 100 97 /* request a non-gpio and set the PIO config */ 101 98 #define PMU_PPE BIT(13) 102 99 extern void ltq_pmu_enable(unsigned int module);
+2 -1
arch/mips/include/asm/mach-ralink/mt7620.h
··· 11 11 #ifndef _MT7620_REGS_H_ 12 12 #define _MT7620_REGS_H_ 13 13 14 - #define MT7620_SYSC_BASE 0x10000000 14 + #define IOMEM(x) ((void __iomem *)(KSEG1ADDR(x))) 15 + #define MT7620_SYSC_BASE IOMEM(0x10000000) 15 16 16 17 #define SYSC_REG_CHIP_NAME0 0x00 17 18 #define SYSC_REG_CHIP_NAME1 0x04
+2 -1
arch/mips/include/asm/mach-ralink/rt288x.h
··· 11 11 #ifndef _RT288X_REGS_H_ 12 12 #define _RT288X_REGS_H_ 13 13 14 - #define RT2880_SYSC_BASE 0x00300000 14 + #define IOMEM(x) ((void __iomem *)(KSEG1ADDR(x))) 15 + #define RT2880_SYSC_BASE IOMEM(0x00300000) 15 16 16 17 #define SYSC_REG_CHIP_NAME0 0x00 17 18 #define SYSC_REG_CHIP_NAME1 0x04
+2 -1
arch/mips/include/asm/mach-ralink/rt305x.h
··· 43 43 return ralink_soc == RT305X_SOC_RT5350; 44 44 } 45 45 46 - #define RT305X_SYSC_BASE 0x10000000 46 + #define IOMEM(x) ((void __iomem *)(KSEG1ADDR(x))) 47 + #define RT305X_SYSC_BASE IOMEM(0x10000000) 47 48 48 49 #define SYSC_REG_CHIP_NAME0 0x00 49 50 #define SYSC_REG_CHIP_NAME1 0x04
+3 -1
arch/mips/include/asm/mach-ralink/rt3883.h
··· 10 10 11 11 #include <linux/bitops.h> 12 12 13 + #define IOMEM(x) ((void __iomem *)(KSEG1ADDR(x))) 14 + 13 15 #define RT3883_SDRAM_BASE 0x00000000 14 - #define RT3883_SYSC_BASE 0x10000000 16 + #define RT3883_SYSC_BASE IOMEM(0x10000000) 15 17 #define RT3883_TIMER_BASE 0x10000100 16 18 #define RT3883_INTC_BASE 0x10000200 17 19 #define RT3883_MEMC_BASE 0x10000300
+2 -1
arch/mips/include/asm/pgtable-bits.h
··· 280 280 #define __WRITEABLE (_PAGE_SILENT_WRITE | _PAGE_WRITE | _PAGE_MODIFIED) 281 281 282 282 #define _PAGE_CHG_MASK (_PAGE_ACCESSED | _PAGE_MODIFIED | \ 283 - _PAGE_SOFT_DIRTY | _PFN_MASK | _CACHE_MASK) 283 + _PAGE_SOFT_DIRTY | _PFN_MASK | \ 284 + _CACHE_MASK | _PAGE_SPECIAL) 284 285 285 286 #endif /* _ASM_PGTABLE_BITS_H */
+6 -1
arch/mips/include/asm/processor.h
··· 202 202 #define COP2_INIT \ 203 203 .cp2 = {0,}, 204 204 205 + #if defined(CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE) && \ 206 + CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 205 207 struct octeon_cvmseg_state { 206 208 unsigned long cvmseg[CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE] 207 209 [cpu_dcache_line_size() / sizeof(unsigned long)]; 208 210 }; 209 - 211 + #endif 210 212 #else 211 213 #define COP2_INIT 212 214 #endif ··· 265 263 unsigned long trap_nr; 266 264 #ifdef CONFIG_CPU_CAVIUM_OCTEON 267 265 struct octeon_cop2_state cp2 __attribute__ ((__aligned__(128))); 266 + #if defined(CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE) && \ 267 + CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 268 268 struct octeon_cvmseg_state cvmseg __attribute__ ((__aligned__(128))); 269 + #endif 269 270 #endif 270 271 struct mips_abi *abi; 271 272 };
-1
arch/mips/include/asm/rtlx.h
··· 81 81 extern struct rtlx_info { 82 82 unsigned long id; 83 83 enum rtlx_state state; 84 - int ap_int_pending; /* Status of 0 or 1 for CONFIG_MIPS_CMP only */ 85 84 86 85 struct rtlx_channel channel[RTLX_CHANNELS]; 87 86 } *rtlx;
+1 -5
arch/mips/include/asm/sibyte/board.h
··· 7 7 #define _SIBYTE_BOARD_H 8 8 9 9 #if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_CRHONE) || \ 10 - defined(CONFIG_SIBYTE_CRHINE) || defined(CONFIG_SIBYTE_LITTLESUR) 10 + defined(CONFIG_SIBYTE_LITTLESUR) 11 11 #include <asm/sibyte/swarm.h> 12 12 #endif 13 13 14 14 #if defined(CONFIG_SIBYTE_SENTOSA) || defined(CONFIG_SIBYTE_RHONE) 15 15 #include <asm/sibyte/sentosa.h> 16 - #endif 17 - 18 - #ifdef CONFIG_SIBYTE_CARMEL 19 - #include <asm/sibyte/carmel.h> 20 16 #endif 21 17 22 18 #ifdef CONFIG_SIBYTE_BIGSUR
-45
arch/mips/include/asm/sibyte/carmel.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * Copyright (C) 2002 Broadcom Corporation 4 - */ 5 - #ifndef __ASM_SIBYTE_CARMEL_H 6 - #define __ASM_SIBYTE_CARMEL_H 7 - 8 - #include <asm/sibyte/sb1250.h> 9 - #include <asm/sibyte/sb1250_int.h> 10 - 11 - #define SIBYTE_BOARD_NAME "Carmel" 12 - 13 - #define GPIO_PHY_INTERRUPT 2 14 - #define GPIO_NONMASKABLE_INT 3 15 - #define GPIO_CF_INSERTED 6 16 - #define GPIO_MONTEREY_RESET 7 17 - #define GPIO_QUADUART_INT 8 18 - #define GPIO_CF_INT 9 19 - #define GPIO_FPGA_CCLK 10 20 - #define GPIO_FPGA_DOUT 11 21 - #define GPIO_FPGA_DIN 12 22 - #define GPIO_FPGA_PGM 13 23 - #define GPIO_FPGA_DONE 14 24 - #define GPIO_FPGA_INIT 15 25 - 26 - #define LEDS_CS 2 27 - #define LEDS_PHYS 0x100C0000 28 - #define MLEDS_CS 3 29 - #define MLEDS_PHYS 0x100A0000 30 - #define UART_CS 4 31 - #define UART_PHYS 0x100D0000 32 - #define ARAVALI_CS 5 33 - #define ARAVALI_PHYS 0x11000000 34 - #define IDE_CS 6 35 - #define IDE_PHYS 0x100B0000 36 - #define ARAVALI2_CS 7 37 - #define ARAVALI2_PHYS 0x100E0000 38 - 39 - #if defined(CONFIG_SIBYTE_CARMEL) 40 - #define K_GPIO_GB_IDE 9 41 - #define K_INT_GB_IDE (K_INT_GPIO_0 + K_GPIO_GB_IDE) 42 - #endif 43 - 44 - 45 - #endif /* __ASM_SIBYTE_CARMEL_H */
-5
arch/mips/include/asm/sibyte/swarm.h
··· 24 24 #define SIBYTE_HAVE_PCMCIA 0 25 25 #define SIBYTE_HAVE_IDE 0 26 26 #endif 27 - #ifdef CONFIG_SIBYTE_CRHINE 28 - #define SIBYTE_BOARD_NAME "BCM91120C (CRhine)" 29 - #define SIBYTE_HAVE_PCMCIA 0 30 - #define SIBYTE_HAVE_IDE 0 31 - #endif 32 27 33 28 /* Generic bus chip selects */ 34 29 #define LEDS_CS 3
-16
arch/mips/include/asm/smp-ops.h
··· 80 80 #endif 81 81 } 82 82 83 - static inline int register_cmp_smp_ops(void) 84 - { 85 - #ifdef CONFIG_MIPS_CMP 86 - extern const struct plat_smp_ops cmp_smp_ops; 87 - 88 - if (!mips_cm_present()) 89 - return -ENODEV; 90 - 91 - register_smp_ops(&cmp_smp_ops); 92 - 93 - return 0; 94 - #else 95 - return -ENODEV; 96 - #endif 97 - } 98 - 99 83 static inline int register_vsmp_smp_ops(void) 100 84 { 101 85 #ifdef CONFIG_MIPS_MT_SMP
-4
arch/mips/include/asm/vpe.h
··· 29 29 30 30 static inline int aprp_cpu_index(void) 31 31 { 32 - #ifdef CONFIG_MIPS_CMP 33 - return setup_max_cpus; 34 - #else 35 32 extern int tclimit; 36 33 return tclimit; 37 - #endif 38 34 } 39 35 40 36 enum vpe_state {
-3
arch/mips/kernel/Makefile
··· 58 58 obj-$(CONFIG_MIPS_MT) += mips-mt.o 59 59 obj-$(CONFIG_MIPS_MT_FPAFF) += mips-mt-fpaff.o 60 60 obj-$(CONFIG_MIPS_MT_SMP) += smp-mt.o 61 - obj-$(CONFIG_MIPS_CMP) += smp-cmp.o 62 61 obj-$(CONFIG_MIPS_CPS) += smp-cps.o cps-vec.o 63 62 obj-$(CONFIG_MIPS_CPS_NS16550) += cps-vec-ns16550.o 64 63 obj-$(CONFIG_MIPS_SPRAM) += spram.o 65 64 66 65 obj-$(CONFIG_MIPS_VPE_LOADER) += vpe.o 67 - obj-$(CONFIG_MIPS_VPE_LOADER_CMP) += vpe-cmp.o 68 66 obj-$(CONFIG_MIPS_VPE_LOADER_MT) += vpe-mt.o 69 67 obj-$(CONFIG_MIPS_VPE_APSP_API) += rtlx.o 70 - obj-$(CONFIG_MIPS_VPE_APSP_API_CMP) += rtlx-cmp.o 71 68 obj-$(CONFIG_MIPS_VPE_APSP_API_MT) += rtlx-mt.o 72 69 73 70 obj-$(CONFIG_MIPS_MSC) += irq-msc01.o
+3
arch/mips/kernel/asm-offsets.c
··· 306 306 OFFSET(OCTEON_CP2_HSH_IVW, octeon_cop2_state, cop2_hsh_ivw); 307 307 OFFSET(OCTEON_CP2_SHA3, octeon_cop2_state, cop2_sha3); 308 308 OFFSET(THREAD_CP2, task_struct, thread.cp2); 309 + #if defined(CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE) && \ 310 + CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 309 311 OFFSET(THREAD_CVMSEG, task_struct, thread.cvmseg.cvmseg); 312 + #endif 310 313 BLANK(); 311 314 } 312 315 #endif
+5
arch/mips/kernel/cps-vec.S
··· 116 116 li t0, ST0_CU1 | ST0_CU0 | ST0_BEV | STATUS_BITDEPS 117 117 mtc0 t0, CP0_STATUS 118 118 119 + /* We don't know how to do coherence setup on earlier ISA */ 120 + #if MIPS_ISA_REV > 0 119 121 /* Skip cache & coherence setup if we're already coherent */ 120 122 lw s7, GCR_CL_COHERENCE_OFS(s1) 121 123 bnez s7, 1f ··· 131 129 li t0, 0xff 132 130 sw t0, GCR_CL_COHERENCE_OFS(s1) 133 131 ehb 132 + #endif /* MIPS_ISA_REV > 0 */ 134 133 135 134 /* Set Kseg0 CCA to that in s0 */ 136 135 1: mfc0 t0, CP0_CONFIG ··· 518 515 nop 519 516 END(mips_cps_boot_vpes) 520 517 518 + #if MIPS_ISA_REV > 0 521 519 LEAF(mips_cps_cache_init) 522 520 /* 523 521 * Clear the bits used to index the caches. Note that the architecture ··· 592 588 jr ra 593 589 nop 594 590 END(mips_cps_cache_init) 591 + #endif /* MIPS_ISA_REV > 0 */ 595 592 596 593 #if defined(CONFIG_MIPS_CPS_PM) && defined(CONFIG_CPU_PM) 597 594
+2
arch/mips/kernel/cpu-probe.c
··· 1602 1602 static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu) 1603 1603 { 1604 1604 decode_configs(c); 1605 + /* Octeon has different cache interface */ 1606 + c->options &= ~MIPS_CPU_4K_CACHE; 1605 1607 switch (c->processor_id & PRID_IMP_MASK) { 1606 1608 case PRID_IMP_CAVIUM_CN38XX: 1607 1609 case PRID_IMP_CAVIUM_CN31XX:
+7 -2
arch/mips/kernel/mips-cm.c
··· 181 181 182 182 phys_addr_t __mips_cm_phys_base(void) 183 183 { 184 - u32 config3 = read_c0_config3(); 185 184 unsigned long cmgcr; 186 185 187 186 /* Check the CMGCRBase register is implemented */ 188 - if (!(config3 & MIPS_CONF3_CMGCR)) 187 + if (!(read_c0_config() & MIPS_CONF_M)) 188 + return 0; 189 + 190 + if (!(read_c0_config2() & MIPS_CONF_M)) 191 + return 0; 192 + 193 + if (!(read_c0_config3() & MIPS_CONF3_CMGCR)) 189 194 return 0; 190 195 191 196 /* Read the address from CMGCRBase */
-6
arch/mips/kernel/octeon_switch.S
··· 428 428 jr ra 429 429 nop 430 430 .space 30 * 4, 0 431 - octeon_mult_save_end: 432 431 EXPORT(octeon_mult_save_end) 433 432 END(octeon_mult_save) 434 433 ··· 447 448 sd k0, PT_MPL+8(sp) /* PT_MPL+8 has MPL1 */ 448 449 jr ra 449 450 sd k1, PT_MPL+16(sp) /* PT_MPL+16 has MPL2 */ 450 - octeon_mult_save2_end: 451 451 EXPORT(octeon_mult_save2_end) 452 452 END(octeon_mult_save2) 453 453 ··· 478 480 sd $10, PT_MPL+(4*8)(sp) /* store MPL4 */ 479 481 jr ra 480 482 sd $11, PT_MPL+(5*8)(sp) /* store MPL5 */ 481 - octeon_mult_save3_end: 482 483 EXPORT(octeon_mult_save3_end) 483 484 END(octeon_mult_save3) 484 485 .set pop ··· 495 498 jr ra 496 499 nop 497 500 .space 30 * 4, 0 498 - octeon_mult_restore_end: 499 501 EXPORT(octeon_mult_restore_end) 500 502 END(octeon_mult_restore) 501 503 ··· 513 517 mtp1 v0 /* P1 */ 514 518 jr ra 515 519 mtp0 v1 /* P0 */ 516 - octeon_mult_restore2_end: 517 520 EXPORT(octeon_mult_restore2_end) 518 521 END(octeon_mult_restore2) 519 522 ··· 543 548 .word 0x714b000b 544 549 /* mtp2 $10, $11 restore P2 and P5 */ 545 550 546 - octeon_mult_restore3_end: 547 551 EXPORT(octeon_mult_restore3_end) 548 552 END(octeon_mult_restore3) 549 553 .set pop
-122
arch/mips/kernel/rtlx-cmp.c
··· 1 - /* 2 - * This file is subject to the terms and conditions of the GNU General Public 3 - * License. See the file "COPYING" in the main directory of this archive 4 - * for more details. 5 - * 6 - * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 7 - * Copyright (C) 2013 Imagination Technologies Ltd. 8 - */ 9 - #include <linux/device.h> 10 - #include <linux/fs.h> 11 - #include <linux/err.h> 12 - #include <linux/wait.h> 13 - #include <linux/sched.h> 14 - #include <linux/smp.h> 15 - 16 - #include <asm/mips_mt.h> 17 - #include <asm/vpe.h> 18 - #include <asm/rtlx.h> 19 - 20 - static int major; 21 - 22 - static void rtlx_interrupt(void) 23 - { 24 - int i; 25 - struct rtlx_info *info; 26 - struct rtlx_info **p = vpe_get_shared(aprp_cpu_index()); 27 - 28 - if (p == NULL || *p == NULL) 29 - return; 30 - 31 - info = *p; 32 - 33 - if (info->ap_int_pending == 1 && smp_processor_id() == 0) { 34 - for (i = 0; i < RTLX_CHANNELS; i++) { 35 - wake_up(&channel_wqs[i].lx_queue); 36 - wake_up(&channel_wqs[i].rt_queue); 37 - } 38 - info->ap_int_pending = 0; 39 - } 40 - } 41 - 42 - void _interrupt_sp(void) 43 - { 44 - smp_send_reschedule(aprp_cpu_index()); 45 - } 46 - 47 - int __init rtlx_module_init(void) 48 - { 49 - struct device *dev; 50 - int i, err; 51 - 52 - if (!cpu_has_mipsmt) { 53 - pr_warn("VPE loader: not a MIPS MT capable processor\n"); 54 - return -ENODEV; 55 - } 56 - 57 - if (num_possible_cpus() - aprp_cpu_index() < 1) { 58 - pr_warn("No TCs reserved for AP/SP, not initializing RTLX.\n" 59 - "Pass maxcpus=<n> argument as kernel argument\n"); 60 - 61 - return -ENODEV; 62 - } 63 - 64 - major = register_chrdev(0, RTLX_MODULE_NAME, &rtlx_fops); 65 - if (major < 0) { 66 - pr_err("rtlx_module_init: unable to register device\n"); 67 - return major; 68 - } 69 - 70 - /* initialise the wait queues */ 71 - for (i = 0; i < RTLX_CHANNELS; i++) { 72 - init_waitqueue_head(&channel_wqs[i].rt_queue); 73 - init_waitqueue_head(&channel_wqs[i].lx_queue); 74 - atomic_set(&channel_wqs[i].in_open, 0); 75 - mutex_init(&channel_wqs[i].mutex); 76 - 77 - dev = device_create(mt_class, NULL, MKDEV(major, i), NULL, 78 - "%s%d", RTLX_MODULE_NAME, i); 79 - if (IS_ERR(dev)) { 80 - while (i--) 81 - device_destroy(mt_class, MKDEV(major, i)); 82 - 83 - err = PTR_ERR(dev); 84 - goto out_chrdev; 85 - } 86 - } 87 - 88 - /* set up notifiers */ 89 - rtlx_notify.start = rtlx_starting; 90 - rtlx_notify.stop = rtlx_stopping; 91 - vpe_notify(aprp_cpu_index(), &rtlx_notify); 92 - 93 - if (cpu_has_vint) { 94 - aprp_hook = rtlx_interrupt; 95 - } else { 96 - pr_err("APRP RTLX init on non-vectored-interrupt processor\n"); 97 - err = -ENODEV; 98 - goto out_class; 99 - } 100 - 101 - return 0; 102 - 103 - out_class: 104 - for (i = 0; i < RTLX_CHANNELS; i++) 105 - device_destroy(mt_class, MKDEV(major, i)); 106 - out_chrdev: 107 - unregister_chrdev(major, RTLX_MODULE_NAME); 108 - 109 - return err; 110 - } 111 - 112 - void __exit rtlx_module_exit(void) 113 - { 114 - int i; 115 - 116 - for (i = 0; i < RTLX_CHANNELS; i++) 117 - device_destroy(mt_class, MKDEV(major, i)); 118 - 119 - unregister_chrdev(major, RTLX_MODULE_NAME); 120 - 121 - aprp_hook = NULL; 122 - }
+2 -1
arch/mips/kernel/setup.c
··· 786 786 setup_early_printk(); 787 787 #endif 788 788 cpu_report(); 789 - check_bugs_early(); 789 + if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64)) 790 + check_bugs64_early(); 790 791 791 792 #if defined(CONFIG_VT) 792 793 #if defined(CONFIG_VGA_CONSOLE)
-148
arch/mips/kernel/smp-cmp.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * 4 - * Copyright (C) 2007 MIPS Technologies, Inc. 5 - * Chris Dearman (chris@mips.com) 6 - */ 7 - 8 - #undef DEBUG 9 - 10 - #include <linux/kernel.h> 11 - #include <linux/sched/task_stack.h> 12 - #include <linux/smp.h> 13 - #include <linux/cpumask.h> 14 - #include <linux/interrupt.h> 15 - #include <linux/compiler.h> 16 - 17 - #include <linux/atomic.h> 18 - #include <asm/cacheflush.h> 19 - #include <asm/cpu.h> 20 - #include <asm/processor.h> 21 - #include <asm/hardirq.h> 22 - #include <asm/mmu_context.h> 23 - #include <asm/smp.h> 24 - #include <asm/time.h> 25 - #include <asm/mipsregs.h> 26 - #include <asm/mipsmtregs.h> 27 - #include <asm/mips_mt.h> 28 - #include <asm/amon.h> 29 - 30 - static void cmp_init_secondary(void) 31 - { 32 - struct cpuinfo_mips *c __maybe_unused = &current_cpu_data; 33 - 34 - /* Assume GIC is present */ 35 - change_c0_status(ST0_IM, STATUSF_IP2 | STATUSF_IP3 | STATUSF_IP4 | 36 - STATUSF_IP5 | STATUSF_IP6 | STATUSF_IP7); 37 - 38 - /* Enable per-cpu interrupts: platform specific */ 39 - 40 - #ifdef CONFIG_MIPS_MT_SMP 41 - if (cpu_has_mipsmt) 42 - cpu_set_vpe_id(c, (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & 43 - TCBIND_CURVPE); 44 - #endif 45 - } 46 - 47 - static void cmp_smp_finish(void) 48 - { 49 - pr_debug("SMPCMP: CPU%d: %s\n", smp_processor_id(), __func__); 50 - 51 - /* CDFIXME: remove this? */ 52 - write_c0_compare(read_c0_count() + (8 * mips_hpt_frequency / HZ)); 53 - 54 - #ifdef CONFIG_MIPS_MT_FPAFF 55 - /* If we have an FPU, enroll ourselves in the FPU-full mask */ 56 - if (cpu_has_fpu) 57 - cpumask_set_cpu(smp_processor_id(), &mt_fpu_cpumask); 58 - #endif /* CONFIG_MIPS_MT_FPAFF */ 59 - 60 - local_irq_enable(); 61 - } 62 - 63 - /* 64 - * Setup the PC, SP, and GP of a secondary processor and start it running 65 - * smp_bootstrap is the place to resume from 66 - * __KSTK_TOS(idle) is apparently the stack pointer 67 - * (unsigned long)idle->thread_info the gp 68 - */ 69 - static int cmp_boot_secondary(int cpu, struct task_struct *idle) 70 - { 71 - struct thread_info *gp = task_thread_info(idle); 72 - unsigned long sp = __KSTK_TOS(idle); 73 - unsigned long pc = (unsigned long)&smp_bootstrap; 74 - unsigned long a0 = 0; 75 - 76 - pr_debug("SMPCMP: CPU%d: %s cpu %d\n", smp_processor_id(), 77 - __func__, cpu); 78 - 79 - #if 0 80 - /* Needed? */ 81 - flush_icache_range((unsigned long)gp, 82 - (unsigned long)(gp + sizeof(struct thread_info))); 83 - #endif 84 - 85 - amon_cpu_start(cpu, pc, sp, (unsigned long)gp, a0); 86 - return 0; 87 - } 88 - 89 - /* 90 - * Common setup before any secondaries are started 91 - */ 92 - void __init cmp_smp_setup(void) 93 - { 94 - int i; 95 - int ncpu = 0; 96 - 97 - pr_debug("SMPCMP: CPU%d: %s\n", smp_processor_id(), __func__); 98 - 99 - #ifdef CONFIG_MIPS_MT_FPAFF 100 - /* If we have an FPU, enroll ourselves in the FPU-full mask */ 101 - if (cpu_has_fpu) 102 - cpumask_set_cpu(0, &mt_fpu_cpumask); 103 - #endif /* CONFIG_MIPS_MT_FPAFF */ 104 - 105 - for (i = 1; i < NR_CPUS; i++) { 106 - if (amon_cpu_avail(i)) { 107 - set_cpu_possible(i, true); 108 - __cpu_number_map[i] = ++ncpu; 109 - __cpu_logical_map[ncpu] = i; 110 - } 111 - } 112 - 113 - if (cpu_has_mipsmt) { 114 - unsigned int nvpe = 1; 115 - #ifdef CONFIG_MIPS_MT_SMP 116 - unsigned int mvpconf0 = read_c0_mvpconf0(); 117 - 118 - nvpe = ((mvpconf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1; 119 - #endif 120 - smp_num_siblings = nvpe; 121 - } 122 - pr_info("Detected %i available secondary CPU(s)\n", ncpu); 123 - } 124 - 125 - void __init cmp_prepare_cpus(unsigned int max_cpus) 126 - { 127 - pr_debug("SMPCMP: CPU%d: %s max_cpus=%d\n", 128 - smp_processor_id(), __func__, max_cpus); 129 - 130 - #ifdef CONFIG_MIPS_MT 131 - /* 132 - * FIXME: some of these options are per-system, some per-core and 133 - * some per-cpu 134 - */ 135 - mips_mt_set_cpuoptions(); 136 - #endif 137 - 138 - } 139 - 140 - const struct plat_smp_ops cmp_smp_ops = { 141 - .send_ipi_single = mips_smp_send_ipi_single, 142 - .send_ipi_mask = mips_smp_send_ipi_mask, 143 - .init_secondary = cmp_init_secondary, 144 - .smp_finish = cmp_smp_finish, 145 - .boot_secondary = cmp_boot_secondary, 146 - .smp_setup = cmp_smp_setup, 147 - .prepare_cpus = cmp_prepare_cpus, 148 - };
+5
arch/mips/kernel/smp-cps.c
··· 361 361 362 362 static void cps_init_secondary(void) 363 363 { 364 + int core = cpu_core(&current_cpu_data); 365 + 364 366 /* Disable MT - we only want to run 1 TC per VPE */ 365 367 if (cpu_has_mipsmt) 366 368 dmt(); ··· 377 375 */ 378 376 BUG_ON(ident != mips_cm_vp_id(smp_processor_id())); 379 377 } 378 + 379 + if (core > 0 && !read_gcr_cl_coherence()) 380 + pr_warn("Core %u is not in coherent domain\n", core); 380 381 381 382 if (cpu_has_veic) 382 383 clear_c0_status(ST0_IM);
+1 -18
arch/mips/kernel/uprobes.c
··· 191 191 { 192 192 struct uprobe_task *utask = current->utask; 193 193 194 + current->thread.trap_nr = utask->autask.saved_trap_nr; 194 195 instruction_pointer_set(regs, utask->vaddr); 195 196 } 196 197 ··· 206 205 regs->regs[31] = trampoline_vaddr; 207 206 208 207 return ra; 209 - } 210 - 211 - /** 212 - * set_swbp - store breakpoint at a given address. 213 - * @auprobe: arch specific probepoint information. 214 - * @mm: the probed process address space. 215 - * @vaddr: the virtual address to insert the opcode. 216 - * 217 - * For mm @mm, store the breakpoint instruction at @vaddr. 218 - * Return 0 (success) or a negative errno. 219 - * 220 - * This version overrides the weak version in kernel/events/uprobes.c. 221 - * It is required to handle MIPS16 and microMIPS. 222 - */ 223 - int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, 224 - unsigned long vaddr) 225 - { 226 - return uprobe_write_opcode(auprobe, mm, vaddr, UPROBE_SWBP_INSN); 227 208 } 228 209 229 210 void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
-179
arch/mips/kernel/vpe-cmp.c
··· 1 - /* 2 - * This file is subject to the terms and conditions of the GNU General Public 3 - * License. See the file "COPYING" in the main directory of this archive 4 - * for more details. 5 - * 6 - * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved. 7 - * Copyright (C) 2013 Imagination Technologies Ltd. 8 - */ 9 - #include <linux/kernel.h> 10 - #include <linux/device.h> 11 - #include <linux/fs.h> 12 - #include <linux/slab.h> 13 - #include <linux/export.h> 14 - 15 - #include <asm/vpe.h> 16 - 17 - static int major; 18 - 19 - void cleanup_tc(struct tc *tc) 20 - { 21 - 22 - } 23 - 24 - static ssize_t store_kill(struct device *dev, struct device_attribute *attr, 25 - const char *buf, size_t len) 26 - { 27 - struct vpe *vpe = get_vpe(aprp_cpu_index()); 28 - struct vpe_notifications *notifier; 29 - 30 - list_for_each_entry(notifier, &vpe->notify, list) 31 - notifier->stop(aprp_cpu_index()); 32 - 33 - release_progmem(vpe->load_addr); 34 - vpe->state = VPE_STATE_UNUSED; 35 - 36 - return len; 37 - } 38 - static DEVICE_ATTR(kill, S_IWUSR, NULL, store_kill); 39 - 40 - static ssize_t ntcs_show(struct device *cd, struct device_attribute *attr, 41 - char *buf) 42 - { 43 - struct vpe *vpe = get_vpe(aprp_cpu_index()); 44 - 45 - return sprintf(buf, "%d\n", vpe->ntcs); 46 - } 47 - 48 - static ssize_t ntcs_store(struct device *dev, struct device_attribute *attr, 49 - const char *buf, size_t len) 50 - { 51 - struct vpe *vpe = get_vpe(aprp_cpu_index()); 52 - unsigned long new; 53 - int ret; 54 - 55 - ret = kstrtoul(buf, 0, &new); 56 - if (ret < 0) 57 - return ret; 58 - 59 - /* APRP can only reserve one TC in a VPE and no more. */ 60 - if (new != 1) 61 - return -EINVAL; 62 - 63 - vpe->ntcs = new; 64 - 65 - return len; 66 - } 67 - static DEVICE_ATTR_RW(ntcs); 68 - 69 - static struct attribute *vpe_attrs[] = { 70 - &dev_attr_kill.attr, 71 - &dev_attr_ntcs.attr, 72 - NULL, 73 - }; 74 - ATTRIBUTE_GROUPS(vpe); 75 - 76 - static void vpe_device_release(struct device *cd) 77 - { 78 - } 79 - 80 - static struct class vpe_class = { 81 - .name = "vpe", 82 - .dev_release = vpe_device_release, 83 - .dev_groups = vpe_groups, 84 - }; 85 - 86 - static struct device vpe_device; 87 - 88 - int __init vpe_module_init(void) 89 - { 90 - struct vpe *v = NULL; 91 - struct tc *t; 92 - int err; 93 - 94 - if (!cpu_has_mipsmt) { 95 - pr_warn("VPE loader: not a MIPS MT capable processor\n"); 96 - return -ENODEV; 97 - } 98 - 99 - if (num_possible_cpus() - aprp_cpu_index() < 1) { 100 - pr_warn("No VPEs reserved for AP/SP, not initialize VPE loader\n" 101 - "Pass maxcpus=<n> argument as kernel argument\n"); 102 - return -ENODEV; 103 - } 104 - 105 - major = register_chrdev(0, VPE_MODULE_NAME, &vpe_fops); 106 - if (major < 0) { 107 - pr_warn("VPE loader: unable to register character device\n"); 108 - return major; 109 - } 110 - 111 - err = class_register(&vpe_class); 112 - if (err) { 113 - pr_err("vpe_class registration failed\n"); 114 - goto out_chrdev; 115 - } 116 - 117 - device_initialize(&vpe_device); 118 - vpe_device.class = &vpe_class; 119 - vpe_device.parent = NULL; 120 - dev_set_name(&vpe_device, "vpe_sp"); 121 - vpe_device.devt = MKDEV(major, VPE_MODULE_MINOR); 122 - err = device_add(&vpe_device); 123 - if (err) { 124 - pr_err("Adding vpe_device failed\n"); 125 - goto out_class; 126 - } 127 - 128 - t = alloc_tc(aprp_cpu_index()); 129 - if (!t) { 130 - pr_warn("VPE: unable to allocate TC\n"); 131 - err = -ENOMEM; 132 - goto out_dev; 133 - } 134 - 135 - /* VPE */ 136 - v = alloc_vpe(aprp_cpu_index()); 137 - if (v == NULL) { 138 - pr_warn("VPE: unable to allocate VPE\n"); 139 - kfree(t); 140 - err = -ENOMEM; 141 - goto out_dev; 142 - } 143 - 144 - v->ntcs = 1; 145 - 146 - /* add the tc to the list of this vpe's tc's. */ 147 - list_add(&t->tc, &v->tc); 148 - 149 - /* TC */ 150 - t->pvpe = v; /* set the parent vpe */ 151 - 152 - return 0; 153 - 154 - out_dev: 155 - device_del(&vpe_device); 156 - 157 - out_class: 158 - put_device(&vpe_device); 159 - class_unregister(&vpe_class); 160 - 161 - out_chrdev: 162 - unregister_chrdev(major, VPE_MODULE_NAME); 163 - 164 - return err; 165 - } 166 - 167 - void __exit vpe_module_exit(void) 168 - { 169 - struct vpe *v, *n; 170 - 171 - device_unregister(&vpe_device); 172 - class_unregister(&vpe_class); 173 - unregister_chrdev(major, VPE_MODULE_NAME); 174 - 175 - /* No locking needed here */ 176 - list_for_each_entry_safe(v, n, &vpecontrol.vpe_list, list) 177 - if (v->state != VPE_STATE_UNUSED) 178 - release_vpe(v); 179 - }
+1 -1
arch/mips/kernel/vpe.c
··· 794 794 795 795 static int vpe_release(struct inode *inode, struct file *filp) 796 796 { 797 - #if defined(CONFIG_MIPS_VPE_LOADER_MT) || defined(CONFIG_MIPS_VPE_LOADER_CMP) 797 + #ifdef CONFIG_MIPS_VPE_LOADER_MT 798 798 struct vpe *v; 799 799 Elf_Ehdr *hdr; 800 800 int ret = 0;
+3
arch/mips/loongson2ef/Kconfig
··· 7 7 config LEMOTE_FULOONG2E 8 8 bool "Lemote Fuloong(2e) mini-PC" 9 9 select ARCH_SPARSEMEM_ENABLE 10 + select ARCH_HAS_PHYS_TO_DMA 10 11 select ARCH_MIGHT_HAVE_PC_PARPORT 11 12 select ARCH_MIGHT_HAVE_PC_SERIO 12 13 select CEVT_R4K ··· 37 36 config LEMOTE_MACH2F 38 37 bool "Lemote Loongson 2F family machines" 39 38 select ARCH_SPARSEMEM_ENABLE 39 + select ARCH_HAS_PHYS_TO_DMA 40 40 select ARCH_MIGHT_HAVE_PC_PARPORT 41 41 select ARCH_MIGHT_HAVE_PC_SERIO 42 42 select BOARD_SCACHE ··· 48 46 select CSRC_R4K if ! MIPS_EXTERNAL_TIMER 49 47 select DMA_NONCOHERENT 50 48 select GENERIC_ISA_DMA_SUPPORT_BROKEN 49 + select GPIOLIB 51 50 select FORCE_PCI 52 51 select I8259 53 52 select IRQ_MIPS_CPU
-35
arch/mips/loongson2ef/Platform
··· 2 2 # Loongson Processors' Support 3 3 # 4 4 5 - cflags-$(CONFIG_CPU_LOONGSON2EF) += -Wa,--trap 6 - cflags-$(CONFIG_CPU_LOONGSON2E) += -march=loongson2e 7 - cflags-$(CONFIG_CPU_LOONGSON2F) += -march=loongson2f 8 - # 9 - # Some versions of binutils, not currently mainline as of 2019/02/04, support 10 - # an -mfix-loongson3-llsc flag which emits a sync prior to each ll instruction 11 - # to work around a CPU bug (see __SYNC_loongson3_war in asm/sync.h for a 12 - # description). 13 - # 14 - # We disable this in order to prevent the assembler meddling with the 15 - # instruction that labels refer to, ie. if we label an ll instruction: 16 - # 17 - # 1: ll v0, 0(a0) 18 - # 19 - # ...then with the assembler fix applied the label may actually point at a sync 20 - # instruction inserted by the assembler, and if we were using the label in an 21 - # exception table the table would no longer contain the address of the ll 22 - # instruction. 23 - # 24 - # Avoid this by explicitly disabling that assembler behaviour. If upstream 25 - # binutils does not merge support for the flag then we can revisit & remove 26 - # this later - for now it ensures vendor toolchains don't cause problems. 27 - # 28 - cflags-$(CONFIG_CPU_LOONGSON2EF) += $(call cc-option,-Wa$(comma)-mno-fix-loongson3-llsc,) 29 - 30 - # Enable the workarounds for Loongson2f 31 - ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS 32 - cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa,-mfix-loongson2f-nop 33 - cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa,-mfix-loongson2f-jump 34 - endif 35 - 36 - # Some -march= flags enable MMI instructions, and GCC complains about that 37 - # support being enabled alongside -msoft-float. Thus explicitly disable MMI. 38 - cflags-y += $(call cc-option,-mno-loongson-mmi) 39 - 40 5 # 41 6 # Loongson Machines' Support 42 7 #
+1 -1
arch/mips/loongson2ef/common/cs5536/cs5536_isa.c
··· 213 213 lo |= 0x00000063; 214 214 _wrmsr(SB_MSR_REG(SB_ERROR), hi, lo); 215 215 } 216 - 216 + break; 217 217 default: 218 218 /* ALL OTHER PCI CONFIG SPACE HEADER IS NOT IMPLEMENTED. */ 219 219 break;
-16
arch/mips/loongson64/Platform
··· 1 1 # 2 - # Loongson Processors' Support 3 - # 4 - 5 - 6 - cflags-$(CONFIG_CPU_LOONGSON64) += -Wa,--trap 7 - 8 - ifdef CONFIG_CPU_LOONGSON64 9 - cflags-$(CONFIG_CC_IS_GCC) += -march=loongson3a 10 - cflags-$(CONFIG_CC_IS_CLANG) += -march=mips64r2 11 - endif 12 - 13 - # Some -march= flags enable MMI instructions, and GCC complains about that 14 - # support being enabled alongside -msoft-float. Thus explicitly disable MMI. 15 - cflags-y += $(call cc-option,-mno-loongson-mmi) 16 - 17 - # 18 2 # Loongson Machines' Support 19 3 # 20 4
-15
arch/mips/loongson64/setup.c
··· 6 6 #include <linux/export.h> 7 7 #include <linux/init.h> 8 8 9 - #include <asm/wbflush.h> 10 9 #include <asm/bootinfo.h> 11 10 #include <linux/libfdt.h> 12 11 #include <linux/of_fdt.h> ··· 15 16 #include <loongson.h> 16 17 17 18 void *loongson_fdt_blob; 18 - 19 - static void wbflush_loongson(void) 20 - { 21 - asm(".set\tpush\n\t" 22 - ".set\tnoreorder\n\t" 23 - ".set mips3\n\t" 24 - "sync\n\t" 25 - "nop\n\t" 26 - ".set\tpop\n\t" 27 - ".set mips0\n\t"); 28 - } 29 - 30 - void (*__wbflush)(void) = wbflush_loongson; 31 - EXPORT_SYMBOL(__wbflush); 32 19 33 20 void __init plat_mem_setup(void) 34 21 {
+18 -32
arch/mips/loongson64/smp.c
··· 27 27 28 28 #define LS_IPI_IRQ (MIPS_CPU_IRQ_BASE + 6) 29 29 30 - static void *ipi_set0_regs[16]; 31 - static void *ipi_clear0_regs[16]; 32 - static void *ipi_status0_regs[16]; 33 - static void *ipi_en0_regs[16]; 34 - static void *ipi_mailbox_buf[16]; 30 + static void __iomem *ipi_set0_regs[16]; 31 + static void __iomem *ipi_clear0_regs[16]; 32 + static void __iomem *ipi_status0_regs[16]; 33 + static void __iomem *ipi_en0_regs[16]; 34 + static void __iomem *ipi_mailbox_buf[16]; 35 35 static uint32_t core0_c0count[NR_CPUS]; 36 - 37 - /* read a 32bit value from ipi register */ 38 - #define loongson3_ipi_read32(addr) readl(addr) 39 - /* read a 64bit value from ipi register */ 40 - #define loongson3_ipi_read64(addr) readq(addr) 41 - /* write a 32bit value to ipi register */ 42 - #define loongson3_ipi_write32(action, addr) \ 43 - do { \ 44 - writel(action, addr); \ 45 - __wbflush(); \ 46 - } while (0) 47 - /* write a 64bit value to ipi register */ 48 - #define loongson3_ipi_write64(action, addr) \ 49 - do { \ 50 - writeq(action, addr); \ 51 - __wbflush(); \ 52 - } while (0) 53 36 54 37 static u32 (*ipi_read_clear)(int cpu); 55 38 static void (*ipi_write_action)(int cpu, u32 action); ··· 119 136 u32 action; 120 137 121 138 /* Load the ipi register to figure out what we're supposed to do */ 122 - action = loongson3_ipi_read32(ipi_status0_regs[cpu_logical_map(cpu)]); 139 + action = readl_relaxed(ipi_status0_regs[cpu_logical_map(cpu)]); 123 140 /* Clear the ipi register to clear the interrupt */ 124 - loongson3_ipi_write32(action, ipi_clear0_regs[cpu_logical_map(cpu)]); 141 + writel_relaxed(action, ipi_clear0_regs[cpu_logical_map(cpu)]); 142 + nudge_writes(); 125 143 126 144 return action; 127 145 } 128 146 129 147 static void legacy_ipi_write_action(int cpu, u32 action) 130 148 { 131 - loongson3_ipi_write32((u32)action, ipi_set0_regs[cpu]); 149 + writel_relaxed((u32)action, ipi_set0_regs[cpu]); 150 + nudge_writes(); 132 151 } 133 152 134 153 static void legacy_ipi_write_enable(int cpu) 135 154 { 136 - loongson3_ipi_write32(0xffffffff, ipi_en0_regs[cpu_logical_map(cpu)]); 155 + writel_relaxed(0xffffffff, ipi_en0_regs[cpu_logical_map(cpu)]); 137 156 } 138 157 139 158 static void legacy_ipi_clear_buf(int cpu) 140 159 { 141 - loongson3_ipi_write64(0, ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x0); 160 + writeq_relaxed(0, ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x0); 142 161 } 143 162 144 163 static void legacy_ipi_write_buf(int cpu, struct task_struct *idle) ··· 156 171 pr_debug("CPU#%d, func_pc=%lx, sp=%lx, gp=%lx\n", 157 172 cpu, startargs[0], startargs[1], startargs[2]); 158 173 159 - loongson3_ipi_write64(startargs[3], 174 + writeq_relaxed(startargs[3], 160 175 ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x18); 161 - loongson3_ipi_write64(startargs[2], 176 + writeq_relaxed(startargs[2], 162 177 ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x10); 163 - loongson3_ipi_write64(startargs[1], 178 + writeq_relaxed(startargs[1], 164 179 ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x8); 165 - loongson3_ipi_write64(startargs[0], 180 + writeq_relaxed(startargs[0], 166 181 ipi_mailbox_buf[cpu_logical_map(cpu)] + 0x0); 182 + nudge_writes(); 167 183 } 168 184 169 185 static void csr_ipi_probe(void) ··· 404 418 c0count = c0count ? c0count : 1; 405 419 for (i = 1; i < nr_cpu_ids; i++) 406 420 core0_c0count[i] = c0count; 407 - __wbflush(); /* Let others see the result ASAP */ 421 + nudge_writes(); /* Let others see the result ASAP */ 408 422 } 409 423 410 424 return IRQ_HANDLED;
+5
arch/mips/mm/c-octeon.c
··· 83 83 else 84 84 mask = *cpu_online_mask; 85 85 cpumask_clear_cpu(cpu, &mask); 86 + #ifdef CONFIG_CAVIUM_OCTEON_SOC 86 87 for_each_cpu(cpu, &mask) 87 88 octeon_send_ipi_single(cpu, SMP_ICACHE_FLUSH); 89 + #else 90 + smp_call_function_many(&mask, (smp_call_func_t)octeon_local_flush_icache, 91 + NULL, 1); 92 + #endif 88 93 89 94 preempt_enable(); 90 95 #endif
-5
arch/mips/mm/c-r3k.c
··· 261 261 r3k_flush_icache_range(kaddr, kaddr + PAGE_SIZE); 262 262 } 263 263 264 - static void local_r3k_flush_data_cache_page(void *addr) 265 - { 266 - } 267 - 268 264 static void r3k_flush_data_cache_page(unsigned long addr) 269 265 { 270 266 } ··· 298 302 299 303 __flush_kernel_vmap_range = r3k_flush_kernel_vmap_range; 300 304 301 - local_flush_data_cache_page = local_r3k_flush_data_cache_page; 302 305 flush_data_cache_page = r3k_flush_data_cache_page; 303 306 304 307 _dma_cache_wback_inv = r3k_dma_cache_wback_inv;
+3 -126
arch/mips/mm/c-r4k.c
··· 110 110 static unsigned long vcache_size __read_mostly; 111 111 static unsigned long scache_size __read_mostly; 112 112 113 - /* 114 - * Dummy cache handling routines for machines without boardcaches 115 - */ 116 - static void cache_noop(void) {} 117 - 118 - static struct bcache_ops no_sc_ops = { 119 - .bc_enable = (void *)cache_noop, 120 - .bc_disable = (void *)cache_noop, 121 - .bc_wback_inv = (void *)cache_noop, 122 - .bc_inv = (void *)cache_noop 123 - }; 124 - 125 - struct bcache_ops *bcops = &no_sc_ops; 126 - 127 113 #define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x00002010) 128 114 #define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x00002020) 129 115 ··· 187 201 188 202 #endif 189 203 190 - static void (* r4k_blast_dcache_page_indexed)(unsigned long addr); 191 - 192 - static void r4k_blast_dcache_page_indexed_setup(void) 193 - { 194 - unsigned long dc_lsize = cpu_dcache_line_size(); 195 - 196 - if (dc_lsize == 0) 197 - r4k_blast_dcache_page_indexed = (void *)cache_noop; 198 - else if (dc_lsize == 16) 199 - r4k_blast_dcache_page_indexed = blast_dcache16_page_indexed; 200 - else if (dc_lsize == 32) 201 - r4k_blast_dcache_page_indexed = blast_dcache32_page_indexed; 202 - else if (dc_lsize == 64) 203 - r4k_blast_dcache_page_indexed = blast_dcache64_page_indexed; 204 - else if (dc_lsize == 128) 205 - r4k_blast_dcache_page_indexed = blast_dcache128_page_indexed; 206 - } 207 - 208 204 void (* r4k_blast_dcache)(void); 209 205 EXPORT_SYMBOL(r4k_blast_dcache); 210 206 ··· 248 280 addr | ws, 32); 249 281 } 250 282 251 - static inline void blast_icache32_r4600_v1_page_indexed(unsigned long page) 252 - { 253 - unsigned long flags; 254 - 255 - local_irq_save(flags); 256 - blast_icache32_page_indexed(page); 257 - local_irq_restore(flags); 258 - } 259 - 260 - static inline void tx49_blast_icache32_page_indexed(unsigned long page) 261 - { 262 - unsigned long indexmask = current_cpu_data.icache.waysize - 1; 263 - unsigned long start = INDEX_BASE + (page & indexmask); 264 - unsigned long end = start + PAGE_SIZE; 265 - unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit; 266 - unsigned long ws_end = current_cpu_data.icache.ways << 267 - current_cpu_data.icache.waybit; 268 - unsigned long ws, addr; 269 - 270 - CACHE32_UNROLL32_ALIGN2; 271 - /* I'm in even chunk. blast odd chunks */ 272 - for (ws = 0; ws < ws_end; ws += ws_inc) 273 - for (addr = start + 0x400; addr < end; addr += 0x400 * 2) 274 - cache_unroll(32, kernel_cache, Index_Invalidate_I, 275 - addr | ws, 32); 276 - CACHE32_UNROLL32_ALIGN; 277 - /* I'm in odd chunk. blast even chunks */ 278 - for (ws = 0; ws < ws_end; ws += ws_inc) 279 - for (addr = start; addr < end; addr += 0x400 * 2) 280 - cache_unroll(32, kernel_cache, Index_Invalidate_I, 281 - addr | ws, 32); 282 - } 283 - 284 283 static void (* r4k_blast_icache_page)(unsigned long addr); 285 284 286 285 static void r4k_blast_icache_page_setup(void) ··· 289 354 } 290 355 291 356 #endif 292 - 293 - static void (* r4k_blast_icache_page_indexed)(unsigned long addr); 294 - 295 - static void r4k_blast_icache_page_indexed_setup(void) 296 - { 297 - unsigned long ic_lsize = cpu_icache_line_size(); 298 - 299 - if (ic_lsize == 0) 300 - r4k_blast_icache_page_indexed = (void *)cache_noop; 301 - else if (ic_lsize == 16) 302 - r4k_blast_icache_page_indexed = blast_icache16_page_indexed; 303 - else if (ic_lsize == 32) { 304 - if (IS_ENABLED(CONFIG_WAR_R4600_V1_INDEX_ICACHEOP) && 305 - cpu_is_r4600_v1_x()) 306 - r4k_blast_icache_page_indexed = 307 - blast_icache32_r4600_v1_page_indexed; 308 - else if (IS_ENABLED(CONFIG_WAR_TX49XX_ICACHE_INDEX_INV)) 309 - r4k_blast_icache_page_indexed = 310 - tx49_blast_icache32_page_indexed; 311 - else if (current_cpu_type() == CPU_LOONGSON2EF) 312 - r4k_blast_icache_page_indexed = 313 - loongson2_blast_icache32_page_indexed; 314 - else 315 - r4k_blast_icache_page_indexed = 316 - blast_icache32_page_indexed; 317 - } else if (ic_lsize == 64) 318 - r4k_blast_icache_page_indexed = blast_icache64_page_indexed; 319 - } 320 357 321 358 void (* r4k_blast_icache)(void); 322 359 EXPORT_SYMBOL(r4k_blast_icache); ··· 333 426 r4k_blast_scache_page = blast_scache64_page; 334 427 else if (sc_lsize == 128) 335 428 r4k_blast_scache_page = blast_scache128_page; 336 - } 337 - 338 - static void (* r4k_blast_scache_page_indexed)(unsigned long addr); 339 - 340 - static void r4k_blast_scache_page_indexed_setup(void) 341 - { 342 - unsigned long sc_lsize = cpu_scache_line_size(); 343 - 344 - if (scache_size == 0) 345 - r4k_blast_scache_page_indexed = (void *)cache_noop; 346 - else if (sc_lsize == 16) 347 - r4k_blast_scache_page_indexed = blast_scache16_page_indexed; 348 - else if (sc_lsize == 32) 349 - r4k_blast_scache_page_indexed = blast_scache32_page_indexed; 350 - else if (sc_lsize == 64) 351 - r4k_blast_scache_page_indexed = blast_scache64_page_indexed; 352 - else if (sc_lsize == 128) 353 - r4k_blast_scache_page_indexed = blast_scache128_page_indexed; 354 429 } 355 430 356 431 static void (* r4k_blast_scache)(void); ··· 1710 1821 setup_scache(); 1711 1822 1712 1823 r4k_blast_dcache_page_setup(); 1713 - r4k_blast_dcache_page_indexed_setup(); 1714 1824 r4k_blast_dcache_setup(); 1715 1825 r4k_blast_icache_page_setup(); 1716 - r4k_blast_icache_page_indexed_setup(); 1717 1826 r4k_blast_icache_setup(); 1718 1827 r4k_blast_scache_page_setup(); 1719 - r4k_blast_scache_page_indexed_setup(); 1720 1828 r4k_blast_scache_setup(); 1721 1829 r4k_blast_scache_node_setup(); 1722 1830 #ifdef CONFIG_EVA ··· 1745 1859 __flush_kernel_vmap_range = r4k_flush_kernel_vmap_range; 1746 1860 1747 1861 flush_icache_all = r4k_flush_icache_all; 1748 - local_flush_data_cache_page = local_r4k_flush_data_cache_page; 1749 1862 flush_data_cache_page = r4k_flush_data_cache_page; 1750 1863 flush_icache_range = r4k_flush_icache_range; 1751 1864 local_flush_icache_range = local_r4k_flush_icache_range; ··· 1752 1867 __local_flush_icache_user_range = local_r4k_flush_icache_user_range; 1753 1868 1754 1869 #ifdef CONFIG_DMA_NONCOHERENT 1755 - if (dma_default_coherent) { 1756 - _dma_cache_wback_inv = (void *)cache_noop; 1757 - _dma_cache_wback = (void *)cache_noop; 1758 - _dma_cache_inv = (void *)cache_noop; 1759 - } else { 1760 - _dma_cache_wback_inv = r4k_dma_cache_wback_inv; 1761 - _dma_cache_wback = r4k_dma_cache_wback_inv; 1762 - _dma_cache_inv = r4k_dma_cache_inv; 1763 - } 1870 + _dma_cache_wback_inv = r4k_dma_cache_wback_inv; 1871 + _dma_cache_wback = r4k_dma_cache_wback_inv; 1872 + _dma_cache_inv = r4k_dma_cache_inv; 1764 1873 #endif /* CONFIG_DMA_NONCOHERENT */ 1765 1874 1766 1875 build_clear_page(); ··· 1787 1908 /* I$ fills from D$ just by emptying the write buffers */ 1788 1909 flush_cache_page = (void *)b5k_instruction_hazard; 1789 1910 flush_cache_range = (void *)b5k_instruction_hazard; 1790 - local_flush_data_cache_page = (void *)b5k_instruction_hazard; 1791 1911 flush_data_cache_page = (void *)b5k_instruction_hazard; 1792 1912 flush_icache_range = (void *)b5k_instruction_hazard; 1793 1913 local_flush_icache_range = (void *)b5k_instruction_hazard; ··· 1806 1928 flush_cache_range = (void *)cache_noop; 1807 1929 flush_icache_all = (void *)cache_noop; 1808 1930 flush_data_cache_page = (void *)cache_noop; 1809 - local_flush_data_cache_page = (void *)cache_noop; 1810 1931 break; 1811 1932 } 1812 1933 }
+19 -2
arch/mips/mm/cache.c
··· 17 17 #include <linux/highmem.h> 18 18 #include <linux/pagemap.h> 19 19 20 + #include <asm/bcache.h> 20 21 #include <asm/cacheflush.h> 21 22 #include <asm/processor.h> 22 23 #include <asm/cpu.h> ··· 49 48 EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range); 50 49 51 50 /* MIPS specific cache operations */ 52 - void (*local_flush_data_cache_page)(void * addr); 53 51 void (*flush_data_cache_page)(unsigned long addr); 54 52 void (*flush_icache_all)(void); 55 53 56 - EXPORT_SYMBOL_GPL(local_flush_data_cache_page); 57 54 EXPORT_SYMBOL(flush_data_cache_page); 58 55 EXPORT_SYMBOL(flush_icache_all); 56 + 57 + /* 58 + * Dummy cache handling routine 59 + */ 60 + 61 + void cache_noop(void) {} 62 + 63 + #ifdef CONFIG_BOARD_SCACHE 64 + 65 + static struct bcache_ops no_sc_ops = { 66 + .bc_enable = (void *)cache_noop, 67 + .bc_disable = (void *)cache_noop, 68 + .bc_wback_inv = (void *)cache_noop, 69 + .bc_inv = (void *)cache_noop 70 + }; 71 + 72 + struct bcache_ops *bcops = &no_sc_ops; 73 + #endif 59 74 60 75 #ifdef CONFIG_DMA_NONCOHERENT 61 76
-2
arch/mips/mti-malta/Makefile
··· 14 14 obj-y += malta-setup.o 15 15 obj-y += malta-time.o 16 16 17 - obj-$(CONFIG_MIPS_CMP) += malta-amon.o 18 - 19 17 CFLAGS_malta-dtshim.o = -I$(src)/../../../scripts/dtc/libfdt
-88
arch/mips/mti-malta/malta-amon.c
··· 1 - /* 2 - * This file is subject to the terms and conditions of the GNU General Public 3 - * License. See the file "COPYING" in the main directory of this archive 4 - * for more details. 5 - * 6 - * Copyright (C) 2007 MIPS Technologies, Inc. All rights reserved. 7 - * Copyright (C) 2013 Imagination Technologies Ltd. 8 - * 9 - * Arbitrary Monitor Interface 10 - */ 11 - #include <linux/kernel.h> 12 - #include <linux/smp.h> 13 - 14 - #include <asm/addrspace.h> 15 - #include <asm/mipsmtregs.h> 16 - #include <asm/mips-boards/launch.h> 17 - #include <asm/vpe.h> 18 - 19 - int amon_cpu_avail(int cpu) 20 - { 21 - struct cpulaunch *launch = (struct cpulaunch *)CKSEG0ADDR(CPULAUNCH); 22 - 23 - if (cpu < 0 || cpu >= NCPULAUNCH) { 24 - pr_debug("avail: cpu%d is out of range\n", cpu); 25 - return 0; 26 - } 27 - 28 - launch += cpu; 29 - if (!(launch->flags & LAUNCH_FREADY)) { 30 - pr_debug("avail: cpu%d is not ready\n", cpu); 31 - return 0; 32 - } 33 - if (launch->flags & (LAUNCH_FGO|LAUNCH_FGONE)) { 34 - pr_debug("avail: too late.. cpu%d is already gone\n", cpu); 35 - return 0; 36 - } 37 - 38 - return 1; 39 - } 40 - 41 - int amon_cpu_start(int cpu, 42 - unsigned long pc, unsigned long sp, 43 - unsigned long gp, unsigned long a0) 44 - { 45 - volatile struct cpulaunch *launch = 46 - (struct cpulaunch *)CKSEG0ADDR(CPULAUNCH); 47 - 48 - if (!amon_cpu_avail(cpu)) 49 - return -1; 50 - if (cpu == smp_processor_id()) { 51 - pr_debug("launch: I am cpu%d!\n", cpu); 52 - return -1; 53 - } 54 - launch += cpu; 55 - 56 - pr_debug("launch: starting cpu%d\n", cpu); 57 - 58 - launch->pc = pc; 59 - launch->gp = gp; 60 - launch->sp = sp; 61 - launch->a0 = a0; 62 - 63 - smp_wmb(); /* Target must see parameters before go */ 64 - launch->flags |= LAUNCH_FGO; 65 - smp_wmb(); /* Target must see go before we poll */ 66 - 67 - while ((launch->flags & LAUNCH_FGONE) == 0) 68 - ; 69 - smp_rmb(); /* Target will be updating flags soon */ 70 - pr_debug("launch: cpu%d gone!\n", cpu); 71 - 72 - return 0; 73 - } 74 - 75 - #ifdef CONFIG_MIPS_VPE_LOADER_CMP 76 - int vpe_run(struct vpe *v) 77 - { 78 - struct vpe_notifications *n; 79 - 80 - if (amon_cpu_start(aprp_cpu_index(), v->__start, 0, 0, 0) < 0) 81 - return -1; 82 - 83 - list_for_each_entry(n, &v->notify, list) 84 - n->start(VPE_MODULE_MINOR); 85 - 86 - return 0; 87 - } 88 - #endif
-2
arch/mips/mti-malta/malta-init.c
··· 289 289 290 290 if (!register_cps_smp_ops()) 291 291 return; 292 - if (!register_cmp_smp_ops()) 293 - return; 294 292 if (!register_vsmp_smp_ops()) 295 293 return; 296 294 register_up_smp_ops();
-2
arch/mips/mti-malta/malta-platform.c
··· 43 43 static struct plat_serial8250_port uart8250_data[] = { 44 44 SMC_PORT(0x3F8, 4), 45 45 SMC_PORT(0x2F8, 3), 46 - #ifndef CONFIG_MIPS_CMP 47 46 { 48 47 .mapbase = 0x1f000900, /* The CBUS UART */ 49 48 .irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB2, ··· 52 53 .flags = CBUS_UART_FLAGS, 53 54 .regshift = 3, 54 55 }, 55 - #endif 56 56 { }, 57 57 }; 58 58
+1 -1
arch/mips/pci/pci-lantiq.c
··· 118 118 119 119 /* and enable the clocks */ 120 120 clk_enable(clk_pci); 121 - if (of_find_property(node, "lantiq,external-clock", NULL)) 121 + if (of_property_read_bool(node, "lantiq,external-clock")) 122 122 clk_enable(clk_external); 123 123 else 124 124 clk_disable(clk_external);
+1 -1
arch/mips/pci/pci-rt3883.c
··· 419 419 420 420 /* find the interrupt controller child node */ 421 421 for_each_child_of_node(np, child) { 422 - if (of_get_property(child, "interrupt-controller", NULL)) { 422 + if (of_property_read_bool(child, "interrupt-controller")) { 423 423 rpc->intc_of_node = child; 424 424 break; 425 425 }
+4
arch/mips/ralink/Kconfig
··· 29 29 select MIPS_AUTO_PFN_OFFSET 30 30 select MIPS_L1_CACHE_SHIFT_4 31 31 select HAVE_PCI 32 + select SOC_BUS 32 33 33 34 config SOC_RT305X 34 35 bool "RT305x" 36 + select SOC_BUS 35 37 36 38 config SOC_RT3883 37 39 bool "RT3883" 38 40 select HAVE_PCI 41 + select SOC_BUS 39 42 40 43 config SOC_MT7620 41 44 bool "MT7620/8" 42 45 select CPU_MIPSR2_IRQ_VI 43 46 select HAVE_PCI 47 + select SOC_BUS 44 48 45 49 config SOC_MT7621 46 50 bool "MT7621"
+119 -26
arch/mips/ralink/mt7620.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/init.h> 13 13 #include <linux/bug.h> 14 + #include <linux/slab.h> 15 + #include <linux/sys_soc.h> 14 16 15 17 #include <asm/mipsregs.h> 16 18 #include <asm/mach-ralink/ralink_regs.h> ··· 50 48 51 49 /* does the board have sdram or ddram */ 52 50 static int dram_type; 51 + 52 + static struct ralink_soc_info *soc_info_ptr; 53 53 54 54 static __init u32 55 55 mt7620_calc_rate(u32 ref_rate, u32 mul, u32 div) ··· 328 324 } 329 325 } 330 326 331 - void __init prom_soc_init(struct ralink_soc_info *soc_info) 327 + static unsigned int __init mt7620_get_soc_name0(void) 332 328 { 333 - void __iomem *sysc = (void __iomem *) KSEG1ADDR(MT7620_SYSC_BASE); 334 - unsigned char *name = NULL; 335 - u32 n0; 336 - u32 n1; 337 - u32 rev; 338 - u32 cfg0; 339 - u32 pmu0; 340 - u32 pmu1; 341 - u32 bga; 329 + return __raw_readl(MT7620_SYSC_BASE + SYSC_REG_CHIP_NAME0); 330 + } 342 331 343 - n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0); 344 - n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1); 345 - rev = __raw_readl(sysc + SYSC_REG_CHIP_REV); 346 - bga = (rev >> CHIP_REV_PKG_SHIFT) & CHIP_REV_PKG_MASK; 332 + static unsigned int __init mt7620_get_soc_name1(void) 333 + { 334 + return __raw_readl(MT7620_SYSC_BASE + SYSC_REG_CHIP_NAME1); 335 + } 347 336 348 - if (n0 == MT7620_CHIP_NAME0 && n1 == MT7620_CHIP_NAME1) { 337 + static bool __init mt7620_soc_valid(void) 338 + { 339 + if (mt7620_get_soc_name0() == MT7620_CHIP_NAME0 && 340 + mt7620_get_soc_name1() == MT7620_CHIP_NAME1) 341 + return true; 342 + else 343 + return false; 344 + } 345 + 346 + static bool __init mt7628_soc_valid(void) 347 + { 348 + if (mt7620_get_soc_name0() == MT7620_CHIP_NAME0 && 349 + mt7620_get_soc_name1() == MT7628_CHIP_NAME1) 350 + return true; 351 + else 352 + return false; 353 + } 354 + 355 + static unsigned int __init mt7620_get_rev(void) 356 + { 357 + return __raw_readl(MT7620_SYSC_BASE + SYSC_REG_CHIP_REV); 358 + } 359 + 360 + static unsigned int __init mt7620_get_bga(void) 361 + { 362 + return (mt7620_get_rev() >> CHIP_REV_PKG_SHIFT) & CHIP_REV_PKG_MASK; 363 + } 364 + 365 + static unsigned int __init mt7620_get_efuse(void) 366 + { 367 + return __raw_readl(MT7620_SYSC_BASE + SYSC_REG_EFUSE_CFG); 368 + } 369 + 370 + static unsigned int __init mt7620_get_soc_ver(void) 371 + { 372 + return (mt7620_get_rev() >> CHIP_REV_VER_SHIFT) & CHIP_REV_VER_MASK; 373 + } 374 + 375 + static unsigned int __init mt7620_get_soc_eco(void) 376 + { 377 + return (mt7620_get_rev() & CHIP_REV_ECO_MASK); 378 + } 379 + 380 + static const char __init *mt7620_get_soc_name(struct ralink_soc_info *soc_info) 381 + { 382 + if (mt7620_soc_valid()) { 383 + u32 bga = mt7620_get_bga(); 384 + 349 385 if (bga) { 350 386 ralink_soc = MT762X_SOC_MT7620A; 351 - name = "MT7620A"; 352 387 soc_info->compatible = "ralink,mt7620a-soc"; 388 + return "MT7620A"; 353 389 } else { 354 390 ralink_soc = MT762X_SOC_MT7620N; 355 - name = "MT7620N"; 356 391 soc_info->compatible = "ralink,mt7620n-soc"; 392 + return "MT7620N"; 357 393 } 358 - } else if (n0 == MT7620_CHIP_NAME0 && n1 == MT7628_CHIP_NAME1) { 359 - u32 efuse = __raw_readl(sysc + SYSC_REG_EFUSE_CFG); 394 + } else if (mt7628_soc_valid()) { 395 + u32 efuse = mt7620_get_efuse(); 396 + unsigned char *name = NULL; 360 397 361 398 if (efuse & EFUSE_MT7688) { 362 399 ralink_soc = MT762X_SOC_MT7688; ··· 407 362 name = "MT7628AN"; 408 363 } 409 364 soc_info->compatible = "ralink,mt7628an-soc"; 365 + return name; 410 366 } else { 411 - panic("mt762x: unknown SoC, n0:%08x n1:%08x\n", n0, n1); 367 + panic("mt762x: unknown SoC, n0:%08x n1:%08x\n", 368 + mt7620_get_soc_name0(), mt7620_get_soc_name1()); 412 369 } 370 + } 371 + 372 + static const char __init *mt7620_get_soc_id_name(void) 373 + { 374 + if (ralink_soc == MT762X_SOC_MT7620A) 375 + return "mt7620a"; 376 + else if (ralink_soc == MT762X_SOC_MT7620N) 377 + return "mt7620n"; 378 + else if (ralink_soc == MT762X_SOC_MT7688) 379 + return "mt7688"; 380 + else if (ralink_soc == MT762X_SOC_MT7628AN) 381 + return "mt7628n"; 382 + else 383 + return "invalid"; 384 + } 385 + 386 + static int __init mt7620_soc_dev_init(void) 387 + { 388 + struct soc_device *soc_dev; 389 + struct soc_device_attribute *soc_dev_attr; 390 + 391 + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 392 + if (!soc_dev_attr) 393 + return -ENOMEM; 394 + 395 + soc_dev_attr->family = "Ralink"; 396 + soc_dev_attr->soc_id = mt7620_get_soc_id_name(); 397 + 398 + soc_dev_attr->data = soc_info_ptr; 399 + 400 + soc_dev = soc_device_register(soc_dev_attr); 401 + if (IS_ERR(soc_dev)) { 402 + kfree(soc_dev_attr); 403 + return PTR_ERR(soc_dev); 404 + } 405 + 406 + return 0; 407 + } 408 + device_initcall(mt7620_soc_dev_init); 409 + 410 + void __init prom_soc_init(struct ralink_soc_info *soc_info) 411 + { 412 + const char *name = mt7620_get_soc_name(soc_info); 413 + u32 cfg0; 414 + u32 pmu0; 415 + u32 pmu1; 413 416 414 417 snprintf(soc_info->sys_type, RAMIPS_SYS_TYPE_LEN, 415 418 "MediaTek %s ver:%u eco:%u", 416 - name, 417 - (rev >> CHIP_REV_VER_SHIFT) & CHIP_REV_VER_MASK, 418 - (rev & CHIP_REV_ECO_MASK)); 419 + name, mt7620_get_soc_ver(), mt7620_get_soc_eco()); 419 420 420 - cfg0 = __raw_readl(sysc + SYSC_REG_SYSTEM_CONFIG0); 421 + cfg0 = __raw_readl(MT7620_SYSC_BASE + SYSC_REG_SYSTEM_CONFIG0); 421 422 if (is_mt76x8()) { 422 423 dram_type = cfg0 & DRAM_TYPE_MT7628_MASK; 423 424 } else { ··· 479 388 else 480 389 mt7620_dram_init(soc_info); 481 390 482 - pmu0 = __raw_readl(sysc + PMU0_CFG); 483 - pmu1 = __raw_readl(sysc + PMU1_CFG); 391 + pmu0 = __raw_readl(MT7620_SYSC_BASE + PMU0_CFG); 392 + pmu1 = __raw_readl(MT7620_SYSC_BASE + PMU1_CFG); 484 393 485 394 pr_info("Analog PMU set to %s control\n", 486 395 (pmu0 & PMU_SW_SET) ? ("sw") : ("hw")); 487 396 pr_info("Digital PMU set to %s control\n", 488 397 (pmu1 & DIG_SW_SEL) ? ("sw") : ("hw")); 398 + 399 + soc_info_ptr = soc_info; 489 400 }
-2
arch/mips/ralink/mt7621.c
··· 217 217 218 218 if (!register_cps_smp_ops()) 219 219 return; 220 - if (!register_cmp_smp_ops()) 221 - return; 222 220 if (!register_vsmp_smp_ops()) 223 221 return; 224 222 }
+78 -18
arch/mips/ralink/rt288x.c
··· 10 10 11 11 #include <linux/kernel.h> 12 12 #include <linux/init.h> 13 + #include <linux/slab.h> 14 + #include <linux/sys_soc.h> 13 15 14 16 #include <asm/mipsregs.h> 15 17 #include <asm/mach-ralink/ralink_regs.h> 16 18 #include <asm/mach-ralink/rt288x.h> 17 19 18 20 #include "common.h" 21 + 22 + static struct ralink_soc_info *soc_info_ptr; 19 23 20 24 void __init ralink_clk_init(void) 21 25 { ··· 61 57 panic("Failed to remap core resources"); 62 58 } 63 59 60 + static unsigned int __init rt2880_get_soc_name0(void) 61 + { 62 + return __raw_readl(RT2880_SYSC_BASE + SYSC_REG_CHIP_NAME0); 63 + } 64 + 65 + static unsigned int __init rt2880_get_soc_name1(void) 66 + { 67 + return __raw_readl(RT2880_SYSC_BASE + SYSC_REG_CHIP_NAME1); 68 + } 69 + 70 + static bool __init rt2880_soc_valid(void) 71 + { 72 + if (rt2880_get_soc_name0() == RT2880_CHIP_NAME0 && 73 + rt2880_get_soc_name1() == RT2880_CHIP_NAME1) 74 + return true; 75 + else 76 + return false; 77 + } 78 + 79 + static const char __init *rt2880_get_soc_name(void) 80 + { 81 + if (rt2880_soc_valid()) 82 + return "RT2880"; 83 + else 84 + return "invalid"; 85 + } 86 + 87 + static unsigned int __init rt2880_get_soc_id(void) 88 + { 89 + return __raw_readl(RT2880_SYSC_BASE + SYSC_REG_CHIP_ID); 90 + } 91 + 92 + static unsigned int __init rt2880_get_soc_ver(void) 93 + { 94 + return (rt2880_get_soc_id() >> CHIP_ID_ID_SHIFT) & CHIP_ID_ID_MASK; 95 + } 96 + 97 + static unsigned int __init rt2880_get_soc_rev(void) 98 + { 99 + return (rt2880_get_soc_id() & CHIP_ID_REV_MASK); 100 + } 101 + 102 + static int __init rt2880_soc_dev_init(void) 103 + { 104 + struct soc_device *soc_dev; 105 + struct soc_device_attribute *soc_dev_attr; 106 + 107 + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 108 + if (!soc_dev_attr) 109 + return -ENOMEM; 110 + 111 + soc_dev_attr->family = "Ralink"; 112 + soc_dev_attr->soc_id = rt2880_get_soc_name(); 113 + 114 + soc_dev_attr->data = soc_info_ptr; 115 + 116 + soc_dev = soc_device_register(soc_dev_attr); 117 + if (IS_ERR(soc_dev)) { 118 + kfree(soc_dev_attr); 119 + return PTR_ERR(soc_dev); 120 + } 121 + 122 + return 0; 123 + } 124 + device_initcall(rt2880_soc_dev_init); 125 + 64 126 void __init prom_soc_init(struct ralink_soc_info *soc_info) 65 127 { 66 - void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT2880_SYSC_BASE); 67 - const char *name; 68 - u32 n0; 69 - u32 n1; 70 - u32 id; 71 - 72 - n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0); 73 - n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1); 74 - id = __raw_readl(sysc + SYSC_REG_CHIP_ID); 75 - 76 - if (n0 == RT2880_CHIP_NAME0 && n1 == RT2880_CHIP_NAME1) { 128 + if (rt2880_soc_valid()) 77 129 soc_info->compatible = "ralink,r2880-soc"; 78 - name = "RT2880"; 79 - } else { 80 - panic("rt288x: unknown SoC, n0:%08x n1:%08x", n0, n1); 81 - } 130 + else 131 + panic("rt288x: unknown SoC, n0:%08x n1:%08x", 132 + rt2880_get_soc_name0(), rt2880_get_soc_name1()); 82 133 83 134 snprintf(soc_info->sys_type, RAMIPS_SYS_TYPE_LEN, 84 135 "Ralink %s id:%u rev:%u", 85 - name, 86 - (id >> CHIP_ID_ID_SHIFT) & CHIP_ID_ID_MASK, 87 - (id & CHIP_ID_REV_MASK)); 136 + rt2880_get_soc_name(), 137 + rt2880_get_soc_ver(), 138 + rt2880_get_soc_rev()); 88 139 89 140 soc_info->mem_base = RT2880_SDRAM_BASE; 90 141 soc_info->mem_size_min = RT2880_MEM_SIZE_MIN; 91 142 soc_info->mem_size_max = RT2880_MEM_SIZE_MAX; 92 143 93 144 ralink_soc = RT2880_SOC; 145 + soc_info_ptr = soc_info; 94 146 }
+124 -23
arch/mips/ralink/rt305x.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/init.h> 13 13 #include <linux/bug.h> 14 + #include <linux/slab.h> 15 + #include <linux/sys_soc.h> 14 16 15 17 #include <asm/io.h> 16 18 #include <asm/mipsregs.h> ··· 21 19 22 20 #include "common.h" 23 21 22 + static struct ralink_soc_info *soc_info_ptr; 23 + 24 24 static unsigned long rt5350_get_mem_size(void) 25 25 { 26 - void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE); 27 26 unsigned long ret; 28 27 u32 t; 29 28 30 - t = __raw_readl(sysc + SYSC_REG_SYSTEM_CONFIG); 29 + t = __raw_readl(RT305X_SYSC_BASE + SYSC_REG_SYSTEM_CONFIG); 31 30 t = (t >> RT5350_SYSCFG0_DRAM_SIZE_SHIFT) & 32 31 RT5350_SYSCFG0_DRAM_SIZE_MASK; 33 32 ··· 143 140 panic("Failed to remap core resources"); 144 141 } 145 142 146 - void __init prom_soc_init(struct ralink_soc_info *soc_info) 143 + static unsigned int __init rt305x_get_soc_name0(void) 147 144 { 148 - void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE); 149 - unsigned char *name; 150 - u32 n0; 151 - u32 n1; 152 - u32 id; 145 + return __raw_readl(RT305X_SYSC_BASE + SYSC_REG_CHIP_NAME0); 146 + } 153 147 154 - n0 = __raw_readl(sysc + SYSC_REG_CHIP_NAME0); 155 - n1 = __raw_readl(sysc + SYSC_REG_CHIP_NAME1); 148 + static unsigned int __init rt305x_get_soc_name1(void) 149 + { 150 + return __raw_readl(RT305X_SYSC_BASE + SYSC_REG_CHIP_NAME1); 151 + } 156 152 157 - if (n0 == RT3052_CHIP_NAME0 && n1 == RT3052_CHIP_NAME1) { 153 + static bool __init rt3052_soc_valid(void) 154 + { 155 + if (rt305x_get_soc_name0() == RT3052_CHIP_NAME0 && 156 + rt305x_get_soc_name1() == RT3052_CHIP_NAME1) 157 + return true; 158 + else 159 + return false; 160 + } 161 + 162 + static bool __init rt3350_soc_valid(void) 163 + { 164 + if (rt305x_get_soc_name0() == RT3350_CHIP_NAME0 && 165 + rt305x_get_soc_name1() == RT3350_CHIP_NAME1) 166 + return true; 167 + else 168 + return false; 169 + } 170 + 171 + static bool __init rt3352_soc_valid(void) 172 + { 173 + if (rt305x_get_soc_name0() == RT3352_CHIP_NAME0 && 174 + rt305x_get_soc_name1() == RT3352_CHIP_NAME1) 175 + return true; 176 + else 177 + return false; 178 + } 179 + 180 + static bool __init rt5350_soc_valid(void) 181 + { 182 + if (rt305x_get_soc_name0() == RT5350_CHIP_NAME0 && 183 + rt305x_get_soc_name1() == RT5350_CHIP_NAME1) 184 + return true; 185 + else 186 + return false; 187 + } 188 + 189 + static const char __init *rt305x_get_soc_name(struct ralink_soc_info *soc_info) 190 + { 191 + if (rt3052_soc_valid()) { 158 192 unsigned long icache_sets; 159 193 160 194 icache_sets = (read_c0_config1() >> 22) & 7; 161 195 if (icache_sets == 1) { 162 196 ralink_soc = RT305X_SOC_RT3050; 163 - name = "RT3050"; 164 197 soc_info->compatible = "ralink,rt3050-soc"; 198 + return "RT3050"; 165 199 } else { 166 200 ralink_soc = RT305X_SOC_RT3052; 167 - name = "RT3052"; 168 201 soc_info->compatible = "ralink,rt3052-soc"; 202 + return "RT3052"; 169 203 } 170 - } else if (n0 == RT3350_CHIP_NAME0 && n1 == RT3350_CHIP_NAME1) { 204 + } else if (rt3350_soc_valid()) { 171 205 ralink_soc = RT305X_SOC_RT3350; 172 - name = "RT3350"; 173 206 soc_info->compatible = "ralink,rt3350-soc"; 174 - } else if (n0 == RT3352_CHIP_NAME0 && n1 == RT3352_CHIP_NAME1) { 207 + return "RT3350"; 208 + } else if (rt3352_soc_valid()) { 175 209 ralink_soc = RT305X_SOC_RT3352; 176 - name = "RT3352"; 177 210 soc_info->compatible = "ralink,rt3352-soc"; 178 - } else if (n0 == RT5350_CHIP_NAME0 && n1 == RT5350_CHIP_NAME1) { 211 + return "RT3352"; 212 + } else if (rt5350_soc_valid()) { 179 213 ralink_soc = RT305X_SOC_RT5350; 180 - name = "RT5350"; 181 214 soc_info->compatible = "ralink,rt5350-soc"; 215 + return "RT5350"; 182 216 } else { 183 - panic("rt305x: unknown SoC, n0:%08x n1:%08x", n0, n1); 217 + panic("rt305x: unknown SoC, n0:%08x n1:%08x", 218 + rt305x_get_soc_name0(), rt305x_get_soc_name1()); 219 + } 220 + } 221 + 222 + static unsigned int __init rt305x_get_soc_id(void) 223 + { 224 + return __raw_readl(RT305X_SYSC_BASE + SYSC_REG_CHIP_ID); 225 + } 226 + 227 + static unsigned int __init rt305x_get_soc_ver(void) 228 + { 229 + return (rt305x_get_soc_id() >> CHIP_ID_ID_SHIFT) & CHIP_ID_ID_MASK; 230 + } 231 + 232 + static unsigned int __init rt305x_get_soc_rev(void) 233 + { 234 + return (rt305x_get_soc_id() & CHIP_ID_REV_MASK); 235 + } 236 + 237 + static const char __init *rt305x_get_soc_id_name(void) 238 + { 239 + if (soc_is_rt3050()) 240 + return "rt3050"; 241 + else if (soc_is_rt3052()) 242 + return "rt3052"; 243 + else if (soc_is_rt3350()) 244 + return "rt3350"; 245 + else if (soc_is_rt3352()) 246 + return "rt3352"; 247 + else if (soc_is_rt5350()) 248 + return "rt5350"; 249 + else 250 + return "invalid"; 251 + } 252 + 253 + static int __init rt305x_soc_dev_init(void) 254 + { 255 + struct soc_device *soc_dev; 256 + struct soc_device_attribute *soc_dev_attr; 257 + 258 + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 259 + if (!soc_dev_attr) 260 + return -ENOMEM; 261 + 262 + soc_dev_attr->family = "Ralink"; 263 + soc_dev_attr->soc_id = rt305x_get_soc_id_name(); 264 + 265 + soc_dev_attr->data = soc_info_ptr; 266 + 267 + soc_dev = soc_device_register(soc_dev_attr); 268 + if (IS_ERR(soc_dev)) { 269 + kfree(soc_dev_attr); 270 + return PTR_ERR(soc_dev); 184 271 } 185 272 186 - id = __raw_readl(sysc + SYSC_REG_CHIP_ID); 273 + return 0; 274 + } 275 + device_initcall(rt305x_soc_dev_init); 276 + 277 + void __init prom_soc_init(struct ralink_soc_info *soc_info) 278 + { 279 + const char *name = rt305x_get_soc_name(soc_info); 187 280 188 281 snprintf(soc_info->sys_type, RAMIPS_SYS_TYPE_LEN, 189 282 "Ralink %s id:%u rev:%u", 190 283 name, 191 - (id >> CHIP_ID_ID_SHIFT) & CHIP_ID_ID_MASK, 192 - (id & CHIP_ID_REV_MASK)); 284 + rt305x_get_soc_ver(), 285 + rt305x_get_soc_rev()); 193 286 194 287 soc_info->mem_base = RT305X_SDRAM_BASE; 195 288 if (soc_is_rt5350()) { ··· 297 198 soc_info->mem_size_min = RT3352_MEM_SIZE_MIN; 298 199 soc_info->mem_size_max = RT3352_MEM_SIZE_MAX; 299 200 } 201 + 202 + soc_info_ptr = soc_info; 300 203 }
+78 -18
arch/mips/ralink/rt3883.c
··· 10 10 11 11 #include <linux/kernel.h> 12 12 #include <linux/init.h> 13 + #include <linux/slab.h> 14 + #include <linux/sys_soc.h> 13 15 14 16 #include <asm/mipsregs.h> 15 17 #include <asm/mach-ralink/ralink_regs.h> 16 18 #include <asm/mach-ralink/rt3883.h> 17 19 18 20 #include "common.h" 21 + 22 + static struct ralink_soc_info *soc_info_ptr; 19 23 20 24 void __init ralink_clk_init(void) 21 25 { ··· 74 70 panic("Failed to remap core resources"); 75 71 } 76 72 73 + static unsigned int __init rt3883_get_soc_name0(void) 74 + { 75 + return __raw_readl(RT3883_SYSC_BASE + RT3883_SYSC_REG_CHIPID0_3); 76 + } 77 + 78 + static unsigned int __init rt3883_get_soc_name1(void) 79 + { 80 + return __raw_readl(RT3883_SYSC_BASE + RT3883_SYSC_REG_CHIPID4_7); 81 + } 82 + 83 + static bool __init rt3883_soc_valid(void) 84 + { 85 + if (rt3883_get_soc_name0() == RT3883_CHIP_NAME0 && 86 + rt3883_get_soc_name1() == RT3883_CHIP_NAME1) 87 + return true; 88 + else 89 + return false; 90 + } 91 + 92 + static const char __init *rt3883_get_soc_name(void) 93 + { 94 + if (rt3883_soc_valid()) 95 + return "RT3883"; 96 + else 97 + return "invalid"; 98 + } 99 + 100 + static unsigned int __init rt3883_get_soc_id(void) 101 + { 102 + return __raw_readl(RT3883_SYSC_BASE + RT3883_SYSC_REG_REVID); 103 + } 104 + 105 + static unsigned int __init rt3883_get_soc_ver(void) 106 + { 107 + return (rt3883_get_soc_id() >> RT3883_REVID_VER_ID_SHIFT) & RT3883_REVID_VER_ID_MASK; 108 + } 109 + 110 + static unsigned int __init rt3883_get_soc_rev(void) 111 + { 112 + return (rt3883_get_soc_id() & RT3883_REVID_ECO_ID_MASK); 113 + } 114 + 115 + static int __init rt3883_soc_dev_init(void) 116 + { 117 + struct soc_device *soc_dev; 118 + struct soc_device_attribute *soc_dev_attr; 119 + 120 + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 121 + if (!soc_dev_attr) 122 + return -ENOMEM; 123 + 124 + soc_dev_attr->family = "Ralink"; 125 + soc_dev_attr->soc_id = rt3883_get_soc_name(); 126 + 127 + soc_dev_attr->data = soc_info_ptr; 128 + 129 + soc_dev = soc_device_register(soc_dev_attr); 130 + if (IS_ERR(soc_dev)) { 131 + kfree(soc_dev_attr); 132 + return PTR_ERR(soc_dev); 133 + } 134 + 135 + return 0; 136 + } 137 + device_initcall(rt3883_soc_dev_init); 138 + 77 139 void __init prom_soc_init(struct ralink_soc_info *soc_info) 78 140 { 79 - void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT3883_SYSC_BASE); 80 - const char *name; 81 - u32 n0; 82 - u32 n1; 83 - u32 id; 84 - 85 - n0 = __raw_readl(sysc + RT3883_SYSC_REG_CHIPID0_3); 86 - n1 = __raw_readl(sysc + RT3883_SYSC_REG_CHIPID4_7); 87 - id = __raw_readl(sysc + RT3883_SYSC_REG_REVID); 88 - 89 - if (n0 == RT3883_CHIP_NAME0 && n1 == RT3883_CHIP_NAME1) { 141 + if (rt3883_soc_valid()) 90 142 soc_info->compatible = "ralink,rt3883-soc"; 91 - name = "RT3883"; 92 - } else { 93 - panic("rt3883: unknown SoC, n0:%08x n1:%08x", n0, n1); 94 - } 143 + else 144 + panic("rt3883: unknown SoC, n0:%08x n1:%08x", 145 + rt3883_get_soc_name0(), rt3883_get_soc_name1()); 95 146 96 147 snprintf(soc_info->sys_type, RAMIPS_SYS_TYPE_LEN, 97 148 "Ralink %s ver:%u eco:%u", 98 - name, 99 - (id >> RT3883_REVID_VER_ID_SHIFT) & RT3883_REVID_VER_ID_MASK, 100 - (id & RT3883_REVID_ECO_ID_MASK)); 149 + rt3883_get_soc_name(), 150 + rt3883_get_soc_ver(), 151 + rt3883_get_soc_rev()); 101 152 102 153 soc_info->mem_base = RT3883_SDRAM_BASE; 103 154 soc_info->mem_size_min = RT3883_MEM_SIZE_MIN; 104 155 soc_info->mem_size_max = RT3883_MEM_SIZE_MAX; 105 156 106 157 ralink_soc = RT3883_SOC; 158 + soc_info_ptr = soc_info; 107 159 }
+1 -32
arch/mips/sibyte/Kconfig
··· 10 10 select SIBYTE_SB1xxx_SOC 11 11 select SYS_SUPPORTS_SMP 12 12 13 - config SIBYTE_BCM1120 14 - bool 15 - select CEVT_SB1250 16 - select CSRC_SB1250 17 - select IRQ_MIPS_CPU 18 - select SIBYTE_BCM112X 19 - select SIBYTE_HAS_ZBUS_PROFILING 20 - select SIBYTE_SB1xxx_SOC 21 - 22 13 config SIBYTE_BCM1125 23 14 bool 24 15 select CEVT_SB1250 ··· 17 26 select HAVE_PCI 18 27 select IRQ_MIPS_CPU 19 28 select SIBYTE_BCM112X 20 - select SIBYTE_HAS_ZBUS_PROFILING 21 - select SIBYTE_SB1xxx_SOC 22 - 23 - config SIBYTE_BCM1125H 24 - bool 25 - select CEVT_SB1250 26 - select CSRC_SB1250 27 - select HAVE_PCI 28 - select IRQ_MIPS_CPU 29 - select SIBYTE_BCM112X 30 - select SIBYTE_ENABLE_LDT_IF_PCI 31 29 select SIBYTE_HAS_ZBUS_PROFILING 32 30 select SIBYTE_SB1xxx_SOC 33 31 ··· 36 56 select IRQ_MIPS_CPU 37 57 select SIBYTE_HAS_ZBUS_PROFILING 38 58 select SIBYTE_SB1xxx_SOC 39 - select SYS_SUPPORTS_SMP 40 - 41 - config SIBYTE_BCM1x55 42 - bool 43 - select CEVT_BCM1480 44 - select CSRC_BCM1480 45 - select HAVE_PCI 46 - select IRQ_MIPS_CPU 47 - select SIBYTE_SB1xxx_SOC 48 - select SIBYTE_HAS_ZBUS_PROFILING 49 59 select SYS_SUPPORTS_SMP 50 60 51 61 config SIBYTE_SB1xxx_SOC ··· 113 143 config SIBYTE_BUS_WATCHER 114 144 bool "Support for Bus Watcher statistics" 115 145 depends on SIBYTE_SB1xxx_SOC && \ 116 - (SIBYTE_BCM112X || SIBYTE_SB1250 || \ 117 - SIBYTE_BCM1x55 || SIBYTE_BCM1x80) 146 + (SIBYTE_BCM112X || SIBYTE_SB1250 || SIBYTE_BCM1x80) 118 147 help 119 148 Handle and keep statistics on the bus error interrupts (COR_ECC, 120 149 BAD_ECC, IO_BUS).
-6
arch/mips/sibyte/Makefile
··· 6 6 obj-$(CONFIG_SIBYTE_BCM112X) += common/ 7 7 obj-$(CONFIG_SIBYTE_SB1250) += sb1250/ 8 8 obj-$(CONFIG_SIBYTE_SB1250) += common/ 9 - obj-$(CONFIG_SIBYTE_BCM1x55) += bcm1480/ 10 - obj-$(CONFIG_SIBYTE_BCM1x55) += common/ 11 9 obj-$(CONFIG_SIBYTE_BCM1x80) += bcm1480/ 12 10 obj-$(CONFIG_SIBYTE_BCM1x80) += common/ 13 11 14 12 # 15 - # Sibyte BCM91120x (Carmel) board 16 - # Sibyte BCM91120C (CRhine) board 17 13 # Sibyte BCM91125C (CRhone) board 18 14 # Sibyte BCM91125E (Rhone) board 19 15 # Sibyte SWARM board 20 16 # Sibyte BCM91x80 (BigSur) board 21 17 # 22 - obj-$(CONFIG_SIBYTE_CARMEL) += swarm/ 23 - obj-$(CONFIG_SIBYTE_CRHINE) += swarm/ 24 18 obj-$(CONFIG_SIBYTE_CRHONE) += swarm/ 25 19 obj-$(CONFIG_SIBYTE_RHONE) += swarm/ 26 20 obj-$(CONFIG_SIBYTE_SENTOSA) += swarm/
-8
arch/mips/sibyte/Platform
··· 13 13 -I$(srctree)/arch/mips/include/asm/mach-sibyte \ 14 14 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL 15 15 16 - cflags-$(CONFIG_SIBYTE_BCM1x55) += \ 17 - -I$(srctree)/arch/mips/include/asm/mach-sibyte \ 18 - -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1480_ALL 19 - 20 16 cflags-$(CONFIG_SIBYTE_BCM1x80) += \ 21 17 -I$(srctree)/arch/mips/include/asm/mach-sibyte \ 22 18 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1480_ALL 23 19 24 20 # 25 - # Sibyte BCM91120x (Carmel) board 26 - # Sibyte BCM91120C (CRhine) board 27 21 # Sibyte BCM91125C (CRhone) board 28 22 # Sibyte BCM91125E (Rhone) board 29 23 # Sibyte BCM91250A (SWARM) board 30 24 # Sibyte BCM91250C2 (LittleSur) board 31 25 # Sibyte BCM91x80 (BigSur) board 32 26 # 33 - load-$(CONFIG_SIBYTE_CARMEL) := 0xffffffff80100000 34 - load-$(CONFIG_SIBYTE_CRHINE) := 0xffffffff80100000 35 27 load-$(CONFIG_SIBYTE_CRHONE) := 0xffffffff80100000 36 28 load-$(CONFIG_SIBYTE_RHONE) := 0xffffffff80100000 37 29 load-$(CONFIG_SIBYTE_SENTOSA) := 0xffffffff80100000
+2 -2
arch/mips/sibyte/common/bus_watcher.c
··· 24 24 #include <asm/sibyte/sb1250_regs.h> 25 25 #include <asm/sibyte/sb1250_int.h> 26 26 #include <asm/sibyte/sb1250_scd.h> 27 - #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 27 + #ifdef CONFIG_SIBYTE_BCM1x80 28 28 #include <asm/sibyte/bcm1480_regs.h> 29 29 #endif 30 30 ··· 71 71 #if defined(CONFIG_SIBYTE_BCM112X) || defined(CONFIG_SIBYTE_SB1250) 72 72 /* Use non-destructive register */ 73 73 status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS_DEBUG)); 74 - #elif defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 74 + #elif defined(CONFIG_SIBYTE_BCM1x80) 75 75 /* Use non-destructive register */ 76 76 /* Same as 1250 except BUS_ERR_STATUS_DEBUG is in a different place. */ 77 77 status = csr_in32(IOADDR(A_BCM1480_BUS_ERR_STATUS_DEBUG));
+1 -16
arch/mips/sibyte/common/cfe.c
··· 35 35 #endif 36 36 #endif 37 37 38 - #define SIBYTE_MAX_MEM_REGIONS 8 39 - phys_addr_t board_mem_region_addrs[SIBYTE_MAX_MEM_REGIONS]; 40 - phys_addr_t board_mem_region_sizes[SIBYTE_MAX_MEM_REGIONS]; 41 - unsigned int board_mem_region_count; 42 - 43 38 int cfe_cons_handle; 44 39 45 40 #ifdef CONFIG_BLK_DEV_INITRD ··· 135 140 if (size > 512) 136 141 size -= 512; 137 142 memblock_add(addr, size); 138 - } 139 - board_mem_region_addrs[board_mem_region_count] = addr; 140 - board_mem_region_sizes[board_mem_region_count] = size; 141 - board_mem_region_count++; 142 - if (board_mem_region_count == 143 - SIBYTE_MAX_MEM_REGIONS) { 144 - /* 145 - * Too many regions. Need to configure more 146 - */ 147 - while(1); 148 143 } 149 144 } 150 145 } ··· 295 310 #if defined(CONFIG_SIBYTE_BCM112X) || defined(CONFIG_SIBYTE_SB1250) 296 311 register_smp_ops(&sb_smp_ops); 297 312 #endif 298 - #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 313 + #ifdef CONFIG_SIBYTE_BCM1x80 299 314 register_smp_ops(&bcm1480_smp_ops); 300 315 #endif 301 316 }
+5 -5
arch/mips/sibyte/common/sb_tbprof.c
··· 23 23 #include <asm/io.h> 24 24 #include <asm/sibyte/sb1250.h> 25 25 26 - #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 26 + #ifdef CONFIG_SIBYTE_BCM1x80 27 27 #include <asm/sibyte/bcm1480_regs.h> 28 28 #include <asm/sibyte/bcm1480_scd.h> 29 29 #include <asm/sibyte/bcm1480_int.h> ··· 35 35 #error invalid SiByte UART configuration 36 36 #endif 37 37 38 - #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 38 + #ifdef CONFIG_SIBYTE_BCM1x80 39 39 #undef K_INT_TRACE_FREEZE 40 40 #define K_INT_TRACE_FREEZE K_BCM1480_INT_TRACE_FREEZE 41 41 #undef K_INT_PERF_CNT ··· 157 157 * a previous interrupt request. This means that bus profiling 158 158 * requires ALL of the SCD perf counters. 159 159 */ 160 - #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 160 + #ifdef CONFIG_SIBYTE_BCM1x80 161 161 __raw_writeq((scdperfcnt & ~M_SPC_CFG_SRC1) | 162 162 /* keep counters 0,2,3,4,5,6,7 as is */ 163 163 V_SPC_CFG_SRC1(1), /* counter 1 counts cycles */ ··· 290 290 * pass them through. I am exploiting my knowledge that 291 291 * cp0_status masks out IP[5]. krw 292 292 */ 293 - #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 293 + #ifdef CONFIG_SIBYTE_BCM1x80 294 294 __raw_writeq(K_BCM1480_INT_MAP_I3, 295 295 IOADDR(A_BCM1480_IMR_REGISTER(0, R_BCM1480_IMR_INTERRUPT_MAP_BASE_L) + 296 296 ((K_BCM1480_INT_PERF_CNT & 0x3f) << 3))); ··· 343 343 __raw_writeq(0, IOADDR(A_SCD_TRACE_SEQUENCE_7)); 344 344 345 345 /* Now indicate the PERF_CNT interrupt as a trace-relevant interrupt */ 346 - #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 346 + #ifdef CONFIG_SIBYTE_BCM1x80 347 347 __raw_writeq(1ULL << (K_BCM1480_INT_PERF_CNT & 0x3f), 348 348 IOADDR(A_BCM1480_IMR_REGISTER(0, R_BCM1480_IMR_INTERRUPT_TRACE_L))); 349 349 #else
+3 -9
arch/mips/sibyte/swarm/setup.c
··· 24 24 #include <asm/time.h> 25 25 #include <asm/traps.h> 26 26 #include <asm/sibyte/sb1250.h> 27 - #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 27 + #ifdef CONFIG_SIBYTE_BCM1x80 28 28 #include <asm/sibyte/bcm1480_regs.h> 29 29 #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) 30 30 #include <asm/sibyte/sb1250_regs.h> ··· 34 34 #include <asm/sibyte/sb1250_genbus.h> 35 35 #include <asm/sibyte/board.h> 36 36 37 - #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 37 + #ifdef CONFIG_SIBYTE_BCM1x80 38 38 extern void bcm1480_setup(void); 39 39 #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) 40 40 extern void sb1250_setup(void); ··· 114 114 115 115 void __init plat_mem_setup(void) 116 116 { 117 - #if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 117 + #ifdef CONFIG_SIBYTE_BCM1x80 118 118 bcm1480_setup(); 119 119 #elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X) 120 120 sb1250_setup(); ··· 145 145 } 146 146 147 147 #ifdef LEDS_PHYS 148 - 149 - #ifdef CONFIG_SIBYTE_CARMEL 150 - /* XXXKW need to detect Monterey/LittleSur/etc */ 151 - #undef LEDS_PHYS 152 - #define LEDS_PHYS MLEDS_PHYS 153 - #endif 154 148 155 149 void setleds(char *str) 156 150 {
-26
drivers/irqchip/irq-mips-gic.c
··· 54 54 static struct irq_domain *gic_irq_domain; 55 55 static int gic_shared_intrs; 56 56 static unsigned int gic_cpu_pin; 57 - static unsigned int timer_cpu_pin; 58 57 static struct irq_chip gic_level_irq_controller, gic_edge_irq_controller; 59 58 60 59 #ifdef CONFIG_GENERIC_IRQ_IPI ··· 498 499 */ 499 500 switch (intr) { 500 501 case GIC_LOCAL_INT_TIMER: 501 - /* CONFIG_MIPS_CMP workaround (see __gic_init) */ 502 - map = GIC_MAP_PIN_MAP_TO_PIN | timer_cpu_pin; 503 - fallthrough; 504 502 case GIC_LOCAL_INT_PERFCTR: 505 503 case GIC_LOCAL_INT_FDC: 506 504 /* ··· 791 795 if (cpu_has_veic) { 792 796 /* Always use vector 1 in EIC mode */ 793 797 gic_cpu_pin = 0; 794 - timer_cpu_pin = gic_cpu_pin; 795 798 set_vi_handler(gic_cpu_pin + GIC_PIN_TO_VEC_OFFSET, 796 799 __gic_irq_dispatch); 797 800 } else { 798 801 gic_cpu_pin = cpu_vec - GIC_CPU_PIN_OFFSET; 799 802 irq_set_chained_handler(MIPS_CPU_IRQ_BASE + cpu_vec, 800 803 gic_irq_dispatch); 801 - /* 802 - * With the CMP implementation of SMP (deprecated), other CPUs 803 - * are started by the bootloader and put into a timer based 804 - * waiting poll loop. We must not re-route those CPU's local 805 - * timer interrupts as the wait instruction will never finish, 806 - * so just handle whatever CPU interrupt it is routed to by 807 - * default. 808 - * 809 - * This workaround should be removed when CMP support is 810 - * dropped. 811 - */ 812 - if (IS_ENABLED(CONFIG_MIPS_CMP) && 813 - gic_local_irq_is_routable(GIC_LOCAL_INT_TIMER)) { 814 - timer_cpu_pin = read_gic_vl_timer_map() & GIC_MAP_PIN_MAP; 815 - irq_set_chained_handler(MIPS_CPU_IRQ_BASE + 816 - GIC_CPU_PIN_OFFSET + 817 - timer_cpu_pin, 818 - gic_irq_dispatch); 819 - } else { 820 - timer_cpu_pin = gic_cpu_pin; 821 - } 822 804 } 823 805 824 806 gic_irq_domain = irq_domain_add_simple(node, GIC_NUM_LOCAL_INTRS +