Commit 2981dcf3 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'mips_5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux

Pull MIPS updates from Paul Burton:
 "The main MIPS changes for 5.5:

   - Atomics-related code sees some rework & cleanup, most notably
     allowing Loongson LL/SC errata workarounds to be more bulletproof &
     their correctness to be checked at build time.

   - Command line setup code is simplified somewhat, resolving various
     corner cases.

   - MIPS kernels can now be built with kcov code coverage support.

   - We can now build with CONFIG_FORTIFY_SOURCE=y.

   - Miscellaneous cleanups.

  And some platform specific changes:

   - We now disable some broken TLB functionality on certain Ingenic
     systems, and JZ4780 systems gain some devicetree nodes to support
     more devices.

   - Loongson support sees a number of cleanups, and we gain initial
     support for Loongson 3A R4 systems.

   - We gain support for MediaTek MT7688-based GARDENA Smart Gateway
     systems.

   - SGI IP27 (Origin 2*) see a number of fixes, cleanups &
     simplifications.

   - SGI IP30 (Octane) systems are now supported"

* tag 'mips_5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (107 commits)
  MIPS: SGI-IP27: Enable ethernet phy on second Origin 200 module
  MIPS: PCI: Fix fake subdevice ID for IOC3
  MIPS: Ingenic: Disable abandoned HPTLB function.
  MIPS: PCI: remember nasid changed by set interrupt affinity
  MIPS: SGI-IP27: Fix crash, when CPUs are disabled via nr_cpus parameter
  mips: add support for folded p4d page tables
  mips: drop __pXd_offset() macros that duplicate pXd_index() ones
  mips: fix build when "48 bits virtual memory" is enabled
  MIPS: math-emu: Reuse name array in debugfs_fpuemu()
  MIPS: allow building with kcov coverage
  MIPS: Loongson64: Drop setup_pcimap
  MIPS: Loongson2ef: Convert to early_printk_8250
  MIPS: Drop CPU_SUPPORTS_UNCACHED_ACCELERATED
  MIPS: Loongson{2ef, 32, 64} convert to generic fw cmdline
  MIPS: Drop pmon.h
  MIPS: Loongson: Unify LOONGSON3/LOONGSON64 Kconfig usage
  MIPS: Loongson: Rename LOONGSON1 to LOONGSON32
  MIPS: Loongson: Fix return value of loongson_hwmon_init
  MIPS: add support for SGI Octane (IP30)
  MIPS: PCI: make phys_to_dma/dma_to_phys for pci-xtalk-bridge common
  ...
