diff options
| author | Mark Brown <broonie@kernel.org> | 2026-07-27 13:39:21 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-07-27 13:39:21 +0100 |
| commit | b4dc16cd645bf79415e1b3c27cbb72b0c18521ee (patch) | |
| tree | 7f6869f0e7f2542bd74c31d09a00adc58e577008 | |
| parent | fb7470573d99f4f525ec4926a9e907fc0e199d98 (diff) | |
| parent | 112264fb0bd0a7982b13da18cd3e289e2ab76eed (diff) | |
| download | linux-next-b4dc16cd645bf79415e1b3c27cbb72b0c18521ee.tar.gz linux-next-b4dc16cd645bf79415e1b3c27cbb72b0c18521ee.zip | |
Merge branch 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/bmc/linux.git
| -rw-r--r-- | arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-sanmiguel.dts | 14 | ||||
| -rw-r--r-- | arch/arm/boot/dts/aspeed/aspeed-bmc-inventec-transformers.dts | 480 | ||||
| -rw-r--r-- | arch/arm/boot/dts/aspeed/aspeed-bmc-opp-vesnin.dts | 2 | ||||
| -rw-r--r-- | arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 2 | ||||
| -rw-r--r-- | arch/arm/boot/dts/nuvoton/nuvoton-common-npcm7xx.dtsi | 9 | ||||
| -rw-r--r-- | arch/arm/mach-npcm/platsmp.c | 2 | ||||
| -rw-r--r-- | arch/arm64/boot/dts/nuvoton/nuvoton-common-npcm8xx.dtsi | 33 | ||||
| -rw-r--r-- | drivers/soc/aspeed/Makefile | 1 | ||||
| -rw-r--r-- | drivers/soc/aspeed/aspeed-lpc-snoop.c | 38 | ||||
| -rw-r--r-- | drivers/soc/aspeed/aspeed-uart-routing.c | 1 |
10 files changed, 298 insertions, 284 deletions
diff --git a/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-sanmiguel.dts b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-sanmiguel.dts index d7ed497d7227..3cc6e772cc8c 100644 --- a/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-sanmiguel.dts +++ b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-sanmiguel.dts @@ -450,7 +450,7 @@ pdb_ti_hsc1: power-monitor@11 { compatible = "ti,lm5066i"; reg = <0x11>; - shunt-resistor-micro-ohms = <763>; + shunt-resistor-micro-ohms = <1000>; }; pdb_mps_hsc2: power-monitor@12 { @@ -461,7 +461,7 @@ pdb_ti_hsc2: power-monitor@13 { compatible = "ti,lm5066i"; reg = <0x13>; - shunt-resistor-micro-ohms = <294>; + shunt-resistor-micro-ohms = <321>; }; pdb_mps_hsc3: power-monitor@14 { @@ -472,7 +472,7 @@ pdb_ti_hsc3: power-monitor@15 { compatible = "ti,lm5066i"; reg = <0x15>; - shunt-resistor-micro-ohms = <294>; + shunt-resistor-micro-ohms = <321>; }; pdb_mps_hsc4: power-monitor@16 { @@ -483,7 +483,7 @@ pdb_ti_hsc4: power-monitor@17 { compatible = "ti,lm5066i"; reg = <0x17>; - shunt-resistor-micro-ohms = <381>; + shunt-resistor-micro-ohms = <500>; }; pdb_ioexp_20: gpio@20 { @@ -578,8 +578,8 @@ reg = <0x20>; gpio-controller; #gpio-cells = <2>; - interrupt-parent = <&gpio1>; - interrupts = <ASPEED_GPIO(B, 6) IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&gpio0>; + interrupts = <ASPEED_GPIO(C, 6) IRQ_TYPE_LEVEL_LOW>; gpio-line-names = "", "", "", "", @@ -592,7 +592,7 @@ pwrgd-rmc-hog { gpio-hog; gpios = <14 GPIO_ACTIVE_LOW>; - output-low; + output-high; }; }; diff --git a/arch/arm/boot/dts/aspeed/aspeed-bmc-inventec-transformers.dts b/arch/arm/boot/dts/aspeed/aspeed-bmc-inventec-transformers.dts index c713cb7a6187..45ee0f2cc2bb 100644 --- a/arch/arm/boot/dts/aspeed/aspeed-bmc-inventec-transformers.dts +++ b/arch/arm/boot/dts/aspeed/aspeed-bmc-inventec-transformers.dts @@ -9,320 +9,320 @@ #include <dt-bindings/gpio/aspeed-gpio.h> / { - model = "TRANSFORMERS BMC"; - compatible = "inventec,transformer-bmc", "aspeed,ast2600"; - - aliases { - serial4 = &uart5; - }; - - chosen { - stdout-path = &uart5; - bootargs = "console=ttyS4,115200n8"; - }; - - memory@80000000 { - device_type = "memory"; - reg = <0x80000000 0x80000000>; - }; - - leds { - compatible = "gpio-leds"; - - // UID led - uid { - label = "UID_LED"; - gpios = <&gpio0 ASPEED_GPIO(X, 0) GPIO_ACTIVE_LOW>; - }; - - // Heart beat led - heartbeat { - label = "HB_LED"; - gpios = <&gpio0 ASPEED_GPIO(P, 7) GPIO_ACTIVE_LOW>; - }; - }; + model = "TRANSFORMERS BMC"; + compatible = "inventec,transformer-bmc", "aspeed,ast2600"; + + aliases { + serial4 = &uart5; + }; + + chosen { + stdout-path = &uart5; + bootargs = "console=ttyS4,115200n8"; + }; + + memory@80000000 { + device_type = "memory"; + reg = <0x80000000 0x80000000>; + }; + + leds { + compatible = "gpio-leds"; + + // UID led + uid { + label = "UID_LED"; + gpios = <&gpio0 ASPEED_GPIO(X, 0) GPIO_ACTIVE_LOW>; + }; + + // Heart beat led + heartbeat { + label = "HB_LED"; + gpios = <&gpio0 ASPEED_GPIO(P, 7) GPIO_ACTIVE_LOW>; + }; + }; }; &mdio0 { - status = "okay"; + status = "okay"; - ethphy0: ethernet-phy@0 { - compatible = "ethernet-phy-ieee802.3-c22"; - reg = <1>; - }; + ethphy0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; }; &mac3 { - status = "okay"; - phy-mode = "rgmii"; - phy-handle = <ðphy0>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_rgmii4_default>; + status = "okay"; + phy-mode = "rgmii"; + phy-handle = <ðphy0>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_rgmii4_default>; }; &fmc { - status = "okay"; - - flash@0 { - status = "okay"; - m25p,fast-read; - label = "bmc"; - spi-max-frequency = <33000000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; + status = "okay"; + + flash@0 { + status = "okay"; + m25p,fast-read; + label = "bmc"; + spi-max-frequency = <33000000>; + spi-tx-bus-width = <2>; + spi-rx-bus-width = <2>; #include "openbmc-flash-layout.dtsi" - }; - - flash@1 { - status = "okay"; - m25p,fast-read; - label = "bmc2"; - spi-max-frequency = <33000000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - }; + }; + + flash@1 { + status = "okay"; + m25p,fast-read; + label = "bmc2"; + spi-max-frequency = <33000000>; + spi-tx-bus-width = <2>; + spi-rx-bus-width = <2>; + }; }; &spi1 { - status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_spi1_default>; - - flash@0 { - status = "okay"; - m25p,fast-read; - label = "bios"; - spi-max-frequency = <33000000>; - spi-tx-bus-width = <1>; - spi-rx-bus-width = <1>; - }; + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_spi1_default>; + + flash@0 { + status = "okay"; + m25p,fast-read; + label = "bios"; + spi-max-frequency = <33000000>; + spi-tx-bus-width = <1>; + spi-rx-bus-width = <1>; + }; }; &wdt1 { - status = "okay"; + status = "okay"; }; &uart1 { - status = "okay"; + status = "okay"; }; &uart5 { - status = "okay"; + status = "okay"; }; &i2c0 { - status = "okay"; - - //Set bmc' slave address; - bmc_slave@10 { - compatible = "ipmb-dev"; - reg = <(0x10 | I2C_OWN_SLAVE_ADDRESS)>; - i2c-protocol; - }; + status = "okay"; + + //Set bmc' slave address; + bmc_slave@10 { + compatible = "ipmb-dev"; + reg = <(0x10 | I2C_OWN_SLAVE_ADDRESS)>; + i2c-protocol; + }; }; &i2c2 { - status = "okay"; + status = "okay"; }; &i2c3 { - // FRU AT24C512C-SSHM-T - status = "okay"; - eeprom@50 { - compatible = "atmel,24c512"; - reg = <0x50>; - pagesize = <128>; - }; + // FRU AT24C512C-SSHM-T + status = "okay"; + eeprom@50 { + compatible = "atmel,24c512"; + reg = <0x50>; + pagesize = <128>; + }; }; &i2c5 { - status = "okay"; + status = "okay"; }; &i2c6 { - status = "okay"; - - tmp75@49 { - compatible = "ti,tmp75"; - reg = <0x49>; - }; - - tmp75@4f { - compatible = "ti,tmp75"; - reg = <0x4f>; - }; - - tmp468@48 { - compatible = "ti,tmp468"; - reg = <0x48>; - }; + status = "okay"; + + tmp75@49 { + compatible = "ti,tmp75"; + reg = <0x49>; + }; + + tmp75@4f { + compatible = "ti,tmp75"; + reg = <0x4f>; + }; + + tmp468@48 { + compatible = "ti,tmp468"; + reg = <0x48>; + }; }; &i2c7 { - status = "okay"; - adm1278@40 { - compatible = "adi,adm1278"; - reg = <0x40>; - }; + status = "okay"; + adm1278@40 { + compatible = "adi,adm1278"; + reg = <0x40>; + }; }; &i2c8 { - // FRU AT24C512C-SSHM-T - status = "okay"; - - eeprom@51 { - compatible = "atmel,24c512"; - reg = <0x51>; - pagesize = <128>; - }; - - eeprom@53 { - compatible = "atmel,24c512"; - reg = <0x53>; - pagesize = <128>; - }; + // FRU AT24C512C-SSHM-T + status = "okay"; + + eeprom@51 { + compatible = "atmel,24c512"; + reg = <0x51>; + pagesize = <128>; + }; + + eeprom@53 { + compatible = "atmel,24c512"; + reg = <0x53>; + pagesize = <128>; + }; }; &i2c9 { - // M.2 - status = "okay"; + // M.2 + status = "okay"; }; &i2c10 { - // I2C EXPANDER - status = "okay"; - - i2c-mux@71 { - compatible = "nxp,pca9544"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x71>; - }; - - i2c-mux@73 { - compatible = "nxp,pca9544"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x73>; - }; + // I2C EXPANDER + status = "okay"; + + i2c-mux@71 { + compatible = "nxp,pca9544"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x71>; + }; + + i2c-mux@73 { + compatible = "nxp,pca9544"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x73>; + }; }; &i2c11 { - // I2C EXPANDER - status = "okay"; - - i2c-mux@70 { - compatible = "nxp,pca9544"; - #address-cells = <1>; - #size-cells = <0>; - reg = <0x70>; - - pcie_eeprom_riser1: i2c@0 { - #address-cells = <1>; - #size-cells = <0>; - reg = <0>; - - eeprom@55 { - compatible = "atmel,24c512"; - reg = <0x55>; - pagesize = <128>; - }; - }; - - pcie_eeprom_riser2: i2c@1 { - #address-cells = <1>; - #size-cells = <0>; - reg = <1>; - - eeprom@55 { - compatible = "atmel,24c512"; - reg = <0x55>; - pagesize = <128>; - }; - }; - - pcie_eeprom_riser3: i2c@2 { - #address-cells = <1>; - #size-cells = <0>; - reg = <2>; - - eeprom@55 { - compatible = "atmel,24c512"; - reg = <0x55>; - pagesize = <128>; - }; - }; - }; + // I2C EXPANDER + status = "okay"; + + i2c-mux@70 { + compatible = "nxp,pca9544"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x70>; + + pcie_eeprom_riser1: i2c@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + eeprom@55 { + compatible = "atmel,24c512"; + reg = <0x55>; + pagesize = <128>; + }; + }; + + pcie_eeprom_riser2: i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + eeprom@55 { + compatible = "atmel,24c512"; + reg = <0x55>; + pagesize = <128>; + }; + }; + + pcie_eeprom_riser3: i2c@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + + eeprom@55 { + compatible = "atmel,24c512"; + reg = <0x55>; + pagesize = <128>; + }; + }; + }; }; &i2c12 { - status = "okay"; + status = "okay"; - psu0:psu0@58 { - compatible = "pmbus"; - reg = <0x58>; - }; + psu0:psu0@58 { + compatible = "pmbus"; + reg = <0x58>; + }; }; &gpio0 { - status = "okay"; - gpio-line-names = - /*A0-A7*/ "","","","","","","","", - /*B0-B7*/ "presence-ps0","power-chassis-good","","","","","presence-ps1","", - /*C0-C7*/ "","","","","","","","", - /*D0-D7*/ "","","","","","","","", - /*E0-E7*/ "","","","","","","","", - /*F0-F7*/ "","","","","power-chassis-control","","","", - /*G0-G7*/ "","","jtag-mux","","","","","", - /*H0-H7*/ "","","","","reset-button","power-button","","", - /*I0-I7*/ "","","","","","","","", - /*J0-J7*/ "","","","","","","","", - /*K0-K7*/ "","","","","","","","", - /*L0-L7*/ "","","","","","","","", - /*M0-M7*/ "","","","","","","","", - /*N0-N7*/ "","","","","","","","", - /*O0-O7*/ "","","","","","","","", - /*P0-P7*/ "","","","tck-mux","","","","", - /*Q0-Q7*/ "","","","","","","","", - /*R0-R7*/ "","","","","","","","", - /*S0-S7*/ "","","","","","","","", - /*T0-T7*/ "","","","","","","","", - /*U0-U7*/ "","nmi-button","","","","","","", - /*V0-V7*/ "","","","","power-config-full-load","","","", - /*W0-W7*/ "","","","","","","","", - /*X0-X7*/ "","","","","","","","", - /*Y0-Y7*/ "","","","","","","","", - /*Z0-Z7*/ "","","","","","","","", - /*AA0-AA7*/ "","","","","","","","", - /*AB0-AB7*/ "","","","","","","","", - /*AC0-AC7*/ "","","","","","","",""; + status = "okay"; + gpio-line-names = + /*A0-A7*/ "","","","","","","","", + /*B0-B7*/ "presence-ps0","power-chassis-good","","","","","presence-ps1","", + /*C0-C7*/ "","","","","","","","", + /*D0-D7*/ "","","","","","","","", + /*E0-E7*/ "","","","","","","","", + /*F0-F7*/ "","","","","power-chassis-control","","","", + /*G0-G7*/ "","","jtag-mux","","","","","", + /*H0-H7*/ "","","","","reset-button","power-button","","", + /*I0-I7*/ "","","","","","","","", + /*J0-J7*/ "","","","","","","","", + /*K0-K7*/ "","","","","","","","", + /*L0-L7*/ "","","","","","","","", + /*M0-M7*/ "","","","","","","","", + /*N0-N7*/ "","","","","","","","", + /*O0-O7*/ "","","","","","","","", + /*P0-P7*/ "","","","tck-mux","","","","", + /*Q0-Q7*/ "","","","","","","","", + /*R0-R7*/ "","","","","","","","", + /*S0-S7*/ "","","","","","","","", + /*T0-T7*/ "","","","","","","","", + /*U0-U7*/ "","nmi-button","","","","","","", + /*V0-V7*/ "","","","","power-config-full-load","","","", + /*W0-W7*/ "","","","","","","","", + /*X0-X7*/ "","","","","","","","", + /*Y0-Y7*/ "","","","","","","","", + /*Z0-Z7*/ "","","","","","","","", + /*AA0-AA7*/ "","","","","","","","", + /*AB0-AB7*/ "","","","","","","","", + /*AC0-AC7*/ "","","","","","","",""; }; &lpc_snoop { - status = "okay"; - snoop-ports = <0x80>; + status = "okay"; + snoop-ports = <0x80>; }; &emmc_controller { - status = "okay"; + status = "okay"; }; &emmc { - status = "okay"; - non-removable; - max-frequency = <52000000>; - bus-width = <8>; + status = "okay"; + non-removable; + max-frequency = <52000000>; + bus-width = <8>; }; &vhub { - status = "okay"; - aspeed,vhub-downstream-ports = <7>; - aspeed,vhub-generic-endpoints = <21>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usb2ad_default>; + status = "okay"; + aspeed,vhub-downstream-ports = <7>; + aspeed,vhub-generic-endpoints = <21>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb2ad_default>; }; &rtc { - status = "okay"; + status = "okay"; }; diff --git a/arch/arm/boot/dts/aspeed/aspeed-bmc-opp-vesnin.dts b/arch/arm/boot/dts/aspeed/aspeed-bmc-opp-vesnin.dts index 8a7fb55ab489..5a3e8a3941d4 100644 --- a/arch/arm/boot/dts/aspeed/aspeed-bmc-opp-vesnin.dts +++ b/arch/arm/boot/dts/aspeed/aspeed-bmc-opp-vesnin.dts @@ -82,7 +82,7 @@ flash@0 { status = "okay"; m25p,fast-read; - label = "bmc"; + label = "bmc"; #include "openbmc-flash-layout.dtsi" }; diff --git a/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi index 56bb3b0444f7..edf4b74f5aba 100644 --- a/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed/aspeed-g6.dtsi @@ -517,7 +517,7 @@ clocks = <&syscon ASPEED_CLK_APB1>; clock-names = "PCLK"; status = "disabled"; - }; + }; uart1: serial@1e783000 { compatible = "ns16550a"; diff --git a/arch/arm/boot/dts/nuvoton/nuvoton-common-npcm7xx.dtsi b/arch/arm/boot/dts/nuvoton/nuvoton-common-npcm7xx.dtsi index ab3c3c5713ae..83cd10b47273 100644 --- a/arch/arm/boot/dts/nuvoton/nuvoton-common-npcm7xx.dtsi +++ b/arch/arm/boot/dts/nuvoton/nuvoton-common-npcm7xx.dtsi @@ -191,9 +191,8 @@ #address-cells = <1>; #size-cells = <0>; reg = <0xfb000000 0x1000>; - reg-names = "control", "memory"; + reg-names = "control"; clocks = <&clk NPCM7XX_CLK_SPI0>; - clock-names = "clk_spi0"; status = "disabled"; }; @@ -202,9 +201,8 @@ #address-cells = <1>; #size-cells = <0>; reg = <0xc0000000 0x1000>; - reg-names = "control", "memory"; + reg-names = "control"; clocks = <&clk NPCM7XX_CLK_SPI3>; - clock-names = "clk_spi3"; pinctrl-names = "default"; pinctrl-0 = <&spi3_pins>; status = "disabled"; @@ -215,9 +213,8 @@ #address-cells = <1>; #size-cells = <0>; reg = <0xfb001000 0x1000>; - reg-names = "control", "memory"; + reg-names = "control"; clocks = <&clk NPCM7XX_CLK_SPIX>; - clock-names = "clk_spix"; status = "disabled"; }; diff --git a/arch/arm/mach-npcm/platsmp.c b/arch/arm/mach-npcm/platsmp.c index 41891d3aa124..4c1fc9983746 100644 --- a/arch/arm/mach-npcm/platsmp.c +++ b/arch/arm/mach-npcm/platsmp.c @@ -32,6 +32,7 @@ static int npcm7xx_smp_boot_secondary(unsigned int cpu, goto out; } gcr_base = of_iomap(gcr_np, 0); + of_node_put(gcr_np); if (!gcr_base) { pr_err("could not iomap gcr"); ret = -ENOMEM; @@ -60,6 +61,7 @@ static void __init npcm7xx_smp_prepare_cpus(unsigned int max_cpus) return; } scu_base = of_iomap(scu_np, 0); + of_node_put(scu_np); if (!scu_base) { pr_err("could not iomap scu"); return; diff --git a/arch/arm64/boot/dts/nuvoton/nuvoton-common-npcm8xx.dtsi b/arch/arm64/boot/dts/nuvoton/nuvoton-common-npcm8xx.dtsi index c781190b42c5..545034ac11a0 100644 --- a/arch/arm64/boot/dts/nuvoton/nuvoton-common-npcm8xx.dtsi +++ b/arch/arm64/boot/dts/nuvoton/nuvoton-common-npcm8xx.dtsi @@ -59,23 +59,6 @@ ranges = <0x0 0x0 0xf0000000 0x00300000>, <0xfff00000 0x0 0xfff00000 0x00016000>; - peci: peci-controller@100000 { - compatible = "nuvoton,npcm845-peci"; - reg = <0x100000 0x1000>; - interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk NPCM8XX_CLK_APB3>; - cmd-timeout-ms = <1000>; - status = "disabled"; - }; - - timer0: timer@8000 { - compatible = "nuvoton,npcm845-timer"; - interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; - reg = <0x8000 0x1C>; - clocks = <&refclk>; - clock-names = "refclk"; - }; - serial0: serial@0 { compatible = "nuvoton,npcm845-uart", "nuvoton,npcm750-uart"; reg = <0x0 0x1000>; @@ -139,6 +122,13 @@ status = "disabled"; }; + timer0: timer@8000 { + compatible = "nuvoton,npcm845-timer"; + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; + reg = <0x8000 0x1C>; + clocks = <&refclk>; + }; + watchdog0: watchdog@801c { compatible = "nuvoton,npcm845-wdt", "nuvoton,npcm750-wdt"; interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>; @@ -162,6 +152,15 @@ status = "disabled"; clocks = <&refclk>; }; + + peci: peci-controller@100000 { + compatible = "nuvoton,npcm845-peci"; + reg = <0x100000 0x1000>; + interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk NPCM8XX_CLK_APB3>; + cmd-timeout-ms = <1000>; + status = "disabled"; + }; }; }; diff --git a/drivers/soc/aspeed/Makefile b/drivers/soc/aspeed/Makefile index b35d74592964..b5188dcde37a 100644 --- a/drivers/soc/aspeed/Makefile +++ b/drivers/soc/aspeed/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o obj-$(CONFIG_ASPEED_UART_ROUTING) += aspeed-uart-routing.o obj-$(CONFIG_ASPEED_P2A_CTRL) += aspeed-p2a-ctrl.o obj-$(CONFIG_ASPEED_SOCINFO) += aspeed-socinfo.o +CONTEXT_ANALYSIS_aspeed-lpc-snoop.o := y diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c index 28e491fffc7d..b09dca34099f 100644 --- a/drivers/soc/aspeed/aspeed-lpc-snoop.c +++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c @@ -11,6 +11,7 @@ */ #include <linux/bitops.h> +#include <linux/cleanup.h> #include <linux/clk.h> #include <linux/dev_printk.h> #include <linux/interrupt.h> @@ -74,7 +75,8 @@ struct aspeed_lpc_snoop_channel_cfg { struct aspeed_lpc_snoop_channel { const struct aspeed_lpc_snoop_channel_cfg *cfg; bool enabled; - struct kfifo fifo; + spinlock_t lock; + struct kfifo fifo __guarded_by(&lock); wait_queue_head_t wq; struct miscdevice miscdev; }; @@ -114,6 +116,7 @@ static ssize_t snoop_file_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct aspeed_lpc_snoop_channel *chan = snoop_file_to_chan(file); + u8 *buf __free(kfree) = NULL; unsigned int copied; int ret = 0; @@ -125,9 +128,16 @@ static ssize_t snoop_file_read(struct file *file, char __user *buffer, if (ret == -ERESTARTSYS) return -EINTR; } - ret = kfifo_to_user(&chan->fifo, buffer, count, &copied); - if (ret) - return ret; + + count = min_t(size_t, count, SNOOP_FIFO_SIZE); + + buf = kmalloc(count, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + copied = kfifo_out_spinlocked(&chan->fifo, buf, count, &chan->lock); + if (copied && copy_to_user(buffer, buf, copied)) + return -EFAULT; return copied; } @@ -151,11 +161,13 @@ static const struct file_operations snoop_fops = { /* Save a byte to a FIFO and discard the oldest byte if FIFO is full */ static void put_fifo_with_discard(struct aspeed_lpc_snoop_channel *chan, u8 val) { - if (!kfifo_initialized(&chan->fifo)) - return; - if (kfifo_is_full(&chan->fifo)) - kfifo_skip(&chan->fifo); - kfifo_put(&chan->fifo, val); + scoped_guard(spinlock, &chan->lock) { + if (!kfifo_initialized(&chan->fifo)) + return; + if (kfifo_is_full(&chan->fifo)) + kfifo_skip(&chan->fifo); + kfifo_put(&chan->fifo, val); + } wake_up_interruptible(&chan->wq); } @@ -239,9 +251,11 @@ static int aspeed_lpc_enable_snoop(struct device *dev, if (!channel->miscdev.name) return -ENOMEM; - rc = kfifo_alloc(&channel->fifo, SNOOP_FIFO_SIZE, GFP_KERNEL); - if (rc) - return rc; + scoped_guard(spinlock_init, &channel->lock) { + rc = kfifo_alloc(&channel->fifo, SNOOP_FIFO_SIZE, GFP_KERNEL); + if (rc) + return rc; + } rc = misc_register(&channel->miscdev); if (rc) diff --git a/drivers/soc/aspeed/aspeed-uart-routing.c b/drivers/soc/aspeed/aspeed-uart-routing.c index 0191e36e66e1..b4b521b5ddf1 100644 --- a/drivers/soc/aspeed/aspeed-uart-routing.c +++ b/drivers/soc/aspeed/aspeed-uart-routing.c @@ -582,6 +582,7 @@ static const struct of_device_id aspeed_uart_routing_table[] = { .data = &ast2600_uart_routing_attr_group }, { }, }; +MODULE_DEVICE_TABLE(of, aspeed_uart_routing_table); static struct platform_driver aspeed_uart_routing_driver = { .driver = { |