parents 5ef30d74 a8d0f11e
...@@ -16,3 +16,17 @@ value must be one of the following values: ...@@ -16,3 +16,17 @@ value must be one of the following values:
ralink,mt7620a-soc ralink,mt7620a-soc
ralink,mt7620n-soc ralink,mt7620n-soc
ralink,mt7628a-soc ralink,mt7628a-soc
ralink,mt7688a-soc
2. Boards
GARDENA smart Gateway (MT7688)
This board is based on the MediaTek MT7688 and equipped with 128 MiB
of DDR and 8 MiB of flash (SPI NOR) and additional 128MiB SPI NAND
storage.
------------------------------
Required root node properties:
- compatible = "gardena,smart-gateway-mt7688", "ralink,mt7688a-soc",
"ralink,mt7628a-soc";
...@@ -343,6 +343,8 @@ patternProperties: ...@@ -343,6 +343,8 @@ patternProperties:
description: Freescale Semiconductor description: Freescale Semiconductor
"^fujitsu,.*": "^fujitsu,.*":
description: Fujitsu Ltd. description: Fujitsu Ltd.
"^gardena,.*":
description: GARDENA GmbH
"^gateworks,.*": "^gateworks,.*":
description: Gateworks Corporation description: Gateworks Corporation
"^gcw,.*": "^gcw,.*":
......
...@@ -129,6 +129,8 @@ To facilitate such consumers NVMEM framework provides below apis:: ...@@ -129,6 +129,8 @@ To facilitate such consumers NVMEM framework provides below apis::
struct nvmem_device *nvmem_device_get(struct device *dev, const char *name); struct nvmem_device *nvmem_device_get(struct device *dev, const char *name);
struct nvmem_device *devm_nvmem_device_get(struct device *dev, struct nvmem_device *devm_nvmem_device_get(struct device *dev,
const char *name); const char *name);
struct nvmem_device *nvmem_device_find(void *data,
int (*match)(struct device *dev, const void *data));
void nvmem_device_put(struct nvmem_device *nvmem); void nvmem_device_put(struct nvmem_device *nvmem);
int nvmem_device_read(struct nvmem_device *nvmem, unsigned int offset, int nvmem_device_read(struct nvmem_device *nvmem, unsigned int offset,
size_t bytes, void *buf); size_t bytes, void *buf);
......
...@@ -10900,18 +10900,18 @@ F: arch/mips/include/asm/mach-loongson32/ ...@@ -10900,18 +10900,18 @@ F: arch/mips/include/asm/mach-loongson32/
F: drivers/*/*loongson1* F: drivers/*/*loongson1*
F: drivers/*/*/*loongson1* F: drivers/*/*/*loongson1*
MIPS/LOONGSON2 ARCHITECTURE MIPS/LOONGSON2EF ARCHITECTURE
M: Jiaxun Yang <jiaxun.yang@flygoat.com> M: Jiaxun Yang <jiaxun.yang@flygoat.com>
L: linux-mips@vger.kernel.org L: linux-mips@vger.kernel.org
S: Maintained S: Maintained
F: arch/mips/loongson64/fuloong-2e/ F: arch/mips/loongson2ef/
F: arch/mips/loongson64/lemote-2f/ F: arch/mips/include/asm/mach-loongson2ef/
F: arch/mips/include/asm/mach-loongson64/
F: drivers/*/*loongson2* F: drivers/*/*loongson2*
F: drivers/*/*/*loongson2* F: drivers/*/*/*loongson2*
MIPS/LOONGSON3 ARCHITECTURE MIPS/LOONGSON64 ARCHITECTURE
M: Huacai Chen <chenhc@lemote.com> M: Huacai Chen <chenhc@lemote.com>
M: Jiaxun Yang <jiaxun.yang@flygoat.com>
L: linux-mips@vger.kernel.org L: linux-mips@vger.kernel.org
S: Maintained S: Maintained
F: arch/mips/loongson64/ F: arch/mips/loongson64/
......
...@@ -17,6 +17,7 @@ platforms += jazz ...@@ -17,6 +17,7 @@ platforms += jazz
platforms += jz4740 platforms += jz4740
platforms += lantiq platforms += lantiq
platforms += lasat platforms += lasat
platforms += loongson2ef
platforms += loongson32 platforms += loongson32
platforms += loongson64 platforms += loongson64
platforms += mti-malta platforms += mti-malta
...@@ -30,6 +31,7 @@ platforms += ralink ...@@ -30,6 +31,7 @@ platforms += ralink
platforms += rb532 platforms += rb532
platforms += sgi-ip22 platforms += sgi-ip22
platforms += sgi-ip27 platforms += sgi-ip27
platforms += sgi-ip30
platforms += sgi-ip32 platforms += sgi-ip32
platforms += sibyte platforms += sibyte
platforms += sni platforms += sni
......
This diff is collapsed.
...@@ -32,7 +32,6 @@ config USE_GENERIC_EARLY_PRINTK_8250 ...@@ -32,7 +32,6 @@ config USE_GENERIC_EARLY_PRINTK_8250
config CMDLINE_BOOL config CMDLINE_BOOL
bool "Built-in kernel command line" bool "Built-in kernel command line"
default n
help help
For most systems, it is firmware or second stage bootloader that For most systems, it is firmware or second stage bootloader that
by default specifies the kernel command line options. However, by default specifies the kernel command line options. However,
...@@ -53,7 +52,6 @@ config CMDLINE_BOOL ...@@ -53,7 +52,6 @@ config CMDLINE_BOOL
config CMDLINE config CMDLINE
string "Default kernel command string" string "Default kernel command string"
depends on CMDLINE_BOOL depends on CMDLINE_BOOL
default ""
help help
On some platforms, there is currently no way for the boot loader to On some platforms, there is currently no way for the boot loader to
pass arguments to the kernel. For these platforms, and for the cases pass arguments to the kernel. For these platforms, and for the cases
...@@ -68,7 +66,6 @@ config CMDLINE ...@@ -68,7 +66,6 @@ config CMDLINE
config CMDLINE_OVERRIDE config CMDLINE_OVERRIDE
bool "Built-in command line overrides firmware arguments" bool "Built-in command line overrides firmware arguments"
default n
depends on CMDLINE_BOOL depends on CMDLINE_BOOL
help help
By setting this option to 'Y' you will have your kernel ignore By setting this option to 'Y' you will have your kernel ignore
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
archscripts: scripts_basic archscripts: scripts_basic
$(Q)$(MAKE) $(build)=arch/mips/tools elf-entry $(Q)$(MAKE) $(build)=arch/mips/tools elf-entry
ifeq ($(CONFIG_CPU_LOONGSON3_WORKAROUNDS),y)
$(Q)$(MAKE) $(build)=arch/mips/tools loongson3-llsc-check
endif
$(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs $(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs
KBUILD_DEFCONFIG := 32r2el_defconfig KBUILD_DEFCONFIG := 32r2el_defconfig
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
# Post-link MIPS pass # Post-link MIPS pass
# =========================================================================== # ===========================================================================
# #
# 1. Insert relocations into vmlinux # 1. Check that Loongson3 LL/SC workarounds are applied correctly
# 2. Insert relocations into vmlinux
PHONY := __archpost PHONY := __archpost
__archpost: __archpost:
...@@ -11,6 +12,10 @@ __archpost: ...@@ -11,6 +12,10 @@ __archpost:
-include include/config/auto.conf -include include/config/auto.conf
include scripts/Kbuild.include include scripts/Kbuild.include
CMD_LS3_LLSC = arch/mips/tools/loongson3-llsc-check
quiet_cmd_ls3_llsc = LLSCCHK $@
cmd_ls3_llsc = $(CMD_LS3_LLSC) $@
CMD_RELOCS = arch/mips/boot/tools/relocs CMD_RELOCS = arch/mips/boot/tools/relocs
quiet_cmd_relocs = RELOCS $@ quiet_cmd_relocs = RELOCS $@
cmd_relocs = $(CMD_RELOCS) $@ cmd_relocs = $(CMD_RELOCS) $@
...@@ -19,6 +24,9 @@ quiet_cmd_relocs = RELOCS $@ ...@@ -19,6 +24,9 @@ quiet_cmd_relocs = RELOCS $@
vmlinux: FORCE vmlinux: FORCE
@true @true
ifeq ($(CONFIG_CPU_LOONGSON3_WORKAROUNDS),y)
$(call if_changed,ls3_llsc)
endif
ifeq ($(CONFIG_RELOCATABLE),y) ifeq ($(CONFIG_RELOCATABLE),y)
$(call if_changed,relocs) $(call if_changed,relocs)
endif endif
......
...@@ -25,12 +25,47 @@ memory { ...@@ -25,12 +25,47 @@ memory {
0x30000000 0x30000000>; 0x30000000 0x30000000>;
}; };
leds {
compatible = "gpio-leds";
led0 {
label = "ci20:red:led0";
gpios = <&gpc 3 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "none";
};
led1 {
label = "ci20:red:led1";
gpios = <&gpc 2 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "nand-disk";
};
led2 {
label = "ci20:red:led2";
gpios = <&gpc 1 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "cpu1";
};
led3 {
label = "ci20:red:led3";
gpios = <&gpc 0 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "cpu0";
};
};
eth0_power: fixedregulator@0 { eth0_power: fixedregulator@0 {
compatible = "regulator-fixed"; compatible = "regulator-fixed";
regulator-name = "eth0_power"; regulator-name = "eth0_power";
gpio = <&gpb 25 GPIO_ACTIVE_LOW>; gpio = <&gpb 25 GPIO_ACTIVE_LOW>;
enable-active-high; enable-active-high;
}; };
wlan0_power: fixedregulator@1 {
compatible = "regulator-fixed";
regulator-name = "wlan0_power";
gpio = <&gpb 19 GPIO_ACTIVE_LOW>;
enable-active-high;
};
}; };
&ext { &ext {
...@@ -54,9 +89,18 @@ &mmc1 { ...@@ -54,9 +89,18 @@ &mmc1 {
bus-width = <4>; bus-width = <4>;
max-frequency = <50000000>; max-frequency = <50000000>;
non-removable;
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&pins_mmc1>; pinctrl-0 = <&pins_mmc1>;
brcmf: wifi@1 {
/* reg = <4>;*/
compatible = "brcm,bcm4330-fmac";
vcc-supply = <&wlan0_power>;
device-wakeup-gpios = <&gpd 9 GPIO_ACTIVE_HIGH>;
shutdown-gpios = <&gpf 7 GPIO_ACTIVE_LOW>;
};
}; };
&uart0 { &uart0 {
...@@ -73,6 +117,23 @@ &uart1 { ...@@ -73,6 +117,23 @@ &uart1 {
pinctrl-0 = <&pins_uart1>; pinctrl-0 = <&pins_uart1>;
}; };
&uart2 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pins_uart2>;
uart-has-rtscts;
bluetooth {
compatible = "brcm,bcm4330-bt";
reset-gpios = <&gpf 8 GPIO_ACTIVE_HIGH>;
vcc-supply = <&wlan0_power>;
device-wakeup-gpios = <&gpf 5 GPIO_ACTIVE_HIGH>;
host-wakeup-gpios = <&gpf 6 GPIO_ACTIVE_HIGH>;
shutdown-gpios = <&gpf 4 GPIO_ACTIVE_LOW>;
};
};
&uart3 { &uart3 {
status = "okay"; status = "okay";
...@@ -87,6 +148,123 @@ &uart4 { ...@@ -87,6 +148,123 @@ &uart4 {
pinctrl-0 = <&pins_uart4>; pinctrl-0 = <&pins_uart4>;
}; };
&i2c0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pins_i2c0>;
clock-frequency = <400000>;
act8600: act8600@5a {
compatible = "active-semi,act8600";
reg = <0x5a>;
status = "okay";
regulators {
vddcore: SUDCDC1 {
regulator-name = "VDDCORE";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1100000>;
regulator-always-on;
};
vddmem: SUDCDC2 {
regulator-name = "VDDMEM";
regulator-min-microvolt = <1500000>;
regulator-max-microvolt = <1500000>;
regulator-always-on;
};
vcc_33: SUDCDC3 {
regulator-name = "VCC33";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
vcc_50: SUDCDC4 {
regulator-name = "VCC50";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
};
vcc_25: LDO_REG5 {
regulator-name = "VCC25";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
regulator-always-on;
};
wifi_io: LDO_REG6 {
regulator-name = "WIFIIO";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
regulator-always-on;
};
vcc_28: LDO_REG7 {
regulator-name = "VCC28";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
regulator-always-on;
};
vcc_15: LDO_REG8 {
regulator-name = "VCC15";
regulator-min-microvolt = <1500000>;
regulator-max-microvolt = <1500000>;
regulator-always-on;
};
vcc_18: LDO_REG9 {
regulator-name = "VCC18";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
vcc_11: LDO_REG10 {
regulator-name = "VCC11";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1100000>;
regulator-always-on;
};
};
};
};
&i2c1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pins_i2c1>;
};
&i2c2 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pins_i2c2>;
};
&i2c3 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pins_i2c3>;
};
&i2c4 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pins_i2c4>;
clock-frequency = <400000>;
rtc@51 {
compatible = "nxp,pcf8563";
reg = <0x51>;
interrupts = <110>;
};
};
&nemc { &nemc {
status = "okay"; status = "okay";
...@@ -197,6 +375,12 @@ pins_uart1: uart1 { ...@@ -197,6 +375,12 @@ pins_uart1: uart1 {
bias-disable; bias-disable;
}; };
pins_uart2: uart2 {
function = "uart2";
groups = "uart2-data", "uart2-hwflow";
bias-disable;
};
pins_uart3: uart3 { pins_uart3: uart3 {
function = "uart3"; function = "uart3";
groups = "uart3-data", "uart3-hwflow"; groups = "uart3-data", "uart3-hwflow";
...@@ -209,6 +393,36 @@ pins_uart4: uart4 { ...@@ -209,6 +393,36 @@ pins_uart4: uart4 {
bias-disable; bias-disable;
}; };
pins_i2c0: i2c0 {
function = "i2c0";
groups = "i2c0-data";
bias-disable;
};
pins_i2c1: i2c1 {
function = "i2c1";
groups = "i2c1-data";
bias-disable;
};
pins_i2c2: i2c2 {
function = "i2c2";
groups = "i2c2-data";
bias-disable;
};
pins_i2c3: i2c3 {
function = "i2c3";
groups = "i2c3-data";
bias-disable;
};
pins_i2c4: i2c4 {
function = "i2c4";
groups = "i2c4-data-e";
bias-disable;
};
pins_nemc: nemc { pins_nemc: nemc {
function = "nemc"; function = "nemc";
groups = "nemc-data", "nemc-cle-ale", "nemc-rd-we", "nemc-frd-fwe"; groups = "nemc-data", "nemc-cle-ale", "nemc-rd-we", "nemc-frd-fwe";
......
...@@ -262,6 +262,92 @@ uart4: serial@10034000 { ...@@ -262,6 +262,92 @@ uart4: serial@10034000 {
status = "disabled"; status = "disabled";
}; };
i2c0: i2c@10050000 {
compatible = "ingenic,jz4780-i2c";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10050000 0x1000>;
interrupt-parent = <&intc>;
interrupts = <60>;
clocks = <&cgu JZ4780_CLK_SMB0>;
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pins_i2c0_data>;
status = "disabled";
};
i2c1: i2c@10051000 {
compatible = "ingenic,jz4780-i2c";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10051000 0x1000>;
interrupt-parent = <&intc>;
interrupts = <59>;
clocks = <&cgu JZ4780_CLK_SMB1>;
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pins_i2c1_data>;
status = "disabled";
};
i2c2: i2c@10052000 {
compatible = "ingenic,jz4780-i2c";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10052000 0x1000>;
interrupt-parent = <&intc>;
interrupts = <58>;
clocks = <&cgu JZ4780_CLK_SMB2>;
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pins_i2c2_data>;
status = "disabled";
};
i2c3: i2c@10053000 {
compatible = "ingenic,jz4780-i2c";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10053000 0x1000>;
interrupt-parent = <&intc>;
interrupts = <57>;
clocks = <&cgu JZ4780_CLK_SMB3>;
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pins_i2c3_data>;
status = "disabled";
};
i2c4: i2c@10054000 {
compatible = "ingenic,jz4780-i2c";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x10054000 0x1000>;
interrupt-parent = <&intc>;
interrupts = <56>;
clocks = <&cgu JZ4780_CLK_SMB4>;
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pins_i2c4_data>;
status = "disabled";
};
watchdog: watchdog@10002000 { watchdog: watchdog@10002000 {
compatible = "ingenic,jz4780-watchdog"; compatible = "ingenic,jz4780-watchdog";
reg = <0x10002000 0x10>; reg = <0x10002000 0x10>;
......
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2019 Stefan Roese <sr@denx.de>
*/
/dts-v1/;
/include/ "mt7628a.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "gardena,smart-gateway-mt7688", "ralink,mt7688a-soc",
"ralink,mt7628a-soc";
model = "GARDENA smart Gateway (MT7688)";
memory@0 {
device_type = "memory";
reg = <0x0 0x8000000>;
};
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&pinmux_gpio_gpio>; /* GPIO11 */
user_btn1 {
label = "USER_BTN1";
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
linux,code =<KEY_PROG1> ;
};
};
leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&pinmux_pwm0_gpio>, /* GPIO18 */
<&pinmux_pwm1_gpio>, /* GPIO19 */
<&pinmux_sdmode_gpio>, /* GPIO22..29 */
<&pinmux_p0led_an_gpio>; /* GPIO43 */
/*
* <&pinmux_i2s_gpio> (covers GPIO0..3) is needed here as
* well for GPIO3. But this is already claimed for uart1
* (see below). So we can't include it in this LED node.
*/
power_blue {
label = "smartgw:power:blue";
gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
power_green {
label = "smartgw:power:green";
gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
power_red {
label = "smartgw:power:red";
gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
radio_blue {
label = "smartgw:radio:blue";
gpios = <&gpio 23 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
radio_green {
label = "smartgw:radio:green";
gpios = <&gpio 24 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
radio_red {
label = "smartgw:radio:red";
gpios = <&gpio 25 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
internet_blue {
label = "smartgw:internet:blue";
gpios = <&gpio 26 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
internet_green {
label = "smartgw:internet:green";
gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
internet_red {
label = "smartgw:internet:red";
gpios = <&gpio 28 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
ethernet_link {
label = "smartgw:eth:link";
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
linux,default-trigger = "netdev";
};
ethernet_activity {
label = "smartgw:eth:act";
gpios = <&gpio 43 GPIO_ACTIVE_LOW>;
linux,default-trigger = "netdev";
};
};
aliases {
serial0 = &uart0;
};
};
&i2c {
status = "okay";
};
&spi {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinmux_spi_spi>, <&pinmux_spi_cs1_cs>;
m25p80@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <40000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "uboot";
reg = <0x0 0xa0000>;
read-only;
};
partition@a0000 {
label = "uboot_env0";
reg = <0xa0000 0x10000>;
};
partition@b0000 {
label = "uboot_env1";
reg = <0xb0000 0x10000>;
};
factory: partition@c0000 {
label = "factory";
reg = <0xc0000 0x10000>;
read-only;
};
};
};
nand_flash@1 {
compatible = "spi-nand";
linux,mtd-name = "gd5f";
reg = <1>;
spi-max-frequency = <40000000>;
};
};
&uart1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinmux_i2s_gpio>; /* GPIO0..3 */
rts-gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
cts-gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
};
&uart2 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&pinmux_p2led_an_gpio>, /* GPIO41 */
<&pinmux_p3led_an_gpio>; /* GPIO40 */
rts-gpios = <&gpio 40 GPIO_ACTIVE_LOW>;
cts-gpios = <&gpio 41 GPIO_ACTIVE_LOW>;
};
&watchdog {
status = "okay";
};
...@@ -199,6 +199,22 @@ spi: spi@b00 { ...@@ -199,6 +199,22 @@ spi: spi@b00 {
status = "disabled"; status = "disabled";
}; };
i2c: i2c@900 {
compatible = "mediatek,mt7621-i2c";
reg = <0x900 0x100>;
pinctrl-names = "default";
pinctrl-0 = <&pinmux_i2c_i2c>;
resets = <&resetc 16>;
reset-names = "i2c";
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
uart0: uartlite@c00 { uart0: uartlite@c00 {
compatible = "ns16550a"; compatible = "ns16550a";
reg = <0xc00 0x100>; reg = <0xc00 0x100>;
......
...@@ -844,7 +844,7 @@ void __init prom_init(void) ...@@ -844,7 +844,7 @@ void __init prom_init(void)
* BIST should always be enabled when doing a soft reset. L2 * BIST should always be enabled when doing a soft reset. L2
* Cache locking for instance is not cleared unless BIST is * Cache locking for instance is not cleared unless BIST is
* enabled. Unfortunately due to a chip errata G-200 for * enabled. Unfortunately due to a chip errata G-200 for
* Cn38XX and CN31XX, BIST msut be disabled on these parts. * Cn38XX and CN31XX, BIST must be disabled on these parts.
*/ */
if (OCTEON_IS_MODEL(OCTEON_CN38XX_PASS2) || if (OCTEON_IS_MODEL(OCTEON_CN38XX_PASS2) ||
OCTEON_IS_MODEL(OCTEON_CN31XX)) OCTEON_IS_MODEL(OCTEON_CN31XX))
......
...@@ -15,7 +15,7 @@ CONFIG_EXPERT=y ...@@ -15,7 +15,7 @@ CONFIG_EXPERT=y
# CONFIG_COMPAT_BRK is not set # CONFIG_COMPAT_BRK is not set
CONFIG_SLAB=y CONFIG_SLAB=y
CONFIG_PROFILING=y CONFIG_PROFILING=y
CONFIG_MACH_LOONGSON64=y CONFIG_MACH_LOONGSON2EF=y
CONFIG_PCI=y CONFIG_PCI=y
CONFIG_MIPS32_O32=y CONFIG_MIPS32_O32=y
CONFIG_MIPS32_N32=y CONFIG_MIPS32_N32=y
......
...@@ -12,7 +12,7 @@ CONFIG_LOG_BUF_SHIFT=15 ...@@ -12,7 +12,7 @@ CONFIG_LOG_BUF_SHIFT=15
CONFIG_BLK_DEV_INITRD=y CONFIG_BLK_DEV_INITRD=y
CONFIG_EXPERT=y CONFIG_EXPERT=y
CONFIG_PROFILING=y CONFIG_PROFILING=y
CONFIG_MACH_LOONGSON64=y CONFIG_MACH_LOONGSON2EF=y
CONFIG_LEMOTE_MACH2F=y CONFIG_LEMOTE_MACH2F=y
CONFIG_KEXEC=y CONFIG_KEXEC=y
# CONFIG_SECCOMP is not set # CONFIG_SECCOMP is not set
......
...@@ -12,7 +12,6 @@ CONFIG_TASKSTATS=y ...@@ -12,7 +12,6 @@ CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_MEMCG=y CONFIG_MEMCG=y
CONFIG_MEMCG_SWAP=y CONFIG_MEMCG_SWAP=y
CONFIG_BLK_CGROUP=y CONFIG_BLK_CGROUP=y
...@@ -24,7 +23,6 @@ CONFIG_BLK_DEV_INITRD=y ...@@ -24,7 +23,6 @@ CONFIG_BLK_DEV_INITRD=y
CONFIG_SYSCTL_SYSCALL=y CONFIG_SYSCTL_SYSCALL=y
CONFIG_EMBEDDED=y CONFIG_EMBEDDED=y
CONFIG_MACH_LOONGSON64=y CONFIG_MACH_LOONGSON64=y
CONFIG_LOONGSON_MACH3X=y
CONFIG_SMP=y CONFIG_SMP=y
CONFIG_HZ_256=y CONFIG_HZ_256=y
CONFIG_KEXEC=y CONFIG_KEXEC=y
......
...@@ -3,8 +3,12 @@ ...@@ -3,8 +3,12 @@
# Makefile for the ARC prom monitor library routines under Linux. # Makefile for the ARC prom monitor library routines under Linux.
# #
ifdef CONFIG_ARC_CMDLINE_ONLY
lib-y += cmdline.o
else
lib-y += cmdline.o env.o file.o identify.o init.o \ lib-y += cmdline.o env.o file.o identify.o init.o \
misc.o salone.o time.o tree.o misc.o
endif
lib-$(CONFIG_ARC_MEMORY) += memory.o lib-$(CONFIG_ARC_MEMORY) += memory.o
lib-$(CONFIG_ARC_CONSOLE) += arc_con.o lib-$(CONFIG_ARC_CONSOLE) += arc_con.o
......
...@@ -17,6 +17,12 @@ ...@@ -17,6 +17,12 @@
#undef DEBUG_CMDLINE #undef DEBUG_CMDLINE
/*
* A 32-bit ARC PROM pass arguments and environment as 32-bit pointer.
* These macro take care of sign extension.
*/
#define prom_argv(index) ((char *) (long)argv[(index)])
static char *ignored[] = { static char *ignored[] = {
"ConsoleIn=", "ConsoleIn=",
"ConsoleOut=", "ConsoleOut=",
...@@ -32,14 +38,14 @@ static char *used_arc[][2] = { ...@@ -32,14 +38,14 @@ static char *used_arc[][2] = {
{ "OSLoadOptions=", "" } { "OSLoadOptions=", "" }
}; };
static char * __init move_firmware_args(char* cp) static char __init *move_firmware_args(int argc, LONG *argv, char *cp)
{ {
char *s; char *s;
int actr, i; int actr, i;
actr = 1; /* Always ignore argv[0] */ actr = 1; /* Always ignore argv[0] */
while (actr < prom_argc) { while (actr < argc) {
for(i = 0; i < ARRAY_SIZE(used_arc); i++) { for(i = 0; i < ARRAY_SIZE(used_arc); i++) {
int len = strlen(used_arc[i][0]); int len = strlen(used_arc[i][0]);
...@@ -64,7 +70,7 @@ static char * __init move_firmware_args(char* cp) ...@@ -64,7 +70,7 @@ static char * __init move_firmware_args(char* cp)
return cp; return cp;
} }
void __init prom_init_cmdline(void) void __init prom_init_cmdline(int argc, LONG *argv)
{ {
char *cp; char *cp;
int actr, i; int actr, i;
...@@ -76,9 +82,9 @@ void __init prom_init_cmdline(void) ...@@ -76,9 +82,9 @@ void __init prom_init_cmdline(void)
* Move ARC variables to the beginning to make sure they can be * Move ARC variables to the beginning to make sure they can be
* overridden by later arguments. * overridden by later arguments.
*/ */
cp = move_firmware_args(cp); cp = move_firmware_args(argc, argv, cp);
while (actr < prom_argc) { while (actr < argc) {
for (i = 0; i < ARRAY_SIZE(ignored); i++) { for (i = 0; i < ARRAY_SIZE(ignored); i++) {
int len = strlen(ignored[i]); int len = strlen(ignored[i]);
......
...@@ -19,9 +19,3 @@ ArcGetEnvironmentVariable(CHAR *name) ...@@ -19,9 +19,3 @@ ArcGetEnvironmentVariable(CHAR *name)
{ {
return (CHAR *) ARC_CALL1(get_evar, name); return (CHAR *) ARC_CALL1(get_evar, name);
} }
LONG __init
ArcSetEnvironmentVariable(PCHAR name, PCHAR value)
{
return ARC_CALL2(set_evar, name, value);
}
...@@ -12,63 +12,14 @@ ...@@ -12,63 +12,14 @@
#include <asm/fw/arc/types.h> #include <asm/fw/arc/types.h>
#include <asm/sgialib.h> #include <asm/sgialib.h>
LONG
ArcGetDirectoryEntry(ULONG FileID, struct linux_vdirent *Buffer,
ULONG N, ULONG *Count)
{
return ARC_CALL4(get_vdirent, FileID, Buffer, N, Count);
}
LONG
ArcOpen(CHAR *Path, enum linux_omode OpenMode, ULONG *FileID)
{
return ARC_CALL3(open, Path, OpenMode, FileID);
}
LONG
ArcClose(ULONG FileID)
{
return ARC_CALL1(close, FileID);
}
LONG LONG
ArcRead(ULONG FileID, VOID *Buffer, ULONG N, ULONG *Count) ArcRead(ULONG FileID, VOID *Buffer, ULONG N, ULONG *Count)
{ {
return ARC_CALL4(read, FileID, Buffer, N, Count); return ARC_CALL4(read, FileID, Buffer, N, Count);
} }
LONG
ArcGetReadStatus(ULONG FileID)
{
return ARC_CALL1(get_rstatus, FileID);
}
LONG LONG
ArcWrite(ULONG FileID, PVOID Buffer, ULONG N, PULONG Count) ArcWrite(ULONG FileID, PVOID Buffer, ULONG N, PULONG Count)
{ {
return ARC_CALL4(write, FileID, Buffer, N, Count); return ARC_CALL4(write, FileID, Buffer, N, Count);
} }
LONG
ArcSeek(ULONG FileID, struct linux_bigint *Position, enum linux_seekmode SeekMode)
{
return ARC_CALL3(seek, FileID, Position, SeekMode);
}
LONG
ArcMount(char *name, enum linux_mountops op)
{
return ARC_CALL2(mount, name, op);
}
LONG
ArcGetFileInformation(ULONG FileID, struct linux_finfo *Information)
{
return ARC_CALL2(get_finfo, FileID, Information);
}
LONG ArcSetFileInformation(ULONG FileID, ULONG AttributeFlags,
ULONG AttributeMask)
{
return ARC_CALL3(set_finfo, FileID, AttributeFlags, AttributeMask);
}
...@@ -31,10 +31,6 @@ static struct smatch mach_table[] = { ...@@ -31,10 +31,6 @@ static struct smatch mach_table[] = {
.arcname = "SGI-IP22", .arcname = "SGI-IP22",
.liname = "SGI Indy", .liname = "SGI Indy",
.flags = PROM_FLAG_ARCS, .flags = PROM_FLAG_ARCS,
}, {
.arcname = "SGI-IP27",
.liname = "SGI Origin",
.flags = PROM_FLAG_ARCS,
}, { }, {
.arcname = "SGI-IP28", .arcname = "SGI-IP28",
.liname = "SGI IP28", .liname = "SGI IP28",
...@@ -87,6 +83,11 @@ const char *get_system_type(void) ...@@ -87,6 +83,11 @@ const char *get_system_type(void)
return system_type; return system_type;
} }
static pcomponent * __init ArcGetChild(pcomponent *Current)
{
return (pcomponent *) ARC_CALL1(child_component, Current);
}
void __init prom_identify_arch(void) void __init prom_identify_arch(void)
{ {
pcomponent *p; pcomponent *p;
...@@ -98,13 +99,7 @@ void __init prom_identify_arch(void) ...@@ -98,13 +99,7 @@ void __init prom_identify_arch(void)
*/ */
p = ArcGetChild(PROM_NULL_COMPONENT); p = ArcGetChild(PROM_NULL_COMPONENT);
if (p == NULL) { if (p == NULL) {
#ifdef CONFIG_SGI_IP27
/* IP27 PROM misbehaves, seems to not implement ARC
GetChild(). So we just assume it's an IP27. */
iname = "SGI-IP27";
#else
iname = "Unknown"; iname = "Unknown";
#endif
} else } else
iname = (char *) (long) p->iname; iname = (char *) (long) p->iname;
......
...@@ -18,8 +18,11 @@ ...@@ -18,8 +18,11 @@
/* Master romvec interface. */ /* Master romvec interface. */
struct linux_romvec *romvec; struct linux_romvec *romvec;
int prom_argc;
LONG *_prom_argv, *_prom_envp; #if defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32)
/* stack for calling 32bit ARC prom */
u64 o32_stk[4096];
#endif
void __init prom_init(void) void __init prom_init(void)
{ {
...@@ -27,10 +30,6 @@ void __init prom_init(void) ...@@ -27,10 +30,6 @@ void __init prom_init(void)
romvec = ROMVECTOR; romvec = ROMVECTOR;
prom_argc = fw_arg0;
_prom_argv = (LONG *) fw_arg1;
_prom_envp = (LONG *) fw_arg2;
if (pb->magic != 0x53435241) { if (pb->magic != 0x53435241) {
printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n", printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n",
(unsigned long) pb->magic); (unsigned long) pb->magic);
...@@ -38,7 +37,7 @@ void __init prom_init(void) ...@@ -38,7 +37,7 @@ void __init prom_init(void)
; ;
} }
prom_init_cmdline(); prom_init_cmdline(fw_arg0, (LONG *)fw_arg1);
prom_identify_arch(); prom_identify_arch();
printk(KERN_INFO "PROMLIB: ARC firmware Version %d Revision %d\n", printk(KERN_INFO "PROMLIB: ARC firmware Version %d Revision %d\n",
pb->ver, pb->rev); pb->ver, pb->rev);
...@@ -49,11 +48,4 @@ void __init prom_init(void) ...@@ -49,11 +48,4 @@ void __init prom_init(void)
ArcRead(0, &c, 1, &cnt); ArcRead(0, &c, 1, &cnt);
ArcEnterInteractiveMode(); ArcEnterInteractiveMode();
#endif #endif
#ifdef CONFIG_SGI_IP27
{
extern const struct plat_smp_ops ip27_smp_ops;
register_smp_ops(&ip27_smp_ops);
}
#endif
} }
...@@ -158,6 +158,10 @@ void __init prom_meminit(void) ...@@ -158,6 +158,10 @@ void __init prom_meminit(void)
} }
} }
void __weak __init prom_cleanup(void)
{
}
void __init prom_free_prom_memory(void) void __init prom_free_prom_memory(void)
{ {
int i; int i;
...@@ -169,4 +173,9 @@ void __init prom_free_prom_memory(void) ...@@ -169,4 +173,9 @@ void __init prom_free_prom_memory(void)
free_init_pages("prom memory", free_init_pages("prom memory",
prom_mem_base[i], prom_mem_base[i] + prom_mem_size[i]); prom_mem_base[i], prom_mem_base[i] + prom_mem_size[i]);
} }
/*
* at this point it isn't safe to call PROM functions
* give platforms a way to do PROM cleanups
*/
prom_cleanup();
} }
...@@ -20,47 +20,6 @@ ...@@ -20,47 +20,6 @@
#include <asm/sgialib.h> #include <asm/sgialib.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
VOID __noreturn
ArcHalt(VOID)
{
bc_disable();
local_irq_disable();
ARC_CALL0(halt);
unreachable();
}
VOID __noreturn
ArcPowerDown(VOID)
{
bc_disable();
local_irq_disable();
ARC_CALL0(pdown);
unreachable();
}
/* XXX is this a soft reset basically? XXX */
VOID __noreturn
ArcRestart(VOID)
{
bc_disable();
local_irq_disable();
ARC_CALL0(restart);
unreachable();
}
VOID __noreturn
ArcReboot(VOID)
{
bc_disable();
local_irq_disable();
ARC_CALL0(reboot);
unreachable();
}
VOID __noreturn VOID __noreturn
ArcEnterInteractiveMode(VOID) ArcEnterInteractiveMode(VOID)
{ {
...@@ -71,24 +30,6 @@ ArcEnterInteractiveMode(VOID) ...@@ -71,24 +30,6 @@ ArcEnterInteractiveMode(VOID)
unreachable(); unreachable();
} }
LONG
ArcSaveConfiguration(VOID)
{
return ARC_CALL0(cfg_save);
}
struct linux_sysid *
ArcGetSystemId(VOID)
{
return (struct linux_sysid *) ARC_CALL0(get_sysid);
}
VOID __init
ArcFlushAllCaches(VOID)
{
ARC_CALL0(cache_flush);
}
DISPLAY_STATUS * __init ArcGetDisplayStatus(ULONG FileID) DISPLAY_STATUS * __init ArcGetDisplayStatus(ULONG FileID)
{ {
return (DISPLAY_STATUS *) ARC_CALL1(GetDisplayStatus, FileID); return (DISPLAY_STATUS *) ARC_CALL1(GetDisplayStatus, FileID);
......
...@@ -11,6 +11,21 @@ ...@@ -11,6 +11,21 @@
#include <asm/bcache.h> #include <asm/bcache.h>
#include <asm/setup.h> #include <asm/setup.h>
#if defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32)
/*
* For 64bit kernels working with a 32bit ARC PROM pointer arguments
* for ARC calls need to reside in CKEG0/1. But as soon as the kernel
* switches to it's first kernel thread stack is set to an address in
* XKPHYS, so anything on stack can't be used anymore. This is solved
* by using a * static declartion variables are put into BSS, which is
* linked to a CKSEG0 address. Since this is only used on UP platforms
* there is not spinlock needed
*/
#define O32_STATIC static
#else
#define O32_STATIC
#endif
/* /*
* IP22 boardcache is not compatible with board caches. Thus we disable it * IP22 boardcache is not compatible with board caches. Thus we disable it
* during romvec action. Since r4xx0.c is always compiled and linked with your * during romvec action. Since r4xx0.c is always compiled and linked with your
...@@ -23,8 +38,10 @@ ...@@ -23,8 +38,10 @@
void prom_putchar(char c) void prom_putchar(char c)
{ {
ULONG cnt; O32_STATIC ULONG cnt;
CHAR it = c; O32_STATIC CHAR it;
it = c;
bc_disable(); bc_disable();
ArcWrite(1, &it, 1, &cnt); ArcWrite(1, &it, 1, &cnt);
...@@ -33,8 +50,8 @@ void prom_putchar(char c) ...@@ -33,8 +50,8 @@ void prom_putchar(char c)
char prom_getchar(void) char prom_getchar(void)
{ {
ULONG cnt; O32_STATIC ULONG cnt;
CHAR c; O32_STATIC CHAR c;
bc_disable(); bc_disable();
ArcRead(0, &c, 1, &cnt); ArcRead(0, &c, 1, &cnt);
......
// SPDX-License-Identifier: GPL-2.0
/*
* Routines to load into memory and execute stand-along program images using
* ARCS PROM firmware.
*
* Copyright (C) 1996 David S. Miller (davem@davemloft.net)
*/
#include <linux/init.h>
#include <asm/sgialib.h>
LONG __init ArcLoad(CHAR *Path, ULONG TopAddr, ULONG *ExecAddr, ULONG *LowAddr)
{
return ARC_CALL4(load, Path, TopAddr, ExecAddr, LowAddr);
}
LONG __init ArcInvoke(ULONG ExecAddr, ULONG StackAddr, ULONG Argc, CHAR *Argv[],
CHAR *Envp[])
{
return ARC_CALL5(invoke, ExecAddr, StackAddr, Argc, Argv, Envp);
}
LONG __init ArcExecute(CHAR *Path, LONG Argc, CHAR *Argv[], CHAR *Envp[])
{
return ARC_CALL4(exec, Path, Argc, Argv, Envp);
}
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Extracting time information from ARCS prom.
*
* Copyright (C) 1996 David S. Miller (davem@davemloft.net)
*/
#include <linux/init.h>
#include <asm/fw/arc/types.h>
#include <asm/sgialib.h>
struct linux_tinfo * __init
ArcGetTime(VOID)
{
return (struct linux_tinfo *) ARC_CALL0(get_tinfo);
}
ULONG __init
ArcGetRelativeTime(VOID)
{
return ARC_CALL0(get_rtime);
}
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* PROM component device tree code.
*
* Copyright (C) 1996 David S. Miller (davem@davemloft.net)
* Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
* Copyright (C) 1999 Silicon Graphics, Inc.
*/
#include <linux/init.h>
#include <asm/fw/arc/types.h>
#include <asm/sgialib.h>
#undef DEBUG_PROM_TREE
pcomponent * __init
ArcGetPeer(pcomponent *Current)
{
if (Current == PROM_NULL_COMPONENT)
return PROM_NULL_COMPONENT;
return (pcomponent *) ARC_CALL1(next_component, Current);
}
pcomponent * __init
ArcGetChild(pcomponent *Current)
{
return (pcomponent *) ARC_CALL1(child_component, Current);
}
pcomponent * __init
ArcGetParent(pcomponent *Current)
{
if (Current == PROM_NULL_COMPONENT)
return PROM_NULL_COMPONENT;
return (pcomponent *) ARC_CALL1(parent_component, Current);
}
LONG __init
ArcGetConfigurationData(VOID *Buffer, pcomponent *Current)
{
return ARC_CALL2(component_data, Buffer, Current);
}
pcomponent * __init
ArcAddChild(pcomponent *Current, pcomponent *Template, VOID *ConfigurationData)
{
return (pcomponent *)
ARC_CALL3(child_add, Current, Template, ConfigurationData);
}
LONG __init
ArcDeleteComponent(pcomponent *ComponentToDelete)
{
return ARC_CALL1(comp_del, ComponentToDelete);
}
pcomponent * __init
ArcGetComponent(CHAR *Path)
{
return (pcomponent *)ARC_CALL1(component_by_path, Path);
}
#ifdef DEBUG_PROM_TREE
static char *classes[] = {
"system", "processor", "cache", "adapter", "controller", "peripheral",
"memory"
};
static char *types[] = {
"arc", "cpu", "fpu", "picache", "pdcache", "sicache", "sdcache",
"sccache", "memdev", "eisa adapter", "tc adapter", "scsi adapter",
"dti adapter", "multi-func adapter", "disk controller",
"tp controller", "cdrom controller", "worm controller",
"serial controller", "net controller", "display controller",
"parallel controller", "pointer controller", "keyboard controller",
"audio controller", "misc controller", "disk peripheral",
"floppy peripheral", "tp peripheral", "modem peripheral",
"monitor peripheral", "printer peripheral", "pointer peripheral",
"keyboard peripheral", "terminal peripheral", "line peripheral",
"net peripheral", "misc peripheral", "anonymous"
};
static char *iflags[] = {
"bogus", "read only", "removable", "console in", "console out",
"input", "output"
};
static void __init
dump_component(pcomponent *p)
{
printk("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
p, classes[p->class], types[p->type],
iflags[p->iflags], p->vers, p->rev);
printk("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",
p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
}
static void __init
traverse(pcomponent *p, int op)
{
dump_component(p);
if(ArcGetChild(p))
traverse(ArcGetChild(p), 1);
if(ArcGetPeer(p) && op)
traverse(ArcGetPeer(p), 1);
}
void __init
prom_testtree(void)
{
pcomponent *p;
p = ArcGetChild(PROM_NULL_COMPONENT);
dump_component(p);
p = ArcGetChild(p);
while(p) {
dump_component(p);
p = ArcGetPeer(p);
}
}
#endif /* DEBUG_PROM_TREE */
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
#include <asm/smp-ops.h> #include <asm/smp-ops.h>
#include <asm/time.h> #include <asm/time.h>
static __initdata const void *fdt; static __initconst const void *fdt;
static __initdata const struct mips_machine *mach; static __initconst const struct mips_machine *mach;
static __initdata const void *mach_match_data; static __initconst const void *mach_match_data;
void __init prom_init(void) void __init prom_init(void)
{ {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
/* /*
* Valid machtype for Loongson family * Valid machtype for Loongson family
*/ */
enum loongson_machine_type { enum loongson2ef_machine_type {
MACH_LOONGSON_UNKNOWN, MACH_LOONGSON_UNKNOWN,
MACH_LEMOTE_FL2E, MACH_LEMOTE_FL2E,
MACH_LEMOTE_FL2F, MACH_LEMOTE_FL2F,
...@@ -70,7 +70,6 @@ enum loongson_machine_type { ...@@ -70,7 +70,6 @@ enum loongson_machine_type {
MACH_DEXXON_GDIUM2F10, MACH_DEXXON_GDIUM2F10,
MACH_LEMOTE_NAS, MACH_LEMOTE_NAS,
MACH_LEMOTE_LL2F, MACH_LEMOTE_LL2F,
MACH_LOONGSON_GENERIC,
MACH_LOONGSON_END MACH_LOONGSON_END
}; };
...@@ -99,6 +98,7 @@ extern void detect_memory_region(phys_addr_t start, phys_addr_t sz_min, phys_ad ...@@ -99,6 +98,7 @@ extern void detect_memory_region(phys_addr_t start, phys_addr_t sz_min, phys_ad
extern void prom_init(void); extern void prom_init(void);
extern void prom_free_prom_memory(void); extern void prom_free_prom_memory(void);
extern void prom_cleanup(void);
extern void free_init_pages(const char *what, extern void free_init_pages(const char *what,
unsigned long begin, unsigned long end); unsigned long begin, unsigned long end);
......
...@@ -26,9 +26,8 @@ extern void check_bugs64(void); ...@@ -26,9 +26,8 @@ extern void check_bugs64(void);
static inline void check_bugs_early(void) static inline void check_bugs_early(void)
{ {
#ifdef CONFIG_64BIT if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
check_bugs64_early(); check_bugs64_early();
#endif
} }
static inline void check_bugs(void) static inline void check_bugs(void)
...@@ -37,19 +36,18 @@ static inline void check_bugs(void) ...@@ -37,19 +36,18 @@ static inline void check_bugs(void)
cpu_data[cpu].udelay_val = loops_per_jiffy; cpu_data[cpu].udelay_val = loops_per_jiffy;
check_bugs32(); check_bugs32();
#ifdef CONFIG_64BIT
check_bugs64(); if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
#endif check_bugs64();
} }
static inline int r4k_daddiu_bug(void) static inline int r4k_daddiu_bug(void)
{ {
#ifdef CONFIG_64BIT if (!IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
return 0;
WARN_ON(daddiu_bug < 0); WARN_ON(daddiu_bug < 0);
return daddiu_bug != 0; return daddiu_bug != 0;
#else
return 0;
#endif
} }
#endif /* _ASM_BUGS_H */ #endif /* _ASM_BUGS_H */
...@@ -11,19 +11,10 @@ ...@@ -11,19 +11,10 @@
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/irqflags.h> #include <linux/irqflags.h>
#include <asm/compiler.h> #include <asm/compiler.h>
#include <asm/llsc.h>
#include <asm/sync.h>
#include <asm/war.h> #include <asm/war.h>
/*
* Using a branch-likely instruction to check the result of an sc instruction
* works around a bug present in R10000 CPUs prior to revision 3.0 that could
* cause ll-sc sequences to execute non-atomically.
*/
#if R10000_LLSC_WAR
# define __scbeqz "beqzl"
#else
# define __scbeqz "beqz"
#endif
/* /*
* These functions doesn't exist, so if they are called you'll either: * These functions doesn't exist, so if they are called you'll either:
* *
...@@ -46,18 +37,18 @@ extern unsigned long __xchg_called_with_bad_pointer(void) ...@@ -46,18 +37,18 @@ extern unsigned long __xchg_called_with_bad_pointer(void)
__typeof(*(m)) __ret; \ __typeof(*(m)) __ret; \
\ \
if (kernel_uses_llsc) { \ if (kernel_uses_llsc) { \
loongson_llsc_mb(); \
__asm__ __volatile__( \ __asm__ __volatile__( \
" .set push \n" \ " .set push \n" \
" .set noat \n" \ " .set noat \n" \
" .set push \n" \ " .set push \n" \
" .set " MIPS_ISA_ARCH_LEVEL " \n" \ " .set " MIPS_ISA_ARCH_LEVEL " \n" \
" " __SYNC(full, loongson3_war) " \n" \
"1: " ld " %0, %2 # __xchg_asm \n" \ "1: " ld " %0, %2 # __xchg_asm \n" \
" .set pop \n" \ " .set pop \n" \
" move $1, %z3 \n" \ " move $1, %z3 \n" \
" .set " MIPS_ISA_ARCH_LEVEL " \n" \ " .set " MIPS_ISA_ARCH_LEVEL " \n" \
" " st " $1, %1 \n" \ " " st " $1, %1 \n" \
"\t" __scbeqz " $1, 1b \n" \ "\t" __SC_BEQZ "$1, 1b \n" \
" .set pop \n" \ " .set pop \n" \
: "=&r" (__ret), "=" GCC_OFF_SMALL_ASM() (*m) \ : "=&r" (__ret), "=" GCC_OFF_SMALL_ASM() (*m) \
: GCC_OFF_SMALL_ASM() (*m), "Jr" (val) \ : GCC_OFF_SMALL_ASM() (*m), "Jr" (val) \
...@@ -103,7 +94,13 @@ unsigned long __xchg(volatile void *ptr, unsigned long x, int size) ...@@ -103,7 +94,13 @@ unsigned long __xchg(volatile void *ptr, unsigned long x, int size)
({ \ ({ \
__typeof__(*(ptr)) __res; \ __typeof__(*(ptr)) __res; \
\ \
smp_mb__before_llsc(); \ /* \
* In the Loongson3 workaround case __xchg_asm() already \
* contains a completion barrier prior to the LL, so we don't \
* need to emit an extra one here. \
*/ \
if (!__SYNC_loongson3_war) \
smp_mb__before_llsc(); \
\ \
__res = (__typeof__(*(ptr))) \ __res = (__typeof__(*(ptr))) \
__xchg((ptr), (unsigned long)(x), sizeof(*(ptr))); \ __xchg((ptr), (unsigned long)(x), sizeof(*(ptr))); \
...@@ -118,25 +115,24 @@ unsigned long __xchg(volatile void *ptr, unsigned long x, int size) ...@@ -118,25 +115,24 @@ unsigned long __xchg(volatile void *ptr, unsigned long x, int size)
__typeof(*(m)) __ret; \ __typeof(*(m)) __ret; \
\ \
if (kernel_uses_llsc) { \ if (kernel_uses_llsc) { \
loongson_llsc_mb(); \
__asm__ __volatile__( \ __asm__ __volatile__( \
" .set push \n" \ " .set push \n" \
" .set noat \n" \ " .set noat \n" \
" .set push \n" \ " .set push \n" \
" .set "MIPS_ISA_ARCH_LEVEL" \n" \ " .set "MIPS_ISA_ARCH_LEVEL" \n" \
" " __SYNC(full, loongson3_war) " \n" \
"1: " ld " %0, %2 # __cmpxchg_asm \n" \ "1: " ld " %0, %2 # __cmpxchg_asm \n" \
" bne %0, %z3, 2f \n" \ " bne %0, %z3, 2f \n" \
" .set pop \n" \ " .set pop \n" \
" move $1, %z4 \n" \ " move $1, %z4 \n" \
" .set "MIPS_ISA_ARCH_LEVEL" \n" \ " .set "MIPS_ISA_ARCH_LEVEL" \n" \
" " st " $1, %1 \n" \ " " st " $1, %1 \n" \
"\t" __scbeqz " $1, 1b \n" \ "\t" __SC_BEQZ "$1, 1b \n" \
" .set pop \n" \ " .set pop \n" \
"2: \n" \ "2: " __SYNC(full, loongson3_war) " \n" \
: "=&r" (__ret), "=" GCC_OFF_SMALL_ASM() (*m) \ : "=&r" (__ret), "=" GCC_OFF_SMALL_ASM() (*m) \
: GCC_OFF_SMALL_ASM() (*m), "Jr" (old), "Jr" (new) \ : GCC_OFF_SMALL_ASM() (*m), "Jr" (old), "Jr" (new) \
: __LLSC_CLOBBER); \ : __LLSC_CLOBBER); \
loongson_llsc_mb(); \
} else { \ } else { \
unsigned long __flags; \ unsigned long __flags; \
\ \
...@@ -190,9 +186,23 @@ unsigned long __cmpxchg(volatile void *ptr, unsigned long old, ...@@ -190,9 +186,23 @@ unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
({ \ ({ \
__typeof__(*(ptr)) __res; \ __typeof__(*(ptr)) __res; \
\ \
smp_mb__before_llsc(); \ /* \
* In the Loongson3 workaround case __cmpxchg_asm() already \
* contains a completion barrier prior to the LL, so we don't \
* need to emit an extra one here. \
*/ \
if (!__SYNC_loongson3_war) \
smp_mb__before_llsc(); \
\
__res = cmpxchg_local((ptr), (old), (new)); \ __res = cmpxchg_local((ptr), (old), (new)); \
smp_llsc_mb(); \ \
/* \
* In the Loongson3 workaround case __cmpxchg_asm() already \
* contains a completion barrier after the SC, so we don't \
* need to emit an extra one here. \
*/ \
if (!__SYNC_loongson3_war) \
smp_llsc_mb(); \
\ \
__res; \ __res; \
}) })
...@@ -233,11 +243,11 @@ static inline unsigned long __cmpxchg64(volatile void *ptr, ...@@ -233,11 +243,11 @@ static inline unsigned long __cmpxchg64(volatile void *ptr,
*/ */
local_irq_save(flags); local_irq_save(flags);
loongson_llsc_mb();
asm volatile( asm volatile(
" .set push \n" " .set push \n"
" .set " MIPS_ISA_ARCH_LEVEL " \n" " .set " MIPS_ISA_ARCH_LEVEL " \n"
/* Load 64 bits from ptr */ /* Load 64 bits from ptr */
" " __SYNC(full, loongson3_war) " \n"
"1: lld %L0, %3 # __cmpxchg64 \n" "1: lld %L0, %3 # __cmpxchg64 \n"
/* /*
* Split the 64 bit value we loaded into the 2 registers that hold the * Split the 64 bit value we loaded into the 2 registers that hold the
...@@ -269,9 +279,9 @@ static inline unsigned long __cmpxchg64(volatile void *ptr, ...@@ -269,9 +279,9 @@ static inline unsigned long __cmpxchg64(volatile void *ptr,
/* Attempt to store new at ptr */ /* Attempt to store new at ptr */
" scd %L1, %2 \n" " scd %L1, %2 \n"
/* If we failed, loop! */ /* If we failed, loop! */
"\t" __scbeqz " %L1, 1b \n" "\t" __SC_BEQZ "%L1, 1b \n"
" .set pop \n" " .set pop \n"
"2: \n" "2: " __SYNC(full, loongson3_war) " \n"
: "=&r"(ret), : "=&r"(ret),
"=&r"(tmp), "=&r"(tmp),
"=" GCC_OFF_SMALL_ASM() (*(unsigned long long *)ptr) "=" GCC_OFF_SMALL_ASM() (*(unsigned long long *)ptr)
...@@ -279,7 +289,6 @@ static inline unsigned long __cmpxchg64(volatile void *ptr, ...@@ -279,7 +289,6 @@ static inline unsigned long __cmpxchg64(volatile void *ptr,
"r" (old), "r" (old),
"r" (new) "r" (new)
: "memory"); : "memory");
loongson_llsc_mb();
local_irq_restore(flags); local_irq_restore(flags);
return ret; return ret;
...@@ -312,6 +321,4 @@ static inline unsigned long __cmpxchg64(volatile void *ptr, ...@@ -312,6 +321,4 @@ static inline unsigned long __cmpxchg64(volatile void *ptr,
# endif /* !CONFIG_SMP */ # endif /* !CONFIG_SMP */
#endif /* !CONFIG_64BIT */ #endif /* !CONFIG_64BIT */
#undef __scbeqz
#endif /* __ASM_CMPXCHG_H */ #endif /* __ASM_CMPXCHG_H */
...@@ -33,7 +33,7 @@ extern void nlm_cop2_restore(struct nlm_cop2_state *); ...@@ -33,7 +33,7 @@ extern void nlm_cop2_restore(struct nlm_cop2_state *);
#define cop2_present 1 #define cop2_present 1
#define cop2_lazy_restore 0 #define cop2_lazy_restore 0
#elif defined(CONFIG_CPU_LOONGSON3) #elif defined(CONFIG_CPU_LOONGSON64)
#define cop2_present 1 #define cop2_present 1
#define cop2_lazy_restore 1 #define cop2_lazy_restore 1
......
...@@ -15,18 +15,17 @@ ...@@ -15,18 +15,17 @@
static inline int __pure __get_cpu_type(const int cpu_type) static inline int __pure __get_cpu_type(const int cpu_type)
{ {
switch (cpu_type) { switch (cpu_type) {
#if defined(CONFIG_SYS_HAS_CPU_LOONGSON2E) || \ #if defined(CONFIG_SYS_HAS_CPU_LOONGSON2EF)
defined(CONFIG_SYS_HAS_CPU_LOONGSON2F) case CPU_LOONGSON2EF:
case CPU_LOONGSON2:
#endif #endif
#ifdef CONFIG_SYS_HAS_CPU_LOONGSON3 #ifdef CONFIG_SYS_HAS_CPU_LOONGSON64
case CPU_LOONGSON3: case CPU_LOONGSON64:
#endif #endif
#if defined(CONFIG_SYS_HAS_CPU_LOONGSON1B) || \ #if defined(CONFIG_SYS_HAS_CPU_LOONGSON1B) || \
defined(CONFIG_SYS_HAS_CPU_LOONGSON1C) defined(CONFIG_SYS_HAS_CPU_LOONGSON1C)
case CPU_LOONGSON1: case CPU_LOONGSON32:
#endif #endif
#ifdef CONFIG_SYS_HAS_CPU_MIPS32_R1 #ifdef CONFIG_SYS_HAS_CPU_MIPS32_R1
......
...@@ -91,7 +91,9 @@ ...@@ -91,7 +91,9 @@
#define PRID_IMP_LOONGSON_32 0x4200 /* Loongson-1 */ #define PRID_IMP_LOONGSON_32 0x4200 /* Loongson-1 */
#define PRID_IMP_R5432 0x5400 #define PRID_IMP_R5432 0x5400
#define PRID_IMP_R5500 0x5500 #define PRID_IMP_R5500 0x5500
#define PRID_IMP_LOONGSON_64 0x6300 /* Loongson-2/3 */ #define PRID_IMP_LOONGSON_64R 0x6100 /* Reduced Loongson-2 */
#define PRID_IMP_LOONGSON_64C 0x6300 /* Classic Loongson-2 and Loongson-3 */
#define PRID_IMP_LOONGSON_64G 0xc000 /* Generic Loongson-2 and Loongson-3 */
#define PRID_IMP_UNKNOWN 0xff00 #define PRID_IMP_UNKNOWN 0xff00
...@@ -310,15 +312,15 @@ enum cpu_type_enum { ...@@ -310,15 +312,15 @@ enum cpu_type_enum {
*/ */
CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K, CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,
CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350, CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350,
CPU_BMIPS4380, CPU_BMIPS5000, CPU_XBURST, CPU_LOONGSON1, CPU_M14KC, CPU_BMIPS4380, CPU_BMIPS5000, CPU_XBURST, CPU_LOONGSON32, CPU_M14KC,
CPU_M14KEC, CPU_INTERAPTIV, CPU_P5600, CPU_PROAPTIV, CPU_1074K, CPU_M14KEC, CPU_INTERAPTIV, CPU_P5600, CPU_PROAPTIV, CPU_1074K,
CPU_M5150, CPU_I6400, CPU_P6600, CPU_M6250, CPU_M5150, CPU_I6400, CPU_P6600, CPU_M6250,
/* /*
* MIPS64 class processors * MIPS64 class processors
*/ */
CPU_5KC, CPU_5KE, CPU_20KC, CPU_25KF, CPU_SB1, CPU_SB1A, CPU_LOONGSON2, CPU_5KC, CPU_5KE, CPU_20KC, CPU_25KF, CPU_SB1, CPU_SB1A, CPU_LOONGSON2EF,
CPU_LOONGSON3, CPU_CAVIUM_OCTEON, CPU_CAVIUM_OCTEON_PLUS, CPU_LOONGSON64, CPU_CAVIUM_OCTEON, CPU_CAVIUM_OCTEON_PLUS,
CPU_CAVIUM_OCTEON2, CPU_CAVIUM_OCTEON3, CPU_XLR, CPU_XLP, CPU_I6500, CPU_CAVIUM_OCTEON2, CPU_CAVIUM_OCTEON3, CPU_XLR, CPU_XLP, CPU_I6500,
CPU_QEMU_GENERIC, CPU_QEMU_GENERIC,
......
...@@ -70,7 +70,7 @@ enum fixed_addresses { ...@@ -70,7 +70,7 @@ enum fixed_addresses {
#include <asm-generic/fixmap.h> #include <asm-generic/fixmap.h>
#define kmap_get_fixmap_pte(vaddr) \ #define kmap_get_fixmap_pte(vaddr) \
pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr)) pte_offset_kernel(pmd_offset(pud_offset(p4d_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr)), (vaddr))
/* /*
* Called from pgtable_init() * Called from pgtable_init()
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <asm/barrier.h> #include <asm/barrier.h>
#include <asm/compiler.h> #include <asm/compiler.h>
#include <asm/errno.h> #include <asm/errno.h>
#include <asm/sync.h>
#include <asm/war.h> #include <asm/war.h>
#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
...@@ -32,7 +33,7 @@ ...@@ -32,7 +33,7 @@
" .set arch=r4000 \n" \ " .set arch=r4000 \n" \
"2: sc $1, %2 \n" \ "2: sc $1, %2 \n" \
" beqzl $1, 1b \n" \ " beqzl $1, 1b \n" \
__WEAK_LLSC_MB \ __stringify(__WEAK_LLSC_MB) " \n" \
"3: \n" \ "3: \n" \
" .insn \n" \ " .insn \n" \
" .set pop \n" \ " .set pop \n" \
...@@ -50,19 +51,19 @@ ...@@ -50,19 +51,19 @@
"i" (-EFAULT) \ "i" (-EFAULT) \
: "memory"); \ : "memory"); \
} else if (cpu_has_llsc) { \ } else if (cpu_has_llsc) { \
loongson_llsc_mb(); \
__asm__ __volatile__( \ __asm__ __volatile__( \
" .set push \n" \ " .set push \n" \
" .set noat \n" \ " .set noat \n" \
" .set push \n" \ " .set push \n" \
" .set "MIPS_ISA_ARCH_LEVEL" \n" \ " .set "MIPS_ISA_ARCH_LEVEL" \n" \
" " __SYNC(full, loongson3_war) " \n" \
"1: "user_ll("%1", "%4")" # __futex_atomic_op\n" \ "1: "user_ll("%1", "%4")" # __futex_atomic_op\n" \
" .set pop \n" \ " .set pop \n" \
" " insn " \n" \ " " insn " \n" \
" .set "MIPS_ISA_ARCH_LEVEL" \n" \ " .set "MIPS_ISA_ARCH_LEVEL" \n" \
"2: "user_sc("$1", "%2")" \n" \ "2: "user_sc("$1", "%2")" \n" \
" beqz $1, 1b \n" \ " beqz $1, 1b \n" \
__WEAK_LLSC_MB \ __stringify(__WEAK_LLSC_MB) " \n" \
"3: \n" \ "3: \n" \
" .insn \n" \ " .insn \n" \
" .set pop \n" \ " .set pop \n" \
...@@ -147,7 +148,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, ...@@ -147,7 +148,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
" .set arch=r4000 \n" " .set arch=r4000 \n"
"2: sc $1, %2 \n" "2: sc $1, %2 \n"
" beqzl $1, 1b \n" " beqzl $1, 1b \n"
__WEAK_LLSC_MB __stringify(__WEAK_LLSC_MB) " \n"
"3: \n" "3: \n"
" .insn \n" " .insn \n"
" .set pop \n" " .set pop \n"
...@@ -164,13 +165,13 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, ...@@ -164,13 +165,13 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
"i" (-EFAULT) "i" (-EFAULT)
: "memory"); : "memory");
} else if (cpu_has_llsc) { } else if (cpu_has_llsc) {
loongson_llsc_mb();
__asm__ __volatile__( __asm__ __volatile__(
"# futex_atomic_cmpxchg_inatomic \n" "# futex_atomic_cmpxchg_inatomic \n"
" .set push \n" " .set push \n"
" .set noat \n" " .set noat \n"
" .set push \n" " .set push \n"
" .set "MIPS_ISA_ARCH_LEVEL" \n" " .set "MIPS_ISA_ARCH_LEVEL" \n"
" " __SYNC(full, loongson3_war) " \n"
"1: "user_ll("%1", "%3")" \n" "1: "user_ll("%1", "%3")" \n"
" bne %1, %z4, 3f \n" " bne %1, %z4, 3f \n"
" .set pop \n" " .set pop \n"
...@@ -178,8 +179,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, ...@@ -178,8 +179,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
" .set "MIPS_ISA_ARCH_LEVEL" \n" " .set "MIPS_ISA_ARCH_LEVEL" \n"
"2: "user_sc("$1", "%2")" \n" "2: "user_sc("$1", "%2")" \n"
" beqz $1, 1b \n" " beqz $1, 1b \n"
__WEAK_LLSC_MB "3: " __SYNC_ELSE(full, loongson3_war, __WEAK_LLSC_MB) "\n"
"3: \n"
" .insn \n" " .insn \n"
" .set pop \n" " .set pop \n"
" .section .fixup,\"ax\" \n" " .section .fixup,\"ax\" \n"
...@@ -194,7 +194,6 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, ...@@ -194,7 +194,6 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
: GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval),
"i" (-EFAULT) "i" (-EFAULT)
: "memory"); : "memory");
loongson_llsc_mb();
} else } else
return -ENOSYS; return -ENOSYS;
......
...@@ -158,7 +158,7 @@ do { \ ...@@ -158,7 +158,7 @@ do { \
} while (0) } while (0)
#elif defined(CONFIG_MIPS_ALCHEMY) || defined(CONFIG_CPU_CAVIUM_OCTEON) || \ #elif defined(CONFIG_MIPS_ALCHEMY) || defined(CONFIG_CPU_CAVIUM_OCTEON) || \
defined(CONFIG_CPU_LOONGSON2) || defined(CONFIG_LOONGSON3_ENHANCEMENT) || \ defined(CONFIG_CPU_LOONGSON2EF) || defined(CONFIG_LOONGSON3_ENHANCEMENT) || \
defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_R5500) || defined(CONFIG_CPU_XLR) defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_R5500) || defined(CONFIG_CPU_XLR)
/* /*
......
...@@ -306,7 +306,7 @@ static inline void iounmap(const volatile void __iomem *addr) ...@@ -306,7 +306,7 @@ static inline void iounmap(const volatile void __iomem *addr)
#undef __IS_KSEG1 #undef __IS_KSEG1
} }
#if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_CPU_LOONGSON3) #if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_CPU_LOONGSON64)
#define war_io_reorder_wmb() wmb() #define war_io_reorder_wmb() wmb()
#else #else
#define war_io_reorder_wmb() barrier() #define war_io_reorder_wmb() barrier()
......
...@@ -41,7 +41,7 @@ static inline unsigned long arch_local_irq_save(void) ...@@ -41,7 +41,7 @@ static inline unsigned long arch_local_irq_save(void)
" .set push \n" " .set push \n"
" .set reorder \n" " .set reorder \n"
" .set noat \n" " .set noat \n"
#if defined(CONFIG_CPU_LOONGSON3) || defined (CONFIG_CPU_LOONGSON1) #if defined(CONFIG_CPU_LOONGSON64) || defined(CONFIG_CPU_LOONGSON32)
" mfc0 %[flags], $12 \n" " mfc0 %[flags], $12 \n"
" di \n" " di \n"
#else #else
......
...@@ -9,20 +9,31 @@ ...@@ -9,20 +9,31 @@
#ifndef __ASM_LLSC_H #ifndef __ASM_LLSC_H
#define __ASM_LLSC_H #define __ASM_LLSC_H
#include <asm/isa-rev.h>
#if _MIPS_SZLONG == 32 #if _MIPS_SZLONG == 32
#define SZLONG_LOG 5
#define SZLONG_MASK 31UL
#define __LL "ll " #define __LL "ll "
#define __SC "sc " #define __SC "sc "
#define __INS "ins " #define __INS "ins "
#define __EXT "ext " #define __EXT "ext "
#elif _MIPS_SZLONG == 64 #elif _MIPS_SZLONG == 64
#define SZLONG_LOG 6
#define SZLONG_MASK 63UL
#define __LL "lld " #define __LL "lld "
#define __SC "scd " #define __SC "scd "
#define __INS "dins " #define __INS "dins "
#define __EXT "dext " #define __EXT "dext "
#endif #endif
/*
* Using a branch-likely instruction to check the result of an sc instruction
* works around a bug present in R10000 CPUs prior to revision 3.0 that could
* cause ll-sc sequences to execute non-atomically.
*/
#if R10000_LLSC_WAR
# define __SC_BEQZ "beqzl "
#elif MIPS_ISA_REV >= 6
# define __SC_BEQZ "beqzc "
#else
# define __SC_BEQZ "beqz "
#endif
#endif /* __ASM_LLSC_H */ #endif /* __ASM_LLSC_H */
...@@ -10,17 +10,7 @@ ...@@ -10,17 +10,7 @@
#ifndef _ASM_MACH_IP22_SPACES_H #ifndef _ASM_MACH_IP22_SPACES_H
#define _ASM_MACH_IP22_SPACES_H #define _ASM_MACH_IP22_SPACES_H
#define PHYS_OFFSET _AC(0x08000000, UL)
#ifdef CONFIG_64BIT
#define PAGE_OFFSET 0xffffffff80000000UL
#define CAC_BASE 0xffffffff80000000
#define IO_BASE 0xffffffffa0000000
#define UNCAC_BASE 0xffffffffa0000000
#define MAP_BASE 0xc000000000000000
#endif /* CONFIG_64BIT */
#include <asm/mach-generic/spaces.h> #include <asm/mach-generic/spaces.h>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <asm/sn/arch.h> #include <asm/sn/arch.h>
#include <asm/sn/hub.h> #include <asm/sn/hub.h>
#define pa_to_nid(addr) NASID_TO_COMPACT_NODEID(NASID_GET(addr)) #define pa_to_nid(addr) NASID_GET(addr)
struct hub_data { struct hub_data {
kern_vars_t kern_vars; kern_vars_t kern_vars;
......
...@@ -7,14 +7,13 @@ ...@@ -7,14 +7,13 @@
#include <asm/mmzone.h> #include <asm/mmzone.h>
struct cpuinfo_ip27 { struct cpuinfo_ip27 {
cnodeid_t p_nodeid; /* my node ID in compact-id-space */
nasid_t p_nasid; /* my node ID in numa-as-id-space */ nasid_t p_nasid; /* my node ID in numa-as-id-space */
unsigned char p_slice; /* Physical position on node board */ unsigned char p_slice; /* Physical position on node board */
}; };
extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS]; extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
#define cpu_to_node(cpu) (sn_cpu_info[(cpu)].p_nodeid) #define cpu_to_node(cpu) (cputonasid(cpu))
#define cpumask_of_node(node) ((node) == -1 ? \ #define cpumask_of_node(node) ((node) == -1 ? \
cpu_all_mask : \ cpu_all_mask : \
&hub_data(node)->h_cpus) &hub_data(node)->h_cpus)
...@@ -23,7 +22,7 @@ extern int pcibus_to_node(struct pci_bus *); ...@@ -23,7 +22,7 @@ extern int pcibus_to_node(struct pci_bus *);
#define cpumask_of_pcibus(bus) (cpumask_of_node(pcibus_to_node(bus))) #define cpumask_of_pcibus(bus) (cpumask_of_node(pcibus_to_node(bus)))
extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES]; extern unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
#define node_distance(from, to) (__node_distances[(from)][(to)]) #define node_distance(from, to) (__node_distances[(from)][(to)])
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* IP30/Octane cpu-features overrides.
*
* Copyright (C) 2003 Ralf Baechle <ralf@linux-mips.org>
* 2004-2007 Stanislaw Skowronek <skylark@unaligned.org>
* 2009 Johannes Dickgreber <tanzy@gmx.de>
* 2015 Joshua Kinard <kumba@gentoo.org>
*
*/
#ifndef __ASM_MACH_IP30_CPU_FEATURE_OVERRIDES_H
#define __ASM_MACH_IP30_CPU_FEATURE_OVERRIDES_H
#include <asm/cpu.h>
/*
* IP30 only supports R1[024]000 processors, all using the same config
*/
#define cpu_has_tlb 1
#define cpu_has_tlbinv 0
#define cpu_has_segments 0
#define cpu_has_eva 0
#define cpu_has_htw 0
#define cpu_has_rixiex 0
#define cpu_has_maar 0
#define cpu_has_rw_llb 0
#define cpu_has_3kex 0
#define cpu_has_4kex 1
#define cpu_has_3k_cache 0
#define cpu_has_4k_cache 1
#define cpu_has_6k_cache 0
#define cpu_has_8k_cache 0
#define cpu_has_tx39_cache 0
#define cpu_has_fpu 1
#define cpu_has_nofpuex 0
#define cpu_has_32fpr 1
#define cpu_has_counter 1
#define cpu_has_watch 1
#define cpu_has_64bits 1
#define cpu_has_divec 0
#define cpu_has_vce 0
#define cpu_has_cache_cdex_p 0
#define cpu_has_cache_cdex_s 0
#define cpu_has_prefetch 1
#define cpu_has_mcheck 0
#define cpu_has_ejtag 0
#define cpu_has_llsc 1
#define cpu_has_mips16 0
#define cpu_has_mdmx 0
#define cpu_has_mips3d 0
#define cpu_has_smartmips 0
#define cpu_has_rixi 0
#define cpu_has_xpa 0
#define cpu_has_vtag_icache 0
#define cpu_has_dc_aliases 0
#define cpu_has_ic_fills_f_dc 0
#define cpu_icache_snoops_remote_store 1
#define cpu_has_mips32r1 0
#define cpu_has_mips32r2 0
#define cpu_has_mips64r1 0
#define cpu_has_mips64r2 0
#define cpu_has_mips32r6 0
#define cpu_has_mips64r6 0
#define cpu_has_dsp 0
#define cpu_has_dsp2 0
#define cpu_has_mipsmt 0
#define cpu_has_userlocal 0
#define cpu_has_inclusive_pcaches 1
#define cpu_hwrena_impl_bits 0
#define cpu_has_perf_cntr_intr_bit 0
#define cpu_has_vz 0
#define cpu_has_fre 0
#define cpu_has_cdmm 0
#define cpu_dcache_line_size() 32
#define cpu_icache_line_size() 64
#define cpu_scache_line_size() 128
#endif /* __ASM_MACH_IP30_CPU_FEATURE_OVERRIDES_H */
/* SPDX-License-Identifier: GPL-2.0 */
/*
* HEART IRQ defines
*
* Copyright (C) 2009 Johannes Dickgreber <tanzy@gmx.de>
* 2014-2016 Joshua Kinard <kumba@gentoo.org>
*
*/
#ifndef __ASM_MACH_IP30_IRQ_H
#define __ASM_MACH_IP30_IRQ_H
/*
* HEART has 64 hardware interrupts, but use 128 to leave room for a few
* software interrupts as well (such as the CPU timer interrupt.
*/
#define NR_IRQS 128
extern void __init ip30_install_ipi(void);
/*
* HEART has 64 interrupt vectors available to it, subdivided into five
* priority levels. They are numbered 0 to 63.
*/
#define HEART_NUM_IRQS 64
/*
* These are the five interrupt priority levels and their corresponding
* CPU IPx interrupt pins.
*
* Level 4 - Error Interrupts.
* Level 3 - HEART timer interrupt.
* Level 2 - CPU IPI, CPU debug, power putton, general device interrupts.
* Level 1 - General device interrupts.
* Level 0 - General device GFX flow control interrupts.
*/
#define HEART_L4_INT_MASK 0xfff8000000000000ULL /* IP6 */
#define HEART_L3_INT_MASK 0x0004000000000000ULL /* IP5 */
#define HEART_L2_INT_MASK 0x0003ffff00000000ULL /* IP4 */
#define HEART_L1_INT_MASK 0x00000000ffff0000ULL /* IP3 */
#define HEART_L0_INT_MASK 0x000000000000ffffULL /* IP2 */
/* HEART L0 Interrupts (Low Priority) */
#define HEART_L0_INT_GENERIC 0
#define HEART_L0_INT_FLOW_CTRL_HWTR_0 1
#define HEART_L0_INT_FLOW_CTRL_HWTR_1 2
/* HEART L2 Interrupts (High Priority) */
#define HEART_L2_INT_RESCHED_CPU_0 46
#define HEART_L2_INT_RESCHED_CPU_1 47
#define HEART_L2_INT_CALL_CPU_0 48
#define HEART_L2_INT_CALL_CPU_1 49
/* HEART L3 Interrupts (Compare/Counter Timer) */
#define HEART_L3_INT_TIMER 50
/* HEART L4 Interrupts (Errors) */
#define HEART_L4_INT_XWID_ERR_9 51
#define HEART_L4_INT_XWID_ERR_A 52
#define HEART_L4_INT_XWID_ERR_B 53
#define HEART_L4_INT_XWID_ERR_C 54
#define HEART_L4_INT_XWID_ERR_D 55
#define HEART_L4_INT_XWID_ERR_E 56
#define HEART_L4_INT_XWID_ERR_F 57
#define HEART_L4_INT_XWID_ERR_XBOW 58
#define HEART_L4_INT_CPU_BUS_ERR_0 59
#define HEART_L4_INT_CPU_BUS_ERR_1 60
#define HEART_L4_INT_CPU_BUS_ERR_2 61
#define HEART_L4_INT_CPU_BUS_ERR_3 62
#define HEART_L4_INT_HEART_EXCP 63
/*
* Power Switch is wired via BaseIO BRIDGE slot #6.
*
* ACFail is wired via BaseIO BRIDGE slot #7.
*/
#define IP30_POWER_IRQ HEART_L2_INT_POWER_BTN
#include_next <irq.h>
#define IP30_HEART_L0_IRQ (MIPS_CPU_IRQ_BASE + 2)
#define IP30_HEART_L1_IRQ (MIPS_CPU_IRQ_BASE + 3)
#define IP30_HEART_L2_IRQ (MIPS_CPU_IRQ_BASE + 4)
#define IP30_HEART_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 5)
#define IP30_HEART_ERR_IRQ (MIPS_CPU_IRQ_BASE + 6)
#endif /* __ASM_MACH_IP30_IRQ_H */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_MACH_IP30_KERNEL_ENTRY_H
#define __ASM_MACH_IP30_KERNEL_ENTRY_H
.macro kernel_entry_setup
.endm
.macro smp_slave_setup
move gp, a0
.endm
#endif /* __ASM_MACH_IP30_KERNEL_ENTRY_H */
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2003, 2004 Ralf Baechle
*/
#ifndef __ASM_MACH_IP30_MANGLE_PORT_H
#define __ASM_MACH_IP30_MANGLE_PORT_H
#define __swizzle_addr_b(port) ((port)^3)
#define __swizzle_addr_w(port) ((port)^2)
#define __swizzle_addr_l(port) (port)
#define __swizzle_addr_q(port) (port)
#define ioswabb(a, x) (x)
#define __mem_ioswabb(a, x) (x)
#define ioswabw(a, x) (x)
#define __mem_ioswabw(a, x) cpu_to_le16(x)
#define ioswabl(a, x) (x)
#define __mem_ioswabl(a, x) cpu_to_le32(x)
#define ioswabq(a, x) (x)
#define __mem_ioswabq(a, x) cpu_to_le64(x)
#endif /* __ASM_MACH_IP30_MANGLE_PORT_H */
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2016 Joshua Kinard <kumba@gentoo.org>
*
*/
#ifndef _ASM_MACH_IP30_SPACES_H
#define _ASM_MACH_IP30_SPACES_H
/*
* Memory in IP30/Octane is offset 512MB in the physical address space.
*/
#define PHYS_OFFSET _AC(0x20000000, UL)
#ifdef CONFIG_64BIT
#define CAC_BASE _AC(0xA800000000000000, UL)
#endif
#include <asm/mach-generic/spaces.h>
#endif /* _ASM_MACH_IP30_SPACES_H */
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
*/
#ifndef __ASM_MIPS_MACH_IP30_WAR_H
#define __ASM_MIPS_MACH_IP30_WAR_H
#define R4600_V1_INDEX_ICACHEOP_WAR 0
#define R4600_V1_HIT_CACHEOP_WAR 0
#define R4600_V2_HIT_CACHEOP_WAR 0
#define MIPS_CACHE_SYNC_WAR 0
#define BCM1250_M3_WAR 0
#define SIBYTE_1956_WAR 0
#define MIPS4K_ICACHE_REFILL_WAR 0
#define MIPS34K_MISSED_ITLB_WAR 0
#define R5432_CP0_INTERRUPT_WAR 0
#define TX49XX_ICACHE_INDEX_INV_WAR 0
#define ICACHE_REFILLS_WORKAROUND_WAR 0
#ifdef CONFIG_CPU_R10000
#define R10000_LLSC_WAR 1
#else
#define R10000_LLSC_WAR 0
#endif
#endif /* __ASM_MIPS_MACH_IP30_WAR_H */
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
* Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
* Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
*
* reference: /proc/cpuinfo,
* arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
* arch/mips/kernel/proc.c(show_cpuinfo),
* loongson2f user manual.
*/
#ifndef __ASM_MACH_LOONGSON2EF_CPU_FEATURE_OVERRIDES_H
#define __ASM_MACH_LOONGSON2EF_CPU_FEATURE_OVERRIDES_H
#define cpu_has_32fpr 1
#define cpu_has_3k_cache 0
#define cpu_has_4k_cache 1
#define cpu_has_4kex 1
#define cpu_has_64bits 1
#define cpu_has_cache_cdex_p 0
#define cpu_has_cache_cdex_s 0
#define cpu_has_counter 1
#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
#define cpu_has_divec 0
#define cpu_has_ejtag 0
#define cpu_has_inclusive_pcaches 1
#define cpu_has_llsc 1
#define cpu_has_mcheck 0
#define cpu_has_mdmx 0
#define cpu_has_mips16 0
#define cpu_has_mips16e2 0
#define cpu_has_mips3d 0
#define cpu_has_mipsmt 0
#define cpu_has_smartmips 0
#define cpu_has_tlb 1
#define cpu_has_tx39_cache 0
#define cpu_has_vce 0
#define cpu_has_veic 0
#define cpu_has_vint 0
#define cpu_has_vtag_icache 0
#define cpu_has_watch 1
#endif /* __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H */
This diff is collapsed.
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* Author: Wu Zhangjin <wuzhangjin@gmail.com> * Author: Wu Zhangjin <wuzhangjin@gmail.com>
*/ */
#ifndef __ASM_MACH_LOONGSON64_MACHINE_H #ifndef __ASM_MACH_LOONGSON2EF_MACHINE_H
#define __ASM_MACH_LOONGSON64_MACHINE_H #define __ASM_MACH_LOONGSON2EF_MACHINE_H
#ifdef CONFIG_LEMOTE_FULOONG2E #ifdef CONFIG_LEMOTE_FULOONG2E
...@@ -20,10 +20,4 @@ ...@@ -20,10 +20,4 @@
#endif #endif
#ifdef CONFIG_LOONGSON_MACH3X #endif /* __ASM_MACH_LOONGSON2EF_MACHINE_H */
#define LOONGSON_MACHTYPE MACH_LOONGSON_GENERIC
#endif /* CONFIG_LOONGSON_MACH3X */
#endif /* __ASM_MACH_LOONGSON64_MACHINE_H */
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1998, 2001, 03, 07 by Ralf Baechle (ralf@linux-mips.org)
*
* RTC routines for PC style attached Dallas chip.
*/
#ifndef __ASM_MACH_LOONGSON2EF_MC146818RTC_H
#define __ASM_MACH_LOONGSON2EF_MC146818RTC_H
#include <linux/io.h>
#define RTC_PORT(x) (0x70 + (x))
#define RTC_IRQ 8
static inline unsigned char CMOS_READ(unsigned long addr)
{
outb_p(addr, RTC_PORT(0));
return inb_p(RTC_PORT(1));
}
static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
{
outb_p(addr, RTC_PORT(0));
outb_p(data, RTC_PORT(1));
}
#define RTC_ALWAYS_BCD 0
#ifndef mc146818_decode_year
#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970)
#endif
#endif /* __ASM_MACH_LOONGSON2EF_MC146818RTC_H */
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* Author: Wu Zhangjin <wuzhangjin@gmail.com> * Author: Wu Zhangjin <wuzhangjin@gmail.com>
*/ */
#ifndef __ASM_MACH_LOONGSON64_MEM_H #ifndef __ASM_MACH_LOONGSON2EF_MEM_H
#define __ASM_MACH_LOONGSON64_MEM_H #define __ASM_MACH_LOONGSON2EF_MEM_H
/* /*
* high memory space * high memory space
...@@ -34,4 +34,4 @@ ...@@ -34,4 +34,4 @@
#define LOONGSON_MMIO_MEM_END 0x80000000 #define LOONGSON_MMIO_MEM_END 0x80000000
#endif #endif
#endif /* __ASM_MACH_LOONGSON64_MEM_H */ #endif /* __ASM_MACH_LOONGSON2EF_MEM_H */
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (c) 2008 Zhang Le <r0bertz@gentoo.org>
* Copyright (c) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
*/
#ifndef __ASM_MACH_LOONGSON2EF_PCI_H_
#define __ASM_MACH_LOONGSON2EF_PCI_H_
extern struct pci_ops loongson_pci_ops;
/* this is an offset from mips_io_port_base */
#define LOONGSON_PCI_IO_START 0x00004000UL
#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
/*
* we use address window2 to map cpu address space to pci space
* window2: cpu [1G, 2G] -> pci [1G, 2G]
* why not use window 0 & 1? because they are used by cpu when booting.
* window0: cpu [0, 256M] -> ddr [0, 256M]
* window1: cpu [256M, 512M] -> pci [256M, 512M]
*/
/* the smallest LOONGSON_CPU_MEM_SRC can be 512M */
#define LOONGSON_CPU_MEM_SRC 0x40000000ul /* 1G */
#define LOONGSON_PCI_MEM_DST LOONGSON_CPU_MEM_SRC
#define LOONGSON_PCI_MEM_START LOONGSON_PCI_MEM_DST
#define LOONGSON_PCI_MEM_END (0x80000000ul-1) /* 2G */
#define MMAP_CPUTOPCI_SIZE (LOONGSON_PCI_MEM_END - \
LOONGSON_PCI_MEM_START + 1)
#else /* loongson2f/32bit & loongson2e */
/* this pci memory space is mapped by pcimap in pci.c */
#define LOONGSON_PCI_MEM_START LOONGSON_PCILO1_BASE
#define LOONGSON_PCI_MEM_END (LOONGSON_PCILO1_BASE + 0x04000000 * 2)
/* this is an offset from mips_io_port_base */
#define LOONGSON_PCI_IO_START 0x00004000UL
#endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */
#endif /* !__ASM_MACH_LOONGSON2EF_PCI_H_ */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_MACH_LOONGSON2EF_SPACES_H_
#define __ASM_MACH_LOONGSON2EF_SPACES_H_
#if defined(CONFIG_64BIT)
#define CAC_BASE _AC(0x9800000000000000, UL)
#endif /* CONFIG_64BIT */
#include <asm/mach-generic/spaces.h>
#endif
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
*/
#ifndef __ASM_MACH_LOONGSON32_PROM_H
#define __ASM_MACH_LOONGSON32_PROM_H
#include <linux/io.h>
#include <linux/init.h>
#include <linux/irq.h>
/* environment arguments from bootloader */
extern unsigned long memsize, highmemsize;
/* loongson-specific command line, env and memory initialization */
extern char *prom_getenv(char *name);
extern void __init prom_init_cmdline(void);
#endif /* __ASM_MACH_LOONGSON32_PROM_H */
...@@ -43,11 +43,8 @@ ...@@ -43,11 +43,8 @@
#define cpu_has_vint 0 #define cpu_has_vint 0
#define cpu_has_vtag_icache 0 #define cpu_has_vtag_icache 0
#define cpu_has_watch 1 #define cpu_has_watch 1
#ifdef CONFIG_CPU_LOONGSON3
#define cpu_has_wsbh 1 #define cpu_has_wsbh 1
#define cpu_has_ic_fills_f_dc 1 #define cpu_has_ic_fills_f_dc 1
#define cpu_hwrena_impl_bits 0xc0000000 #define cpu_hwrena_impl_bits 0xc0000000
#endif
#endif /* __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H */ #endif /* __ASM_MACH_LOONGSON64_CPU_FEATURE_OVERRIDES_H */
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include <boot_param.h> #include <boot_param.h>
#ifdef CONFIG_CPU_LOONGSON3
/* cpu core interrupt numbers */ /* cpu core interrupt numbers */
#define MIPS_CPU_IRQ_BASE 56 #define MIPS_CPU_IRQ_BASE 56
...@@ -35,8 +33,6 @@ ...@@ -35,8 +33,6 @@
#define LOONGSON_INT_COREx_INTy(x, y) (1<<(x) | 1<<(y+4)) /* route to int y of core x */ #define LOONGSON_INT_COREx_INTy(x, y) (1<<(x) | 1<<(y+4)) /* route to int y of core x */
#endif
extern void fixup_irqs(void); extern void fixup_irqs(void);
extern void loongson3_ipi_interrupt(struct pt_regs *regs); extern void loongson3_ipi_interrupt(struct pt_regs *regs);
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
* Override macros used in arch/mips/kernel/head.S. * Override macros used in arch/mips/kernel/head.S.
*/ */
.macro kernel_entry_setup .macro kernel_entry_setup
#ifdef CONFIG_CPU_LOONGSON3
.set push .set push
.set mips64 .set mips64
/* Set LPA on LOONGSON3 config3 */ /* Set LPA on LOONGSON3 config3 */
...@@ -30,23 +29,29 @@ ...@@ -30,23 +29,29 @@
mtc0 t0, CP0_PAGEGRAIN mtc0 t0, CP0_PAGEGRAIN
/* Enable STFill Buffer */ /* Enable STFill Buffer */
mfc0 t0, CP0_PRID mfc0 t0, CP0_PRID
/* Loongson-3A R4+ */
andi t1, t0, PRID_IMP_MASK
li t2, PRID_IMP_LOONGSON_64G
beq t1, t2, 1f
nop
/* Loongson-3A R2/R3 */
andi t0, (PRID_IMP_MASK | PRID_REV_MASK) andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2_0) slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0)
bnez t0, 1f bnez t0, 2f
nop
1:
mfc0 t0, CP0_CONFIG6 mfc0 t0, CP0_CONFIG6
or t0, 0x100 or t0, 0x100
mtc0 t0, CP0_CONFIG6 mtc0 t0, CP0_CONFIG6
1: 2:
_ehb _ehb
.set pop .set pop
#endif
.endm .endm
/* /*
* Do SMP slave processor setup. * Do SMP slave processor setup.
*/ */
.macro smp_slave_setup .macro smp_slave_setup
#ifdef CONFIG_CPU_LOONGSON3
.set push .set push
.set mips64 .set mips64
/* Set LPA on LOONGSON3 config3 */ /* Set LPA on LOONGSON3 config3 */
...@@ -59,16 +64,23 @@ ...@@ -59,16 +64,23 @@
mtc0 t0, CP0_PAGEGRAIN mtc0 t0, CP0_PAGEGRAIN
/* Enable STFill Buffer */ /* Enable STFill Buffer */
mfc0 t0, CP0_PRID mfc0 t0, CP0_PRID
/* Loongson-3A R4+ */
andi t1, t0, PRID_IMP_MASK
li t2, PRID_IMP_LOONGSON_64G
beq t1, t2, 1f
nop
/* Loongson-3A R2/R3 */
andi t0, (PRID_IMP_MASK | PRID_REV_MASK) andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2_0) slti t0, (PRID_IMP_LOONGSON_64C | PRID_REV_LOONGSON3A_R2_0)
bnez t0, 1f bnez t0, 2f
nop
1:
mfc0 t0, CP0_CONFIG6 mfc0 t0, CP0_CONFIG6
or t0, 0x100 or t0, 0x100
mtc0 t0, CP0_CONFIG6 mtc0 t0, CP0_CONFIG6
1: 2:
_ehb _ehb
.set pop .set pop
#endif
.endm .endm
#endif /* __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H */ #endif /* __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H */
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <boot_param.h> #include <boot_param.h>
/* loongson internal northbridge initialization */
extern void bonito_irq_init(void);
/* machine-specific reboot/halt operation */ /* machine-specific reboot/halt operation */
extern void mach_prepare_reboot(void); extern void mach_prepare_reboot(void);
...@@ -26,25 +24,9 @@ extern const struct plat_smp_ops loongson3_smp_ops; ...@@ -26,25 +24,9 @@ extern const struct plat_smp_ops loongson3_smp_ops;
/* loongson-specific command line, env and memory initialization */ /* loongson-specific command line, env and memory initialization */
extern void __init prom_init_memory(void); extern void __init prom_init_memory(void);
extern void __init prom_init_cmdline(void);
extern void __init prom_init_machtype(void);
extern void __init prom_init_env(void); extern void __init prom_init_env(void);
#ifdef CONFIG_LOONGSON_UART_BASE
extern unsigned long _loongson_uart_base[], loongson_uart_base[];
extern void prom_init_loongson_uart_base(void);
#endif
static inline void prom_init_uart_base(void)
{
#ifdef CONFIG_LOONGSON_UART_BASE
prom_init_loongson_uart_base();
#endif
}
/* irq operation functions */ /* irq operation functions */
extern void bonito_irqdispatch(void);
extern void __init bonito_irq_init(void);
extern void __init mach_init_irq(void);
extern void mach_irq_dispatch(unsigned int pending); extern void mach_irq_dispatch(unsigned int pending);
extern int mach_i8259_irq(void); extern int mach_i8259_irq(void);
...@@ -64,17 +46,6 @@ extern int mach_i8259_irq(void); ...@@ -64,17 +46,6 @@ extern int mach_i8259_irq(void);
#define LOONGSON3_REG32(base, x) \ #define LOONGSON3_REG32(base, x) \
(*(volatile u32 *)((char *)TO_UNCAC(base) + (x))) (*(volatile u32 *)((char *)TO_UNCAC(base) + (x)))
#define LOONGSON_IRQ_BASE 32
#define LOONGSON2_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */
#include <linux/interrupt.h>
static inline void do_perfcnt_IRQ(void)
{
#if IS_ENABLED(CONFIG_OPROFILE)
do_IRQ(LOONGSON2_PERFCNT_IRQ);
#endif
}
#define LOONGSON_FLASH_BASE 0x1c000000 #define LOONGSON_FLASH_BASE 0x1c000000
#define LOONGSON_FLASH_SIZE 0x02000000 /* 32M */ #define LOONGSON_FLASH_SIZE 0x02000000 /* 32M */
#define LOONGSON_FLASH_TOP (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1) #define LOONGSON_FLASH_TOP (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1)
...@@ -109,11 +80,7 @@ static inline void do_perfcnt_IRQ(void) ...@@ -109,11 +80,7 @@ static inline void do_perfcnt_IRQ(void)
#define LOONGSON_PCICFG_SIZE 0x00000800 /* 2K */ #define LOONGSON_PCICFG_SIZE 0x00000800 /* 2K */
#define LOONGSON_PCICFG_TOP (LOONGSON_PCICFG_BASE+LOONGSON_PCICFG_SIZE-1) #define LOONGSON_PCICFG_TOP (LOONGSON_PCICFG_BASE+LOONGSON_PCICFG_SIZE-1)
#ifdef CONFIG_CPU_LOONGSON3
#define LOONGSON_PCIIO_BASE loongson_sysconf.pci_io_base #define LOONGSON_PCIIO_BASE loongson_sysconf.pci_io_base
#else
#define LOONGSON_PCIIO_BASE 0x1fd00000
#endif
#define LOONGSON_PCIIO_SIZE 0x00100000 /* 1M */ #define LOONGSON_PCIIO_SIZE 0x00100000 /* 1M */
#define LOONGSON_PCIIO_TOP (LOONGSON_PCIIO_BASE+LOONGSON_PCIIO_SIZE-1) #define LOONGSON_PCIIO_TOP (LOONGSON_PCIIO_BASE+LOONGSON_PCIIO_SIZE-1)
...@@ -270,86 +237,4 @@ extern u64 loongson_freqctrl[MAX_PACKAGES]; ...@@ -270,86 +237,4 @@ extern u64 loongson_freqctrl[MAX_PACKAGES];
#define LOONGSON_PCIMAP_WIN(WIN, ADDR) \ #define LOONGSON_PCIMAP_WIN(WIN, ADDR) \
((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6)) ((((ADDR)>>26) & LOONGSON_PCIMAP_PCIMAP_LO0) << ((WIN)*6))
#ifdef CONFIG_CPU_SUPPORTS_CPUFREQ
#include <linux/cpufreq.h>
extern struct cpufreq_frequency_table loongson2_clockmod_table[];
#endif
/*
* address windows configuration module
*
* loongson2e do not have this module
*/
#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
/* address window config module base address */
#define LOONGSON_ADDRWINCFG_BASE 0x3ff00000ul
#define LOONGSON_ADDRWINCFG_SIZE 0x180
extern unsigned long _loongson_addrwincfg_base;
#define LOONGSON_ADDRWINCFG(offset) \
(*(volatile u64 *)(_loongson_addrwincfg_base + (offset)))
#define CPU_WIN0_BASE LOONGSON_ADDRWINCFG(0x00)
#define CPU_WIN1_BASE LOONGSON_ADDRWINCFG(0x08)
#define CPU_WIN2_BASE LOONGSON_ADDRWINCFG(0x10)
#define CPU_WIN3_BASE LOONGSON_ADDRWINCFG(0x18)
#define CPU_WIN0_MASK LOONGSON_ADDRWINCFG(0x20)
#define CPU_WIN1_MASK LOONGSON_ADDRWINCFG(0x28)
#define CPU_WIN2_MASK LOONGSON_ADDRWINCFG(0x30)
#define CPU_WIN3_MASK LOONGSON_ADDRWINCFG(0x38)
#define CPU_WIN0_MMAP LOONGSON_ADDRWINCFG(0x40)
#define CPU_WIN1_MMAP LOONGSON_ADDRWINCFG(0x48)
#define CPU_WIN2_MMAP LOONGSON_ADDRWINCFG(0x50)
#define CPU_WIN3_MMAP LOONGSON_ADDRWINCFG(0x58)
#define PCIDMA_WIN0_BASE LOONGSON_ADDRWINCFG(0x60)
#define PCIDMA_WIN1_BASE LOONGSON_ADDRWINCFG(0x68)
#define PCIDMA_WIN2_BASE LOONGSON_ADDRWINCFG(0x70)
#define PCIDMA_WIN3_BASE LOONGSON_ADDRWINCFG(0x78)
#define PCIDMA_WIN0_MASK LOONGSON_ADDRWINCFG(0x80)
#define PCIDMA_WIN1_MASK LOONGSON_ADDRWINCFG(0x88)
#define PCIDMA_WIN2_MASK LOONGSON_ADDRWINCFG(0x90)
#define PCIDMA_WIN3_MASK LOONGSON_ADDRWINCFG(0x98)
#define PCIDMA_WIN0_MMAP LOONGSON_ADDRWINCFG(0xa0)
#define PCIDMA_WIN1_MMAP LOONGSON_ADDRWINCFG(0xa8)
#define PCIDMA_WIN2_MMAP LOONGSON_ADDRWINCFG(0xb0)
#define PCIDMA_WIN3_MMAP LOONGSON_ADDRWINCFG(0xb8)
#define ADDRWIN_WIN0 0
#define ADDRWIN_WIN1 1
#define ADDRWIN_WIN2 2
#define ADDRWIN_WIN3 3
#define ADDRWIN_MAP_DST_DDR 0
#define ADDRWIN_MAP_DST_PCI 1
#define ADDRWIN_MAP_DST_LIO 1
/*
* s: CPU, PCIDMA
* d: DDR, PCI, LIO
* win: 0, 1, 2, 3
* src: map source
* dst: map destination
* size: ~mask + 1
*/
#define LOONGSON_ADDRWIN_CFG(s, d, w, src, dst, size) do {\
s##_WIN##w##_BASE = (src); \
s##_WIN##w##_MMAP = (dst) | ADDRWIN_MAP_DST_##d; \
s##_WIN##w##_MASK = ~(size-1); \
} while (0)
#define LOONGSON_ADDRWIN_CPUTOPCI(win, src, dst, size) \
LOONGSON_ADDRWIN_CFG(CPU, PCI, win, src, dst, size)
#define LOONGSON_ADDRWIN_CPUTODDR(win, src, dst, size) \
LOONGSON_ADDRWIN_CFG(CPU, DDR, win, src, dst, size)
#define LOONGSON_ADDRWIN_PCITODDR(win, src, dst, size) \
LOONGSON_ADDRWIN_CFG(PCIDMA, DDR, win, src, dst, size)
#endif /* ! CONFIG_CPU_SUPPORTS_ADDRWINCFG */
#endif /* __ASM_MACH_LOONGSON64_LOONGSON_H */ #endif /* __ASM_MACH_LOONGSON64_LOONGSON_H */
/*
* Read/Write Loongson Extension Registers
*/
#ifndef _LOONGSON_REGS_H_
#define _LOONGSON_REGS_H_
#include <linux/types.h>
#include <linux/bits.h>
#include <asm/mipsregs.h>
#include <asm/cpu.h>
static inline bool cpu_has_cfg(void)
{
return ((read_c0_prid() & PRID_IMP_MASK) == PRID_IMP_LOONGSON_64G);
}
static inline u32 read_cpucfg(u32 reg)
{
u32 __res;
__asm__ __volatile__(
"parse_r __res,%0\n\t"
"parse_r reg,%1\n\t"
".insn \n\t"
".word (0xc8080118 | (reg << 21) | (__res << 11))\n\t"
:"=r"(__res)
:"r"(reg)
:
);
return __res;
}
/* Bit Domains for CFG registers */
#define LOONGSON_CFG0 0x0
#define LOONGSON_CFG0_PRID GENMASK(31, 0)
#define LOONGSON_CFG1 0x1
#define LOONGSON_CFG1_FP BIT(0)
#define LOONGSON_CFG1_FPREV GENMASK(3, 1)
#define LOONGSON_CFG1_MMI BIT(4)
#define LOONGSON_CFG1_MSA1 BIT(5)
#define LOONGSON_CFG1_MSA2 BIT(6)
#define LOONGSON_CFG1_CGP BIT(7)
#define LOONGSON_CFG1_WRP BIT(8)
#define LOONGSON_CFG1_LSX1 BIT(9)
#define LOONGSON_CFG1_LSX2 BIT(10)
#define LOONGSON_CFG1_LASX BIT(11)
#define LOONGSON_CFG1_R6FXP BIT(12)
#define LOONGSON_CFG1_R6CRCP BIT(13)
#define LOONGSON_CFG1_R6FPP BIT(14)
#define LOONGSON_CFG1_CNT64 BIT(15)
#define LOONGSON_CFG1_LSLDR0 BIT(16)
#define LOONGSON_CFG1_LSPREF BIT(17)
#define LOONGSON_CFG1_LSPREFX BIT(18)
#define LOONGSON_CFG1_LSSYNCI BIT(19)
#define LOONGSON_CFG1_LSUCA BIT(20)
#define LOONGSON_CFG1_LLSYNC BIT(21)
#define LOONGSON_CFG1_TGTSYNC BIT(22)
#define LOONGSON_CFG1_LLEXC BIT(23)
#define LOONGSON_CFG1_SCRAND BIT(24)
#define LOONGSON_CFG1_MUALP BIT(25)
#define LOONGSON_CFG1_KMUALEN BIT(26)
#define LOONGSON_CFG1_ITLBT BIT(27)
#define LOONGSON_CFG1_LSUPERF BIT(28)
#define LOONGSON_CFG1_SFBP BIT(29)
#define LOONGSON_CFG1_CDMAP BIT(30)
#define LOONGSON_CFG2 0x2
#define LOONGSON_CFG2_LEXT1 BIT(0)
#define LOONGSON_CFG2_LEXT2 BIT(1)
#define LOONGSON_CFG2_LEXT3 BIT(2)
#define LOONGSON_CFG2_LSPW BIT(3)
#define LOONGSON_CFG2_LBT1 BIT(4)
#define LOONGSON_CFG2_LBT2 BIT(5)
#define LOONGSON_CFG2_LBT3 BIT(6)
#define LOONGSON_CFG2_LBTMMU BIT(7)
#define LOONGSON_CFG2_LPMP BIT(8)
#define LOONGSON_CFG2_LPMPREV GENMASK(11, 9)
#define LOONGSON_CFG2_LAMO BIT(12)
#define LOONGSON_CFG2_LPIXU BIT(13)
#define LOONGSON_CFG2_LPIXUN BIT(14)
#define LOONGSON_CFG2_LZVP BIT(15)
#define LOONGSON_CFG2_LZVREV GENMASK(18, 16)
#define LOONGSON_CFG2_LGFTP BIT(19)
#define LOONGSON_CFG2_LGFTPREV GENMASK(22, 20)
#define LOONGSON_CFG2_LLFTP BIT(23)
#define LOONGSON_CFG2_LLFTPREV GENMASK(26, 24)
#define LOONGSON_CFG2_LCSRP BIT(27)
#define LOONGSON_CFG2_LDISBLIKELY BIT(28)
#define LOONGSON_CFG3 0x3
#define LOONGSON_CFG3_LCAMP BIT(0)
#define LOONGSON_CFG3_LCAMREV GENMASK(3, 1)
#define LOONGSON_CFG3_LCAMNUM GENMASK(11, 4)
#define LOONGSON_CFG3_LCAMKW GENMASK(19, 12)
#define LOONGSON_CFG3_LCAMVW GENMASK(27, 20)
#define LOONGSON_CFG4 0x4
#define LOONGSON_CFG4_CCFREQ GENMASK(31, 0)
#define LOONGSON_CFG5 0x5
#define LOONGSON_CFG5_CFM GENMASK(15, 0)
#define LOONGSON_CFG5_CFD GENMASK(31, 16)
#define LOONGSON_CFG6 0x6
#define LOONGSON_CFG7 0x7
#define LOONGSON_CFG7_GCCAEQRP BIT(0)
#define LOONGSON_CFG7_UCAWINP BIT(1)
static inline bool cpu_has_csr(void)
{
if (cpu_has_cfg())
return (read_cpucfg(LOONGSON_CFG2) & LOONGSON_CFG2_LCSRP);
return false;
}
static inline u32 csr_readl(u32 reg)
{
u32 __res;
/* RDCSR reg, val */
__asm__ __volatile__(
"parse_r __res,%0\n\t"
"parse_r reg,%1\n\t"
".insn \n\t"
".word (0xc8000118 | (reg << 21) | (__res << 11))\n\t"
:"=r"(__res)
:"r"(reg)
:
);
return __res;
}
static inline u64 csr_readq(u32 reg)
{
u64 __res;
/* DWRCSR reg, val */
__asm__ __volatile__(
"parse_r __res,%0\n\t"
"parse_r reg,%1\n\t"
".insn \n\t"
".word (0xc8020118 | (reg << 21) | (__res << 11))\n\t"
:"=r"(__res)
:"r"(reg)
:
);
return __res;
}
static inline void csr_writel(u32 val, u32 reg)
{
/* WRCSR reg, val */
__asm__ __volatile__(
"parse_r reg,%0\n\t"
"parse_r val,%1\n\t"
".insn \n\t"
".word (0xc8010118 | (reg << 21) | (val << 11))\n\t"
:
:"r"(reg),"r"(val)
:
);
}
static inline void csr_writeq(u64 val, u32 reg)
{
/* DWRCSR reg, val */
__asm__ __volatile__(
"parse_r reg,%0\n\t"
"parse_r val,%1\n\t"
".insn \n\t"
".word (0xc8030118 | (reg << 21) | (val << 11))\n\t"
:
:"r"(reg),"r"(val)
:
);
}
/* Public CSR Register can also be accessed with regular addresses */
#define CSR_PUBLIC_MMIO_BASE 0x1fe00000
#define MMIO_CSR(x) (void *)TO_UNCAC(CSR_PUBLIC_MMIO_BASE + x)
#define LOONGSON_CSR_FEATURES 0x8
#define LOONGSON_CSRF_TEMP BIT(0)
#define LOONGSON_CSRF_NODECNT BIT(1)
#define LOONGSON_CSRF_MSI BIT(2)
#define LOONGSON_CSRF_EXTIOI BIT(3)
#define LOONGSON_CSRF_IPI BIT(4)
#define LOONGSON_CSRF_FREQ BIT(5)
#define LOONGSON_CSR_VENDOR 0x10 /* Vendor name string, should be "Loongson" */
#define LOONGSON_CSR_CPUNAME 0x20 /* Processor name string */
#define LOONGSON_CSR_NODECNT 0x408
#define LOONGSON_CSR_CPUTEMP 0x428
/* PerCore CSR, only accessable by local cores */
#define LOONGSON_CSR_IPI_STATUS 0x1000
#define LOONGSON_CSR_IPI_EN 0x1004
#define LOONGSON_CSR_IPI_SET 0x1008
#define LOONGSON_CSR_IPI_CLEAR 0x100c
#define LOONGSON_CSR_IPI_SEND 0x1040
#define CSR_IPI_SEND_IP_SHIFT 0
#define CSR_IPI_SEND_CPU_SHIFT 16
#define CSR_IPI_SEND_BLOCK BIT(31)
static inline u64 drdtime(void)
{
int rID = 0;
u64 val = 0;
__asm__ __volatile__(
"parse_r rID,%0\n\t"
"parse_r val,%1\n\t"
".insn \n\t"
".word (0xc8090118 | (rID << 21) | (val << 11))\n\t"
:"=r"(rID),"=r"(val)
:
);
return val;
}
#endif
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
* Huacai Chen, chenhc@lemote.com * Huacai Chen, chenhc@lemote.com
* Xiaofu Meng, Shuangshuang Zhang * Xiaofu Meng, Shuangshuang Zhang
*/ */
#ifndef _ASM_MACH_MMZONE_H #ifndef _ASM_MACH_LOONGSON64_MMZONE_H
#define _ASM_MACH_MMZONE_H #define _ASM_MACH_LOONGSON64_MMZONE_H
#include <boot_param.h> #include <boot_param.h>
#define NODE_ADDRSPACE_SHIFT 44 #define NODE_ADDRSPACE_SHIFT 44
...@@ -19,30 +19,9 @@ ...@@ -19,30 +19,9 @@
#define pa_to_nid(addr) (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT) #define pa_to_nid(addr) (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT)
#define nid_to_addrbase(nid) ((nid) << NODE_ADDRSPACE_SHIFT) #define nid_to_addrbase(nid) ((nid) << NODE_ADDRSPACE_SHIFT)
#define LEVELS_PER_SLICE 128 extern struct pglist_data *__node_data[];
struct slice_data { #define NODE_DATA(n) (__node_data[n])
unsigned long irq_enable_mask[2];
int level_to_irq[LEVELS_PER_SLICE];
};
struct hub_data {
cpumask_t h_cpus;
unsigned long slice_map;
unsigned long irq_alloc_mask[2];
struct slice_data slice[2];
};
struct node_data {
struct pglist_data pglist;
struct hub_data hub;
cpumask_t cpumask;
};
extern struct node_data *__node_data[];
#define NODE_DATA(n) (&__node_data[(n)]->pglist)
#define hub_data(n) (&__node_data[(n)]->hub)
extern void setup_zero_pages(void); extern void setup_zero_pages(void);
extern void __init prom_init_numa_memory(void); extern void __init prom_init_numa_memory(void);
......
...@@ -12,39 +12,8 @@ extern struct pci_ops loongson_pci_ops; ...@@ -12,39 +12,8 @@ extern struct pci_ops loongson_pci_ops;
/* this is an offset from mips_io_port_base */ /* this is an offset from mips_io_port_base */
#define LOONGSON_PCI_IO_START 0x00004000UL #define LOONGSON_PCI_IO_START 0x00004000UL
#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
/*
* we use address window2 to map cpu address space to pci space
* window2: cpu [1G, 2G] -> pci [1G, 2G]
* why not use window 0 & 1? because they are used by cpu when booting.
* window0: cpu [0, 256M] -> ddr [0, 256M]
* window1: cpu [256M, 512M] -> pci [256M, 512M]
*/
/* the smallest LOONGSON_CPU_MEM_SRC can be 512M */
#define LOONGSON_CPU_MEM_SRC 0x40000000ul /* 1G */
#define LOONGSON_PCI_MEM_DST LOONGSON_CPU_MEM_SRC
#define LOONGSON_PCI_MEM_START LOONGSON_PCI_MEM_DST
#define LOONGSON_PCI_MEM_END (0x80000000ul-1) /* 2G */
#define MMAP_CPUTOPCI_SIZE (LOONGSON_PCI_MEM_END - \
LOONGSON_PCI_MEM_START + 1)
#else /* loongson2f/32bit & loongson2e */
/* this pci memory space is mapped by pcimap in pci.c */
#ifdef CONFIG_CPU_LOONGSON3
#define LOONGSON_PCI_MEM_START 0x40000000UL #define LOONGSON_PCI_MEM_START 0x40000000UL
#define LOONGSON_PCI_MEM_END 0x7effffffUL #define LOONGSON_PCI_MEM_END 0x7effffffUL
#else
#define LOONGSON_PCI_MEM_START LOONGSON_PCILO1_BASE
#define LOONGSON_PCI_MEM_END (LOONGSON_PCILO1_BASE + 0x04000000 * 2)
#endif
/* this is an offset from mips_io_port_base */
#define LOONGSON_PCI_IO_START 0x00004000UL
#endif /* !CONFIG_CPU_SUPPORTS_ADDRWINCFG */
#endif /* !__ASM_MACH_LOONGSON64_PCI_H_ */ #endif /* !__ASM_MACH_LOONGSON64_PCI_H_ */
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
#define cpu_to_node(cpu) (cpu_logical_map(cpu) >> 2) #define cpu_to_node(cpu) (cpu_logical_map(cpu) >> 2)
#define cpumask_of_node(node) (&__node_data[(node)]->cpumask)
extern cpumask_t __node_cpumask[];
#define cpumask_of_node(node) (&__node_cpumask[node])
struct pci_bus; struct pci_bus;
extern int pcibus_to_node(struct pci_bus *); extern int pcibus_to_node(struct pci_bus *);
......
...@@ -689,6 +689,9 @@ ...@@ -689,6 +689,9 @@
#define MIPS_CONF7_IAR (_ULCAST_(1) << 10) #define MIPS_CONF7_IAR (_ULCAST_(1) << 10)
#define MIPS_CONF7_AR (_ULCAST_(1) << 16) #define MIPS_CONF7_AR (_ULCAST_(1) << 16)
/* Ingenic HPTLB off bits */
#define XBURST_PAGECTRL_HPTLB_DIS 0xa9000000
/* Ingenic Config7 bits */ /* Ingenic Config7 bits */
#define MIPS_CONF7_BTB_LOOP_EN (_ULCAST_(1) << 4) #define MIPS_CONF7_BTB_LOOP_EN (_ULCAST_(1) << 4)
...@@ -1971,6 +1974,9 @@ do { \ ...@@ -1971,6 +1974,9 @@ do { \
#define read_c0_brcm_sleepcount() __read_32bit_c0_register($22, 7) #define read_c0_brcm_sleepcount() __read_32bit_c0_register($22, 7)
#define write_c0_brcm_sleepcount(val) __write_32bit_c0_register($22, 7, val) #define write_c0_brcm_sleepcount(val) __write_32bit_c0_register($22, 7, val)
/* Ingenic page ctrl register */
#define write_c0_page_ctrl(val) __write_32bit_c0_register($5, 4, val)
/* /*
* Macros to access the guest system control coprocessor * Macros to access the guest system control coprocessor
*/ */
......
...@@ -119,12 +119,12 @@ search_module_dbetables(unsigned long addr) ...@@ -119,12 +119,12 @@ search_module_dbetables(unsigned long addr)
#define MODULE_PROC_FAMILY "RM7000 " #define MODULE_PROC_FAMILY "RM7000 "
#elif defined CONFIG_CPU_SB1 #elif defined CONFIG_CPU_SB1
#define MODULE_PROC_FAMILY "SB1 " #define MODULE_PROC_FAMILY "SB1 "
#elif defined CONFIG_CPU_LOONGSON1 #elif defined CONFIG_CPU_LOONGSON32
#define MODULE_PROC_FAMILY "LOONGSON1 " #define MODULE_PROC_FAMILY "LOONGSON32 "
#elif defined CONFIG_CPU_LOONGSON2 #elif defined CONFIG_CPU_LOONGSON2EF
#define MODULE_PROC_FAMILY "LOONGSON2 " #define MODULE_PROC_FAMILY "LOONGSON2EF "
#elif defined CONFIG_CPU_LOONGSON3 #elif defined CONFIG_CPU_LOONGSON64
#define MODULE_PROC_FAMILY "LOONGSON3 " #define MODULE_PROC_FAMILY "LOONGSON64 "
#elif defined CONFIG_CPU_CAVIUM_OCTEON #elif defined CONFIG_CPU_CAVIUM_OCTEON
#define MODULE_PROC_FAMILY "OCTEON " #define MODULE_PROC_FAMILY "OCTEON "
#elif defined CONFIG_CPU_XLR #elif defined CONFIG_CPU_XLR
......
...@@ -807,6 +807,7 @@ struct bridge_controller { ...@@ -807,6 +807,7 @@ struct bridge_controller {
unsigned long intr_addr; unsigned long intr_addr;
struct irq_domain *domain; struct irq_domain *domain;
unsigned int pci_int[8]; unsigned int pci_int[8];
u32 ioc3_sid[8];
nasid_t nasid; nasid_t nasid;
}; };
......
...@@ -96,9 +96,9 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud) ...@@ -96,9 +96,9 @@ static inline void pud_free(struct mm_struct *mm, pud_t *pud)
free_pages((unsigned long)pud, PUD_ORDER); free_pages((unsigned long)pud, PUD_ORDER);
} }
static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) static inline void p4d_populate(struct mm_struct *mm, p4d_t *p4d, pud_t *pud)
{ {
set_pgd(pgd, __pgd((unsigned long)pud)); set_p4d(p4d, __p4d((unsigned long)pud));
} }
#define __pud_free_tlb(tlb, x, addr) pud_free((tlb)->mm, x) #define __pud_free_tlb(tlb, x, addr) pud_free((tlb)->mm, x)
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <asm/cachectl.h> #include <asm/cachectl.h>
#include <asm/fixmap.h> #include <asm/fixmap.h>
#define __ARCH_USE_5LEVEL_HACK
#include <asm-generic/pgtable-nopmd.h> #include <asm-generic/pgtable-nopmd.h>
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
...@@ -196,14 +195,11 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) ...@@ -196,14 +195,11 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot)
#define pte_page(x) pfn_to_page(pte_pfn(x)) #define pte_page(x) pfn_to_page(pte_pfn(x))
#define __pgd_offset(address) pgd_index(address)
#define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
#define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
/* to find an entry in a kernel page-table-directory */ /* to find an entry in a kernel page-table-directory */
#define pgd_offset_k(address) pgd_offset(&init_mm, address) #define pgd_offset_k(address) pgd_offset(&init_mm, address)
#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
/* to find an entry in a page-table-directory */ /* to find an entry in a page-table-directory */
......
This diff is collapsed.
...@@ -643,17 +643,6 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, ...@@ -643,17 +643,6 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
#include <asm-generic/pgtable.h> #include <asm-generic/pgtable.h>
/*
* uncached accelerated TLB map for video memory access
*/
#ifdef CONFIG_CPU_SUPPORTS_UNCACHED_ACCELERATED
#define __HAVE_PHYS_MEM_ACCESS_PROT
struct file;
pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t vma_prot);
#endif
/* /*
* We provide our own get_unmapped area to cope with the virtual aliasing * We provide our own get_unmapped area to cope with the virtual aliasing
* constraints placed on us by the cache architecture. * constraints placed on us by the cache architecture.
......
This diff is collapsed.
...@@ -385,7 +385,7 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -385,7 +385,7 @@ unsigned long get_wchan(struct task_struct *p);
#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29]) #define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status) #define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
#ifdef CONFIG_CPU_LOONGSON3 #ifdef CONFIG_CPU_LOONGSON64
/* /*
* Loongson-3's SFB (Store-Fill-Buffer) may buffer writes indefinitely when a * Loongson-3's SFB (Store-Fill-Buffer) may buffer writes indefinitely when a
* tight read loop is executed, because reads take priority over writes & the * tight read loop is executed, because reads take priority over writes & the
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#if defined(CONFIG_SGI_IP27) #if defined(CONFIG_SGI_IP27)
#define HUB_NIC_ADDR(_cpuid) \ #define HUB_NIC_ADDR(_cpuid) \
REMOTE_HUB_ADDR(COMPACT_TO_NASID_NODEID(cpu_to_node(_cpuid)), \ REMOTE_HUB_ADDR(cpu_to_node(_cpuid), \
MD_MLAN_CTL) MD_MLAN_CTL)
#endif #endif
......
This diff is collapsed.
...@@ -60,9 +60,7 @@ typedef struct gda { ...@@ -60,9 +60,7 @@ typedef struct gda {
/* Pointer to a mask of nodes with copies /* Pointer to a mask of nodes with copies
* of the kernel. */ * of the kernel. */
char g_padding[56]; /* pad out to 128 bytes */ char g_padding[56]; /* pad out to 128 bytes */
nasid_t g_nasidtable[MAX_COMPACT_NODES]; /* NASID of each node, nasid_t g_nasidtable[MAX_NUMNODES]; /* NASID of each node */
* indexed by cnodeid.
*/
} gda_t; } gda_t;
#define GDA ((gda_t*) GDA_ADDR(get_nasid())) #define GDA ((gda_t*) GDA_ADDR(get_nasid()))
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment