Commit 49826a68 authored by Arnd Bergmann's avatar Arnd Bergmann

Merge tag 'mvebu-dt64-5.4-2' of git://git.infradead.org/linux-mvebu into arm/late

mvebu dt64 for 5.4 (part 2)

Add support for Turris Mox board (Armada 3720 SoC based)

* tag 'mvebu-dt64-5.4-2' of git://git.infradead.org/linux-mvebu: (53 commits)
  arm64: dts: marvell: add DTS for Turris Mox
  dt-bindings: marvell: document Turris Mox compatible
  arm64: dts: marvell: armada-37xx: add SPI CS1 pinctrl
  arm64: dts: marvell: Add cpu clock node on Armada 7K/8K
  arm64: dts: marvell: Convert 7k/8k usb-phy properties to phy-supply
  arm64: dts: marvell: Add 7k/8k PHYs in PCIe nodes
  arm64: dts: marvell: Add 7k/8k PHYs in USB3 nodes
  arm64: dts: marvell: Add 7k/8k per-port PHYs in SATA nodes
  arm64: dts: marvell: Add CP110 COMPHY clocks
  arm64: dts: marvell: armada-37xx: add mailbox node
  dt-bindings: gpio: Document GPIOs via Moxtet bus
  drivers: gpio: Add support for GPIOs over Moxtet bus
  bus: moxtet: Add sysfs and debugfs documentation
  dt-bindings: bus: Document moxtet bus binding
  bus: Add support for Moxtet bus
  reset: Add support for resets provided by SCMI
  firmware: arm_scmi: Add RESET protocol in SCMI v2.0
  dt-bindings: arm: Extend SCMI to support new reset protocol
  firmware: arm_scmi: Make use SCMI v2.0 fastchannel for performance protocol
  firmware: arm_scmi: Add discovery of SCMI v2.0 performance fastchannels
  ...

Link: https://lore.kernel.org/r/87h85two0r.fsf@FE-laptopSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents 65ab0dba 7109d817
What: /sys/kernel/debug/moxtet/input
Date: March 2019
KernelVersion: 5.3
Contact: Marek Behún <marek.behun@nic.cz>
Description: (R) Read input from the shift registers, in hexadecimal.
Returns N+1 bytes, where N is the number of Moxtet connected
modules. The first byte is from the CPU board itself.
Example: 101214
10: CPU board with SD card
12: 2 = PCIe module, 1 = IRQ not active
14: 4 = Peridot module, 1 = IRQ not active
What: /sys/kernel/debug/moxtet/output
Date: March 2019
KernelVersion: 5.3
Contact: Marek Behún <marek.behun@nic.cz>
Description: (RW) Read last written value to the shift registers, in
hexadecimal, or write values to the shift registers, also
in hexadecimal.
Example: 0102
01: 01 was last written, or is to be written, to the
first module's shift register
02: the same for second module
What: /sys/bus/moxtet/devices/moxtet-<name>.<addr>/module_description
Date: March 2019
KernelVersion: 5.3
Contact: Marek Behún <marek.behun@nic.cz>
Description: (R) Moxtet module description. Format: string
What: /sys/bus/moxtet/devices/moxtet-<name>.<addr>/module_id
Date: March 2019
KernelVersion: 5.3
Contact: Marek Behún <marek.behun@nic.cz>
Description: (R) Moxtet module ID. Format: %x
What: /sys/bus/moxtet/devices/moxtet-<name>.<addr>/module_name
Date: March 2019
KernelVersion: 5.3
Contact: Marek Behún <marek.behun@nic.cz>
Description: (R) Moxtet module name. Format: string
...@@ -73,6 +73,16 @@ Required properties: ...@@ -73,6 +73,16 @@ Required properties:
as used by the firmware. Refer to platform details as used by the firmware. Refer to platform details
for your implementation for the IDs to use. for your implementation for the IDs to use.
Reset signal bindings for the reset domains based on SCMI Message Protocol
------------------------------------------------------------
This binding for the SCMI reset domain providers uses the generic reset
signal binding[5].
Required properties:
- #reset-cells : Should be 1. Contains the reset domain ID value used
by SCMI commands.
SRAM and Shared Memory for SCMI SRAM and Shared Memory for SCMI
------------------------------- -------------------------------
...@@ -93,6 +103,7 @@ Required sub-node properties: ...@@ -93,6 +103,7 @@ Required sub-node properties:
[2] Documentation/devicetree/bindings/power/power_domain.txt [2] Documentation/devicetree/bindings/power/power_domain.txt
[3] Documentation/devicetree/bindings/thermal/thermal.txt [3] Documentation/devicetree/bindings/thermal/thermal.txt
[4] Documentation/devicetree/bindings/sram/sram.txt [4] Documentation/devicetree/bindings/sram/sram.txt
[5] Documentation/devicetree/bindings/reset/reset.txt
Example: Example:
...@@ -152,6 +163,11 @@ firmware { ...@@ -152,6 +163,11 @@ firmware {
reg = <0x15>; reg = <0x15>;
#thermal-sensor-cells = <1>; #thermal-sensor-cells = <1>;
}; };
scmi_reset: protocol@16 {
reg = <0x16>;
#reset-cells = <1>;
};
}; };
}; };
...@@ -166,6 +182,7 @@ hdlcd@7ff60000 { ...@@ -166,6 +182,7 @@ hdlcd@7ff60000 {
reg = <0 0x7ff60000 0 0x1000>; reg = <0 0x7ff60000 0 0x1000>;
clocks = <&scmi_clk 4>; clocks = <&scmi_clk 4>;
power-domains = <&scmi_devpd 1>; power-domains = <&scmi_devpd 1>;
resets = <&scmi_reset 10>;
}; };
thermal-zones { thermal-zones {
......
...@@ -48,3 +48,11 @@ avs: avs@11500 { ...@@ -48,3 +48,11 @@ avs: avs@11500 {
compatible = "marvell,armada-3700-avs", "syscon"; compatible = "marvell,armada-3700-avs", "syscon";
reg = <0x11500 0x40>; reg = <0x11500 0x40>;
} }
CZ.NIC's Turris Mox SOHO router Device Tree Bindings
----------------------------------------------------
Required root node property:
- compatible: must contain "cznic,turris-mox"
Turris Mox module status and configuration bus (over SPI)
Required properties:
- compatible : Should be "cznic,moxtet"
- #address-cells : Has to be 1
- #size-cells : Has to be 0
- spi-cpol : Required inverted clock polarity
- spi-cpha : Required shifted clock phase
- interrupts : Must contain reference to the shared interrupt line
- interrupt-controller : Required
- #interrupt-cells : Has to be 1
For other required and optional properties of SPI slave nodes please refer to
../spi/spi-bus.txt.
Required properties of subnodes:
- reg : Should be position on the Moxtet bus (how many Moxtet
modules are between this module and CPU module, so
either 0 or a positive integer)
The driver finds the devices connected to the bus by itself, but it may be
needed to reference some of them from other parts of the device tree. In that
case the devices can be defined as subnodes of the moxtet node.
Example:
moxtet@1 {
compatible = "cznic,moxtet";
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
spi-max-frequency = <10000000>;
spi-cpol;
spi-cpha;
interrupt-controller;
#interrupt-cells = <1>;
interrupt-parent = <&gpiosb>;
interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
moxtet_sfp: gpio@0 {
compatible = "cznic,moxtet-gpio";
gpio-controller;
#gpio-cells = <2>;
reg = <0>;
}
};
Turris Mox Moxtet GPIO expander via Moxtet bus
Required properties:
- compatible : Should be "cznic,moxtet-gpio".
- gpio-controller : Marks the device node as a GPIO controller.
- #gpio-cells : Should be two. For consumer use see gpio.txt.
Other properties are required for a Moxtet bus device, please refer to
Documentation/devicetree/bindings/bus/moxtet.txt.
Example:
moxtet_sfp: gpio@0 {
compatible = "cznic,moxtet-gpio";
gpio-controller;
#gpio-cells = <2>;
reg = <0>;
}
...@@ -8,6 +8,7 @@ Required properties: ...@@ -8,6 +8,7 @@ Required properties:
- compatible: - compatible:
- For i.MX7 SoCs should be "fsl,imx7d-src", "syscon" - For i.MX7 SoCs should be "fsl,imx7d-src", "syscon"
- For i.MX8MQ SoCs should be "fsl,imx8mq-src", "syscon" - For i.MX8MQ SoCs should be "fsl,imx8mq-src", "syscon"
- For i.MX8MM SoCs should be "fsl,imx8mm-src", "fsl,imx8mq-src", "syscon"
- reg: should be register base and length as documented in the - reg: should be register base and length as documented in the
datasheet datasheet
- interrupts: Should contain SRC interrupt - interrupts: Should contain SRC interrupt
...@@ -46,5 +47,6 @@ Example: ...@@ -46,5 +47,6 @@ Example:
For list of all valid reset indices see For list of all valid reset indices see
<dt-bindings/reset/imx7-reset.h> for i.MX7 and <dt-bindings/reset/imx7-reset.h> for i.MX7,
<dt-bindings/reset/imx8mq-reset.h> for i.MX8MQ <dt-bindings/reset/imx8mq-reset.h> for i.MX8MQ and
<dt-bindings/reset/imx8mq-reset.h> for i.MX8MM
Synopsys DesignWare Reset controller
=======================================
Please also refer to reset.txt in this directory for common reset
controller binding usage.
Required properties:
- compatible: should be one of the following.
"snps,dw-high-reset" - for active high configuration
"snps,dw-low-reset" - for active low configuration
- reg: physical base address of the controller and length of memory mapped
region.
- #reset-cells: must be 1.
example:
dw_rst_1: reset-controller@0000 {
compatible = "snps,dw-high-reset";
reg = <0x0000 0x4>;
#reset-cells = <1>;
};
dw_rst_2: reset-controller@1000 {i
compatible = "snps,dw-low-reset";
reg = <0x1000 0x8>;
#reset-cells = <1>;
};
...@@ -18,7 +18,8 @@ Required properties: ...@@ -18,7 +18,8 @@ Required properties:
- reg : offset and length of the device registers. - reg : offset and length of the device registers.
- bus-frequency : the clock frequency for QUICC Engine. - bus-frequency : the clock frequency for QUICC Engine.
- fsl,qe-num-riscs: define how many RISC engines the QE has. - fsl,qe-num-riscs: define how many RISC engines the QE has.
- fsl,qe-num-snums: define how many serial number(SNUM) the QE can use for the - fsl,qe-snums: This property has to be specified as '/bits/ 8' value,
defining the array of serial number (SNUM) values for the virtual
threads. threads.
Optional properties: Optional properties:
...@@ -34,6 +35,11 @@ Recommended properties ...@@ -34,6 +35,11 @@ Recommended properties
- brg-frequency : the internal clock source frequency for baud-rate - brg-frequency : the internal clock source frequency for baud-rate
generators in Hz. generators in Hz.
Deprecated properties
- fsl,qe-num-snums: define how many serial number(SNUM) the QE can use
for the threads. Use fsl,qe-snums instead to not only specify the
number of snums, but also their values.
Example: Example:
qe@e0100000 { qe@e0100000 {
#address-cells = <1>; #address-cells = <1>;
...@@ -44,6 +50,11 @@ Example: ...@@ -44,6 +50,11 @@ Example:
reg = <e0100000 480>; reg = <e0100000 480>;
brg-frequency = <0>; brg-frequency = <0>;
bus-frequency = <179A7B00>; bus-frequency = <179A7B00>;
fsl,qe-snums = /bits/ 8 <
0x04 0x05 0x0C 0x0D 0x14 0x15 0x1C 0x1D
0x24 0x25 0x2C 0x2D 0x34 0x35 0x88 0x89
0x98 0x99 0xA8 0xA9 0xB8 0xB9 0xC8 0xC9
0xD8 0xD9 0xE8 0xE9>;
} }
* Multi-User RAM (MURAM) * Multi-User RAM (MURAM)
......
...@@ -1626,6 +1626,18 @@ F: drivers/clocksource/timer-atlas7.c ...@@ -1626,6 +1626,18 @@ F: drivers/clocksource/timer-atlas7.c
N: [^a-z]sirf N: [^a-z]sirf
X: drivers/gnss X: drivers/gnss
ARM/CZ.NIC TURRIS MOX SUPPORT
M: Marek Behun <marek.behun@nic.cz>
W: http://mox.turris.cz
S: Maintained
F: Documentation/ABI/testing/debugfs-moxtet
F: Documentation/ABI/testing/sysfs-bus-moxtet-devices
F: Documentation/devicetree/bindings/bus/moxtet.txt
F: Documentation/devicetree/bindings/gpio/gpio-moxtet.txt
F: include/linux/moxtet.h
F: drivers/bus/moxtet.c
F: drivers/gpio/gpio-moxtet.c
ARM/EBSA110 MACHINE SUPPORT ARM/EBSA110 MACHINE SUPPORT
M: Russell King <linux@armlinux.org.uk> M: Russell King <linux@armlinux.org.uk>
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
...@@ -15577,6 +15589,7 @@ F: drivers/clk/clk-sc[mp]i.c ...@@ -15577,6 +15589,7 @@ F: drivers/clk/clk-sc[mp]i.c
F: drivers/cpufreq/sc[mp]i-cpufreq.c F: drivers/cpufreq/sc[mp]i-cpufreq.c
F: drivers/firmware/arm_scpi.c F: drivers/firmware/arm_scpi.c
F: drivers/firmware/arm_scmi/ F: drivers/firmware/arm_scmi/
F: drivers/reset/reset-scmi.c
F: include/linux/sc[mp]i_protocol.h F: include/linux/sc[mp]i_protocol.h
SYSTEM RESET/SHUTDOWN DRIVERS SYSTEM RESET/SHUTDOWN DRIVERS
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Mvebu SoC Family # Mvebu SoC Family
dtb-$(CONFIG_ARCH_MVEBU) += armada-3720-db.dtb dtb-$(CONFIG_ARCH_MVEBU) += armada-3720-db.dtb
dtb-$(CONFIG_ARCH_MVEBU) += armada-3720-espressobin.dtb dtb-$(CONFIG_ARCH_MVEBU) += armada-3720-espressobin.dtb
dtb-$(CONFIG_ARCH_MVEBU) += armada-3720-turris-mox.dtb
dtb-$(CONFIG_ARCH_MVEBU) += armada-3720-uDPU.dtb dtb-$(CONFIG_ARCH_MVEBU) += armada-3720-uDPU.dtb
dtb-$(CONFIG_ARCH_MVEBU) += armada-7040-db.dtb dtb-$(CONFIG_ARCH_MVEBU) += armada-7040-db.dtb
dtb-$(CONFIG_ARCH_MVEBU) += armada-8040-clearfog-gt-8k.dtb dtb-$(CONFIG_ARCH_MVEBU) += armada-8040-clearfog-gt-8k.dtb
......
This diff is collapsed.
...@@ -215,6 +215,11 @@ spi_quad_pins: spi-quad-pins { ...@@ -215,6 +215,11 @@ spi_quad_pins: spi-quad-pins {
function = "spi"; function = "spi";
}; };
spi_cs1_pins: spi-cs1-pins {
groups = "spi_cs1";
function = "spi";
};
i2c1_pins: i2c1-pins { i2c1_pins: i2c1-pins {
groups = "i2c1"; groups = "i2c1";
function = "i2c"; function = "i2c";
...@@ -419,6 +424,13 @@ crypto: crypto@90000 { ...@@ -419,6 +424,13 @@ crypto: crypto@90000 {
clocks = <&nb_periph_clk 15>; clocks = <&nb_periph_clk 15>;
}; };
rwtm: mailbox@b0000 {
compatible = "marvell,armada-3700-rwtm-mailbox";
reg = <0xb0000 0x100>;
interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
#mbox-cells = <1>;
};
sdhci1: sdhci@d0000 { sdhci1: sdhci@d0000 {
compatible = "marvell,armada-3700-sdhci", compatible = "marvell,armada-3700-sdhci",
"marvell,sdhci-xenon"; "marvell,sdhci-xenon";
......
...@@ -73,16 +73,6 @@ cp0_reg_usb3_1_vbus: cp0-usb3-1-vbus { ...@@ -73,16 +73,6 @@ cp0_reg_usb3_1_vbus: cp0-usb3-1-vbus {
gpio = <&expander0 1 GPIO_ACTIVE_HIGH>; gpio = <&expander0 1 GPIO_ACTIVE_HIGH>;
vin-supply = <&cp0_exp_usb3_1_current_regulator>; vin-supply = <&cp0_exp_usb3_1_current_regulator>;
}; };
cp0_usb3_0_phy: cp0-usb3-0-phy {
compatible = "usb-nop-xceiv";
vcc-supply = <&cp0_reg_usb3_0_vbus>;
};
cp0_usb3_1_phy: cp0-usb3-1-phy {
compatible = "usb-nop-xceiv";
vcc-supply = <&cp0_reg_usb3_1_vbus>;
};
}; };
&i2c0 { &i2c0 {
...@@ -124,6 +114,8 @@ &uart0 { ...@@ -124,6 +114,8 @@ &uart0 {
&cp0_pcie2 { &cp0_pcie2 {
status = "okay"; status = "okay";
phys = <&cp0_comphy5 2>;
phy-names = "cp0-pcie2-x1-phy";
}; };
&cp0_i2c0 { &cp0_i2c0 {
...@@ -219,15 +211,36 @@ partition@400000 { ...@@ -219,15 +211,36 @@ partition@400000 {
&cp0_sata0 { &cp0_sata0 {
status = "okay"; status = "okay";
sata-port@1 {
phys = <&cp0_comphy3 1>;
phy-names = "cp0-sata0-1-phy";
};
};
&cp0_comphy1 {
cp0_usbh0_con: connector {
compatible = "usb-a-connector";
phy-supply = <&cp0_reg_usb3_0_vbus>;
};
}; };
&cp0_usb3_0 { &cp0_usb3_0 {
usb-phy = <&cp0_usb3_0_phy>; phys = <&cp0_comphy1 0>;
phy-names = "cp0-usb3h0-comphy";
status = "okay"; status = "okay";
}; };
&cp0_comphy4 {
cp0_usbh1_con: connector {
compatible = "usb-a-connector";
phy-supply = <&cp0_reg_usb3_1_vbus>;
};
};
&cp0_usb3_1 { &cp0_usb3_1 {
usb-phy = <&cp0_usb3_1_phy>; phys = <&cp0_comphy4 1>;
phy-names = "cp0-usb3h1-comphy";
status = "okay"; status = "okay";
}; };
......
...@@ -51,11 +51,6 @@ v_5v0_usb3_hst_vbus: regulator-usb3-vbus0 { ...@@ -51,11 +51,6 @@ v_5v0_usb3_hst_vbus: regulator-usb3-vbus0 {
status = "okay"; status = "okay";
}; };
usb3h0_phy: usb3_phy0 {
compatible = "usb-nop-xceiv";
vcc-supply = <&v_5v0_usb3_hst_vbus>;
};
sfp_cp0_eth0: sfp-cp0-eth0 { sfp_cp0_eth0: sfp-cp0-eth0 {
compatible = "sff,sfp"; compatible = "sff,sfp";
i2c-bus = <&cp0_i2c1>; i2c-bus = <&cp0_i2c1>;
...@@ -243,6 +238,8 @@ &cp0_pcie0 { ...@@ -243,6 +238,8 @@ &cp0_pcie0 {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&cp0_pci0_reset_pins &cp0_wlan_disable_pins>; pinctrl-0 = <&cp0_pci0_reset_pins &cp0_wlan_disable_pins>;
reset-gpios = <&cp0_gpio2 0 GPIO_ACTIVE_LOW>; reset-gpios = <&cp0_gpio2 0 GPIO_ACTIVE_LOW>;
phys = <&cp0_comphy0 0>;
phy-names = "cp0-pcie0-x1-phy";
status = "okay"; status = "okay";
}; };
...@@ -348,6 +345,11 @@ cp1_wps_button_pins: wps-button-pins { ...@@ -348,6 +345,11 @@ cp1_wps_button_pins: wps-button-pins {
&cp1_sata0 { &cp1_sata0 {
pinctrl-0 = <&cp0_pci1_reset_pins>; pinctrl-0 = <&cp0_pci1_reset_pins>;
status = "okay"; status = "okay";
sata-port@1 {
phys = <&cp1_comphy0 1>;
phy-names = "cp1-sata0-1-phy";
};
}; };
&cp1_mdio { &cp1_mdio {
...@@ -467,7 +469,15 @@ spi-flash@0 { ...@@ -467,7 +469,15 @@ spi-flash@0 {
}; };
}; };
&cp1_comphy2 {
cp1_usbh0_con: connector {
compatible = "usb-a-connector";
phy-supply = <&v_5v0_usb3_hst_vbus>;
};
};
&cp1_usb3_0 { &cp1_usb3_0 {
usb-phy = <&usb3h0_phy>; phys = <&cp1_comphy2 0>;
phy-names = "cp1-usb3h0-comphy";
status = "okay"; status = "okay";
}; };
...@@ -54,11 +54,6 @@ cp0_usb3_0_phy: cp0-usb3-0-phy { ...@@ -54,11 +54,6 @@ cp0_usb3_0_phy: cp0-usb3-0-phy {
vcc-supply = <&cp0_reg_usb3_0_vbus>; vcc-supply = <&cp0_reg_usb3_0_vbus>;
}; };
cp0_usb3_1_phy: cp0-usb3-1-phy {
compatible = "usb-nop-xceiv";
vcc-supply = <&cp0_reg_usb3_1_vbus>;
};
cp1_reg_usb3_0_vbus: cp1-usb3-0-vbus { cp1_reg_usb3_0_vbus: cp1-usb3-0-vbus {
compatible = "regulator-fixed"; compatible = "regulator-fixed";
regulator-name = "cp1-usb3h0-vbus"; regulator-name = "cp1-usb3h0-vbus";
...@@ -108,11 +103,15 @@ &uart0 { ...@@ -108,11 +103,15 @@ &uart0 {
/* CON6 on CP0 expansion */ /* CON6 on CP0 expansion */
&cp0_pcie0 { &cp0_pcie0 {
phys = <&cp0_comphy0 0>;
phy-names = "cp0-pcie0-x1-phy";
status = "okay"; status = "okay";
}; };
/* CON5 on CP0 expansion */ /* CON5 on CP0 expansion */
&cp0_pcie2 { &cp0_pcie2 {
phys = <&cp0_comphy5 2>;
phy-names = "cp0-pcie2-x1-phy";
status = "okay"; status = "okay";
}; };
...@@ -143,6 +142,15 @@ expander1: pca9555@25 { ...@@ -143,6 +142,15 @@ expander1: pca9555@25 {
/* CON4 on CP0 expansion */ /* CON4 on CP0 expansion */
&cp0_sata0 { &cp0_sata0 {
status = "okay"; status = "okay";
sata-port@0 {
phys = <&cp0_comphy1 0>;
phy-names = "cp0-sata0-0-phy";
};
sata-port@1 {
phys = <&cp0_comphy3 1>;
phy-names = "cp0-sata0-1-phy";
};
}; };
/* CON9 on CP0 expansion */ /* CON9 on CP0 expansion */
...@@ -151,9 +159,17 @@ &cp0_usb3_0 { ...@@ -151,9 +159,17 @@ &cp0_usb3_0 {
status = "okay"; status = "okay";
}; };
&cp0_comphy4 {
cp0_usbh1_con: connector {
compatible = "usb-a-connector";
phy-supply = <&cp0_reg_usb3_1_vbus>;
};
};
/* CON10 on CP0 expansion */ /* CON10 on CP0 expansion */
&cp0_usb3_1 { &cp0_usb3_1 {
usb-phy = <&cp0_usb3_1_phy>; phys = <&cp0_comphy4 1>;
phy-names = "cp0-usb3h1-comphy";
status = "okay"; status = "okay";
}; };
...@@ -187,16 +203,22 @@ &cp0_eth2 { ...@@ -187,16 +203,22 @@ &cp0_eth2 {
/* CON6 on CP1 expansion */ /* CON6 on CP1 expansion */
&cp1_pcie0 { &cp1_pcie0 {
phys = <&cp1_comphy0 0>;
phy-names = "cp1-pcie0-x1-phy";
status = "okay"; status = "okay";
}; };
/* CON7 on CP1 expansion */ /* CON7 on CP1 expansion */
&cp1_pcie1 { &cp1_pcie1 {
phys = <&cp1_comphy4 1>;
phy-names = "cp1-pcie1-x1-phy";
status = "okay"; status = "okay";
}; };
/* CON5 on CP1 expansion */ /* CON5 on CP1 expansion */
&cp1_pcie2 { &cp1_pcie2 {
phys = <&cp1_comphy5 2>;
phy-names = "cp1-pcie2-x1-phy";
status = "okay"; status = "okay";
}; };
...@@ -273,6 +295,15 @@ partition@1000000 { ...@@ -273,6 +295,15 @@ partition@1000000 {
/* CON4 on CP1 expansion */ /* CON4 on CP1 expansion */
&cp1_sata0 { &cp1_sata0 {
status = "okay"; status = "okay";
sata-port@0 {
phys = <&cp1_comphy1 0>;
phy-names = "cp1-sata0-0-phy";
};
sata-port@1 {
phys = <&cp1_comphy3 1>;
phy-names = "cp1-sata0-1-phy";
};
}; };
/* CON9 on CP1 expansion */ /* CON9 on CP1 expansion */
......
...@@ -61,11 +61,6 @@ v_5v0_usb3_hst_vbus: regulator-usb3-vbus0 { ...@@ -61,11 +61,6 @@ v_5v0_usb3_hst_vbus: regulator-usb3-vbus0 {
status = "okay"; status = "okay";
}; };
usb3h0_phy: usb3_phy0 {
compatible = "usb-nop-xceiv";
vcc-supply = <&v_5v0_usb3_hst_vbus>;
};
sfp_eth0: sfp-eth0 { sfp_eth0: sfp-eth0 {
/* CON15,16 - CPM lane 4 */ /* CON15,16 - CPM lane 4 */
compatible = "sff,sfp"; compatible = "sff,sfp";
...@@ -186,6 +181,10 @@ &cp0_pcie0 { ...@@ -186,6 +181,10 @@ &cp0_pcie0 {
reset-gpios = <&cp0_gpio2 20 GPIO_ACTIVE_LOW>; reset-gpios = <&cp0_gpio2 20 GPIO_ACTIVE_LOW>;
ranges = <0x81000000 0x0 0xf9010000 0x0 0xf9010000 0x0 0x10000 ranges = <0x81000000 0x0 0xf9010000 0x0 0xf9010000 0x0 0x10000
0x82000000 0x0 0xc0000000 0x0 0xc0000000 0x0 0x20000000>; 0x82000000 0x0 0xc0000000 0x0 0xc0000000 0x0 0x20000000>;
phys = <&cp0_comphy0 0>, <&cp0_comphy1 0>,
<&cp0_comphy2 0>, <&cp0_comphy3 0>;
phy-names = "cp0-pcie0-x4-lane0-phy", "cp0-pcie0-x4-lane1-phy",
"cp0-pcie0-x4-lane2-phy", "cp0-pcie0-x4-lane3-phy";
status = "okay"; status = "okay";
}; };
...@@ -239,8 +238,13 @@ &cp0_eth0 { ...@@ -239,8 +238,13 @@ &cp0_eth0 {
}; };
&cp0_sata0 { &cp0_sata0 {
/* CPM Lane 0 - U29 */
status = "okay"; status = "okay";
/* CPM Lane 5 - U29 */
sata-port@1 {
phys = <&cp0_comphy5 1>;
phy-names = "cp0-sata0-1-phy";
};
}; };
&cp0_sdhci0 { &cp0_sdhci0 {
...@@ -324,9 +328,19 @@ &cp1_uart0 { ...@@ -324,9 +328,19 @@ &cp1_uart0 {
}; };
&cp1_sata0 { &cp1_sata0 {
status = "okay";
/* CPS Lane 1 - U32 */ /* CPS Lane 1 - U32 */
sata-port@0 {
phys = <&cp1_comphy1 0>;
phy-names = "cp1-sata0-0-phy";
};
/* CPS Lane 3 - U31 */ /* CPS Lane 3 - U31 */
status = "okay"; sata-port@1 {
phys = <&cp1_comphy3 1>;
phy-names = "cp1-sata0-1-phy";
};
}; };
&cp1_spi1 { &cp1_spi1 {
...@@ -341,8 +355,16 @@ spi-flash@0 { ...@@ -341,8 +355,16 @@ spi-flash@0 {
}; };
}; };
&cp1_comphy2 {
cp1_usbh0_con: connector {
compatible = "usb-a-connector";
phy-supply = <&v_5v0_usb3_hst_vbus>;
};
};
&cp1_usb3_0 { &cp1_usb3_0 {
/* CPS Lane 2 - CON7 */ /* CPS Lane 2 - CON7 */
usb-phy = <&usb3h0_phy>; phys = <&cp1_comphy2 0>;
phy-names = "cp1-usb3h0-comphy";
status = "okay"; status = "okay";
}; };
...@@ -21,6 +21,7 @@ cpu0: cpu@0 { ...@@ -21,6 +21,7 @@ cpu0: cpu@0 {
reg = <0x000>; reg = <0x000>;
enable-method = "psci"; enable-method = "psci";
#cooling-cells = <2>; #cooling-cells = <2>;
clocks = <&cpu_clk 0>;
}; };
cpu1: cpu@1 { cpu1: cpu@1 {
device_type = "cpu"; device_type = "cpu";
...@@ -28,6 +29,7 @@ cpu1: cpu@1 { ...@@ -28,6 +29,7 @@ cpu1: cpu@1 {
reg = <0x001>; reg = <0x001>;
enable-method = "psci"; enable-method = "psci";
#cooling-cells = <2>; #cooling-cells = <2>;
clocks = <&cpu_clk 0>;
}; };
cpu2: cpu@100 { cpu2: cpu@100 {
device_type = "cpu"; device_type = "cpu";
...@@ -35,6 +37,7 @@ cpu2: cpu@100 { ...@@ -35,6 +37,7 @@ cpu2: cpu@100 {
reg = <0x100>; reg = <0x100>;
enable-method = "psci"; enable-method = "psci";
#cooling-cells = <2>; #cooling-cells = <2>;
clocks = <&cpu_clk 1>;
}; };
cpu3: cpu@101 { cpu3: cpu@101 {
device_type = "cpu"; device_type = "cpu";
...@@ -42,7 +45,7 @@ cpu3: cpu@101 { ...@@ -42,7 +45,7 @@ cpu3: cpu@101 {
reg = <0x101>; reg = <0x101>;
enable-method = "psci"; enable-method = "psci";
#cooling-cells = <2>; #cooling-cells = <2>;
clocks = <&cpu_clk 1>;
}; };
}; };
}; };
...@@ -280,6 +280,13 @@ ap_syscon1: system-controller@6f8000 { ...@@ -280,6 +280,13 @@ ap_syscon1: system-controller@6f8000 {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
cpu_clk: clock-cpu@278 {
compatible = "marvell,ap806-cpu-clock";
clocks = <&ap_clk 0>, <&ap_clk 1>;
#clock-cells = <1>;
reg = <0x278 0xa30>;
};
ap_thermal: thermal-sensor@80 { ap_thermal: thermal-sensor@80 {
compatible = "marvell,armada-ap806-thermal"; compatible = "marvell,armada-ap806-thermal";
reg = <0x80 0x10>; reg = <0x80 0x10>;
......
...@@ -133,6 +133,9 @@ CP110_LABEL(comphy): phy@120000 { ...@@ -133,6 +133,9 @@ CP110_LABEL(comphy): phy@120000 {
compatible = "marvell,comphy-cp110"; compatible = "marvell,comphy-cp110";
reg = <0x120000 0x6000>; reg = <0x120000 0x6000>;
marvell,system-controller = <&CP110_LABEL(syscon0)>; marvell,system-controller = <&CP110_LABEL(syscon0)>;
clocks = <&CP110_LABEL(clk) 1 5>, <&CP110_LABEL(clk) 1 6>,
<&CP110_LABEL(clk) 1 18>;
clock-names = "mg_clk", "mg_core_clk", "axi_clk";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
...@@ -306,7 +309,17 @@ CP110_LABEL(sata0): sata@540000 { ...@@ -306,7 +309,17 @@ CP110_LABEL(sata0): sata@540000 {
interrupts = <107 IRQ_TYPE_LEVEL_HIGH>; interrupts = <107 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&CP110_LABEL(clk) 1 15>, clocks = <&CP110_LABEL(clk) 1 15>,
<&CP110_LABEL(clk) 1 16>; <&CP110_LABEL(clk) 1 16>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled"; status = "disabled";
sata-port@0 {
reg = <0>;
};
sata-port@1 {
reg = <1>;
};
}; };
CP110_LABEL(xor0): xor@6a0000 { CP110_LABEL(xor0): xor@6a0000 {
......
...@@ -29,6 +29,16 @@ config BRCMSTB_GISB_ARB ...@@ -29,6 +29,16 @@ config BRCMSTB_GISB_ARB
arbiter. This driver provides timeout and target abort error handling arbiter. This driver provides timeout and target abort error handling
and internal bus master decoding. and internal bus master decoding.
config MOXTET
tristate "CZ.NIC Turris Mox module configuration bus"
depends on SPI_MASTER && OF
help
Say yes here to add support for the module configuration bus found
on CZ.NIC's Turris Mox. This is needed for the ability to discover
the order in which the modules are connected and to get/set some of
their settings. For example the GPIOs on Mox SFP module are
configured through this bus.
config HISILICON_LPC config HISILICON_LPC
bool "Support for ISA I/O space on HiSilicon Hip06/7" bool "Support for ISA I/O space on HiSilicon Hip06/7"
depends on ARM64 && (ARCH_HISI || COMPILE_TEST) depends on ARM64 && (ARCH_HISI || COMPILE_TEST)
......
...@@ -8,6 +8,7 @@ obj-$(CONFIG_ARM_CCI) += arm-cci.o ...@@ -8,6 +8,7 @@ obj-$(CONFIG_ARM_CCI) += arm-cci.o
obj-$(CONFIG_HISILICON_LPC) += hisi_lpc.o obj-$(CONFIG_HISILICON_LPC) += hisi_lpc.o
obj-$(CONFIG_BRCMSTB_GISB_ARB) += brcmstb_gisb.o obj-$(CONFIG_BRCMSTB_GISB_ARB) += brcmstb_gisb.o
obj-$(CONFIG_MOXTET) += moxtet.o
# DPAA2 fsl-mc bus # DPAA2 fsl-mc bus
obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/ obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/
......
This diff is collapsed.
...@@ -69,7 +69,7 @@ static int scmi_clk_set_rate(struct clk_hw *hw, unsigned long rate, ...@@ -69,7 +69,7 @@ static int scmi_clk_set_rate(struct clk_hw *hw, unsigned long rate,
{ {
struct scmi_clk *clk = to_scmi_clk(hw); struct scmi_clk *clk = to_scmi_clk(hw);
return clk->handle->clk_ops->rate_set(clk->handle, clk->id, 0, rate); return clk->handle->clk_ops->rate_set(clk->handle, clk->id, rate);
} }
static int scmi_clk_enable(struct clk_hw *hw) static int scmi_clk_enable(struct clk_hw *hw)
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
obj-y = scmi-bus.o scmi-driver.o scmi-protocols.o obj-y = scmi-bus.o scmi-driver.o scmi-protocols.o
scmi-bus-y = bus.o scmi-bus-y = bus.o
scmi-driver-y = driver.o scmi-driver-y = driver.o
scmi-protocols-y = base.o clock.o perf.o power.o sensors.o scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o
obj-$(CONFIG_ARM_SCMI_POWER_DOMAIN) += scmi_pm_domain.o obj-$(CONFIG_ARM_SCMI_POWER_DOMAIN) += scmi_pm_domain.o
...@@ -204,7 +204,7 @@ static int scmi_base_discover_agent_get(const struct scmi_handle *handle, ...@@ -204,7 +204,7 @@ static int scmi_base_discover_agent_get(const struct scmi_handle *handle,
if (ret) if (ret)
return ret; return ret;
*(__le32 *)t->tx.buf = cpu_to_le32(id); put_unaligned_le32(id, t->tx.buf);
ret = scmi_do_xfer(handle, t); ret = scmi_do_xfer(handle, t);
if (!ret) if (!ret)
......
...@@ -56,7 +56,7 @@ struct scmi_msg_resp_clock_describe_rates { ...@@ -56,7 +56,7 @@ struct scmi_msg_resp_clock_describe_rates {
struct scmi_clock_set_rate { struct scmi_clock_set_rate {
__le32 flags; __le32 flags;
#define CLOCK_SET_ASYNC BIT(0) #define CLOCK_SET_ASYNC BIT(0)
#define CLOCK_SET_DELAYED BIT(1) #define CLOCK_SET_IGNORE_RESP BIT(1)
#define CLOCK_SET_ROUND_UP BIT(2) #define CLOCK_SET_ROUND_UP BIT(2)
#define CLOCK_SET_ROUND_AUTO BIT(3) #define CLOCK_SET_ROUND_AUTO BIT(3)
__le32 id; __le32 id;
...@@ -67,6 +67,7 @@ struct scmi_clock_set_rate { ...@@ -67,6 +67,7 @@ struct scmi_clock_set_rate {
struct clock_info { struct clock_info {
int num_clocks; int num_clocks;
int max_async_req; int max_async_req;
atomic_t cur_async_req;
struct scmi_clock_info *clk; struct scmi_clock_info *clk;
}; };
...@@ -106,7 +107,7 @@ static int scmi_clock_attributes_get(const struct scmi_handle *handle, ...@@ -106,7 +107,7 @@ static int scmi_clock_attributes_get(const struct scmi_handle *handle,
if (ret) if (ret)
return ret; return ret;
*(__le32 *)t->tx.buf = cpu_to_le32(clk_id); put_unaligned_le32(clk_id, t->tx.buf);
attr = t->rx.buf; attr = t->rx.buf;
ret = scmi_do_xfer(handle, t); ret = scmi_do_xfer(handle, t);
...@@ -203,39 +204,47 @@ scmi_clock_rate_get(const struct scmi_handle *handle, u32 clk_id, u64 *value) ...@@ -203,39 +204,47 @@ scmi_clock_rate_get(const struct scmi_handle *handle, u32 clk_id, u64 *value)
if (ret) if (ret)
return ret; return ret;
*(__le32 *)t->tx.buf = cpu_to_le32(clk_id); put_unaligned_le32(clk_id, t->tx.buf);
ret = scmi_do_xfer(handle, t); ret = scmi_do_xfer(handle, t);
if (!ret) { if (!ret)
__le32 *pval = t->rx.buf; *value = get_unaligned_le64(t->rx.buf);
*value = le32_to_cpu(*pval);
*value |= (u64)le32_to_cpu(*(pval + 1)) << 32;
}
scmi_xfer_put(handle, t); scmi_xfer_put(handle, t);
return ret; return ret;
} }
static int scmi_clock_rate_set(const struct scmi_handle *handle, u32 clk_id, static int scmi_clock_rate_set(const struct scmi_handle *handle, u32 clk_id,
u32 config, u64 rate) u64 rate)
{ {
int ret; int ret;
u32 flags = 0;
struct scmi_xfer *t; struct scmi_xfer *t;
struct scmi_clock_set_rate *cfg; struct scmi_clock_set_rate *cfg;
struct clock_info *ci = handle->clk_priv;
ret = scmi_xfer_get_init(handle, CLOCK_RATE_SET, SCMI_PROTOCOL_CLOCK, ret = scmi_xfer_get_init(handle, CLOCK_RATE_SET, SCMI_PROTOCOL_CLOCK,
sizeof(*cfg), 0, &t); sizeof(*cfg), 0, &t);
if (ret) if (ret)
return ret; return ret;
if (ci->max_async_req &&
atomic_inc_return(&ci->cur_async_req) < ci->max_async_req)
flags |= CLOCK_SET_ASYNC;
cfg = t->tx.buf; cfg = t->tx.buf;
cfg->flags = cpu_to_le32(config); cfg->flags = cpu_to_le32(flags);
cfg->id = cpu_to_le32(clk_id); cfg->id = cpu_to_le32(clk_id);
cfg->value_low = cpu_to_le32(rate & 0xffffffff); cfg->value_low = cpu_to_le32(rate & 0xffffffff);
cfg->value_high = cpu_to_le32(rate >> 32); cfg->value_high = cpu_to_le32(rate >> 32);
ret = scmi_do_xfer(handle, t); if (flags & CLOCK_SET_ASYNC)
ret = scmi_do_xfer_with_response(handle, t);
else
ret = scmi_do_xfer(handle, t);
if (ci->max_async_req)
atomic_dec(&ci->cur_async_req);
scmi_xfer_put(handle, t); scmi_xfer_put(handle, t);
return ret; return ret;
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include <linux/scmi_protocol.h> #include <linux/scmi_protocol.h>
#include <linux/types.h> #include <linux/types.h>
#include <asm/unaligned.h>
#define PROTOCOL_REV_MINOR_MASK GENMASK(15, 0) #define PROTOCOL_REV_MINOR_MASK GENMASK(15, 0)
#define PROTOCOL_REV_MAJOR_MASK GENMASK(31, 16) #define PROTOCOL_REV_MAJOR_MASK GENMASK(31, 16)
#define PROTOCOL_REV_MAJOR(x) (u16)(FIELD_GET(PROTOCOL_REV_MAJOR_MASK, (x))) #define PROTOCOL_REV_MAJOR(x) (u16)(FIELD_GET(PROTOCOL_REV_MAJOR_MASK, (x)))
...@@ -48,11 +50,11 @@ struct scmi_msg_resp_prot_version { ...@@ -48,11 +50,11 @@ struct scmi_msg_resp_prot_version {
/** /**
* struct scmi_msg_hdr - Message(Tx/Rx) header * struct scmi_msg_hdr - Message(Tx/Rx) header
* *
* @id: The identifier of the command being sent * @id: The identifier of the message being sent
* @protocol_id: The identifier of the protocol used to send @id command * @protocol_id: The identifier of the protocol used to send @id message
* @seq: The token to identify the message. when a message/command returns, * @seq: The token to identify the message. When a message returns, the
* the platform returns the whole message header unmodified including * platform returns the whole message header unmodified including the
* the token * token
* @status: Status of the transfer once it's complete * @status: Status of the transfer once it's complete
* @poll_completion: Indicate if the transfer needs to be polled for * @poll_completion: Indicate if the transfer needs to be polled for
* completion or interrupt mode is used * completion or interrupt mode is used
...@@ -84,17 +86,21 @@ struct scmi_msg { ...@@ -84,17 +86,21 @@ struct scmi_msg {
* @rx: Receive message, the buffer should be pre-allocated to store * @rx: Receive message, the buffer should be pre-allocated to store
* message. If request-ACK protocol is used, we can reuse the same * message. If request-ACK protocol is used, we can reuse the same
* buffer for the rx path as we use for the tx path. * buffer for the rx path as we use for the tx path.
* @done: completion event * @done: command message transmit completion event
* @async: pointer to delayed response message received event completion
*/ */
struct scmi_xfer { struct scmi_xfer {
struct scmi_msg_hdr hdr; struct scmi_msg_hdr hdr;
struct scmi_msg tx; struct scmi_msg tx;
struct scmi_msg rx; struct scmi_msg rx;
struct completion done; struct completion done;
struct completion *async_done;
}; };
void scmi_xfer_put(const struct scmi_handle *h, struct scmi_xfer *xfer); void scmi_xfer_put(const struct scmi_handle *h, struct scmi_xfer *xfer);
int scmi_do_xfer(const struct scmi_handle *h, struct scmi_xfer *xfer); int scmi_do_xfer(const struct scmi_handle *h, struct scmi_xfer *xfer);
int scmi_do_xfer_with_response(const struct scmi_handle *h,
struct scmi_xfer *xfer);
int scmi_xfer_get_init(const struct scmi_handle *h, u8 msg_id, u8 prot_id, int scmi_xfer_get_init(const struct scmi_handle *h, u8 msg_id, u8 prot_id,
size_t tx_size, size_t rx_size, struct scmi_xfer **p); size_t tx_size, size_t rx_size, struct scmi_xfer **p);
int scmi_handle_put(const struct scmi_handle *handle); int scmi_handle_put(const struct scmi_handle *handle);
......
This diff is collapsed.
This diff is collapsed.
...@@ -96,7 +96,7 @@ scmi_power_domain_attributes_get(const struct scmi_handle *handle, u32 domain, ...@@ -96,7 +96,7 @@ scmi_power_domain_attributes_get(const struct scmi_handle *handle, u32 domain,
if (ret) if (ret)
return ret; return ret;
*(__le32 *)t->tx.buf = cpu_to_le32(domain); put_unaligned_le32(domain, t->tx.buf);
attr = t->rx.buf; attr = t->rx.buf;
ret = scmi_do_xfer(handle, t); ret = scmi_do_xfer(handle, t);
...@@ -147,11 +147,11 @@ scmi_power_state_get(const struct scmi_handle *handle, u32 domain, u32 *state) ...@@ -147,11 +147,11 @@ scmi_power_state_get(const struct scmi_handle *handle, u32 domain, u32 *state)
if (ret) if (ret)
return ret; return ret;
*(__le32 *)t->tx.buf = cpu_to_le32(domain); put_unaligned_le32(domain, t->tx.buf);
ret = scmi_do_xfer(handle, t); ret = scmi_do_xfer(handle, t);
if (!ret) if (!ret)
*state = le32_to_cpu(*(__le32 *)t->rx.buf); *state = get_unaligned_le32(t->rx.buf);
scmi_xfer_put(handle, t); scmi_xfer_put(handle, t);
return ret; return ret;
......
// SPDX-License-Identifier: GPL-2.0
/*
* System Control and Management Interface (SCMI) Reset Protocol
*
* Copyright (C) 2019 ARM Ltd.
*/
#include "common.h"
enum scmi_reset_protocol_cmd {
RESET_DOMAIN_ATTRIBUTES = 0x3,
RESET = 0x4,
RESET_NOTIFY = 0x5,
};
enum scmi_reset_protocol_notify {
RESET_ISSUED = 0x0,
};
#define NUM_RESET_DOMAIN_MASK 0xffff
#define RESET_NOTIFY_ENABLE BIT(0)
struct scmi_msg_resp_reset_domain_attributes {
__le32 attributes;
#define SUPPORTS_ASYNC_RESET(x) ((x) & BIT(31))
#define SUPPORTS_NOTIFY_RESET(x) ((x) & BIT(30))
__le32 latency;
u8 name[SCMI_MAX_STR_SIZE];
};
struct scmi_msg_reset_domain_reset {
__le32 domain_id;
__le32 flags;
#define AUTONOMOUS_RESET BIT(0)
#define EXPLICIT_RESET_ASSERT BIT(1)
#define ASYNCHRONOUS_RESET BIT(2)
__le32 reset_state;
#define ARCH_RESET_TYPE BIT(31)
#define COLD_RESET_STATE BIT(0)
#define ARCH_COLD_RESET (ARCH_RESET_TYPE | COLD_RESET_STATE)
};
struct reset_dom_info {
bool async_reset;
bool reset_notify;
u32 latency_us;
char name[SCMI_MAX_STR_SIZE];
};
struct scmi_reset_info {
int num_domains;
struct reset_dom_info *dom_info;
};
static int scmi_reset_attributes_get(const struct scmi_handle *handle,
struct scmi_reset_info *pi)
{
int ret;
struct scmi_xfer *t;
u32 attr;
ret = scmi_xfer_get_init(handle, PROTOCOL_ATTRIBUTES,
SCMI_PROTOCOL_RESET, 0, sizeof(attr), &t);
if (ret)
return ret;
ret = scmi_do_xfer(handle, t);
if (!ret) {
attr = get_unaligned_le32(t->rx.buf);
pi->num_domains = attr & NUM_RESET_DOMAIN_MASK;
}
scmi_xfer_put(handle, t);
return ret;
}
static int
scmi_reset_domain_attributes_get(const struct scmi_handle *handle, u32 domain,
struct reset_dom_info *dom_info)
{
int ret;
struct scmi_xfer *t;
struct scmi_msg_resp_reset_domain_attributes *attr;
ret = scmi_xfer_get_init(handle, RESET_DOMAIN_ATTRIBUTES,
SCMI_PROTOCOL_RESET, sizeof(domain),
sizeof(*attr), &t);
if (ret)
return ret;
put_unaligned_le32(domain, t->tx.buf);
attr = t->rx.buf;
ret = scmi_do_xfer(handle, t);
if (!ret) {
u32 attributes = le32_to_cpu(attr->attributes);
dom_info->async_reset = SUPPORTS_ASYNC_RESET(attributes);
dom_info->reset_notify = SUPPORTS_NOTIFY_RESET(attributes);
dom_info->latency_us = le32_to_cpu(attr->latency);
if (dom_info->latency_us == U32_MAX)
dom_info->latency_us = 0;
strlcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
}
scmi_xfer_put(handle, t);
return ret;
}
static int scmi_reset_num_domains_get(const struct scmi_handle *handle)
{
struct scmi_reset_info *pi = handle->reset_priv;
return pi->num_domains;
}
static char *scmi_reset_name_get(const struct scmi_handle *handle, u32 domain)
{
struct scmi_reset_info *pi = handle->reset_priv;
struct reset_dom_info *dom = pi->dom_info + domain;
return dom->name;
}
static int scmi_reset_latency_get(const struct scmi_handle *handle, u32 domain)
{
struct scmi_reset_info *pi = handle->reset_priv;
struct reset_dom_info *dom = pi->dom_info + domain;
return dom->latency_us;
}
static int scmi_domain_reset(const struct scmi_handle *handle, u32 domain,
u32 flags, u32 state)
{
int ret;
struct scmi_xfer *t;
struct scmi_msg_reset_domain_reset *dom;
struct scmi_reset_info *pi = handle->reset_priv;
struct reset_dom_info *rdom = pi->dom_info + domain;
if (rdom->async_reset)
flags |= ASYNCHRONOUS_RESET;
ret = scmi_xfer_get_init(handle, RESET, SCMI_PROTOCOL_RESET,
sizeof(*dom), 0, &t);
if (ret)
return ret;
dom = t->tx.buf;
dom->domain_id = cpu_to_le32(domain);
dom->flags = cpu_to_le32(flags);
dom->domain_id = cpu_to_le32(state);
if (rdom->async_reset)
ret = scmi_do_xfer_with_response(handle, t);
else
ret = scmi_do_xfer(handle, t);
scmi_xfer_put(handle, t);
return ret;
}
static int scmi_reset_domain_reset(const struct scmi_handle *handle, u32 domain)
{
return scmi_domain_reset(handle, domain, AUTONOMOUS_RESET,
ARCH_COLD_RESET);
}
static int
scmi_reset_domain_assert(const struct scmi_handle *handle, u32 domain)
{
return scmi_domain_reset(handle, domain, EXPLICIT_RESET_ASSERT,
ARCH_COLD_RESET);
}
static int
scmi_reset_domain_deassert(const struct scmi_handle *handle, u32 domain)
{
return scmi_domain_reset(handle, domain, 0, ARCH_COLD_RESET);
}
static struct scmi_reset_ops reset_ops = {
.num_domains_get = scmi_reset_num_domains_get,
.name_get = scmi_reset_name_get,
.latency_get = scmi_reset_latency_get,
.reset = scmi_reset_domain_reset,
.assert = scmi_reset_domain_assert,
.deassert = scmi_reset_domain_deassert,
};
static int scmi_reset_protocol_init(struct scmi_handle *handle)
{
int domain;
u32 version;
struct scmi_reset_info *pinfo;
scmi_version_get(handle, SCMI_PROTOCOL_RESET, &version);
dev_dbg(handle->dev, "Reset Version %d.%d\n",
PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version));
pinfo = devm_kzalloc(handle->dev, sizeof(*pinfo), GFP_KERNEL);
if (!pinfo)
return -ENOMEM;
scmi_reset_attributes_get(handle, pinfo);
pinfo->dom_info = devm_kcalloc(handle->dev, pinfo->num_domains,
sizeof(*pinfo->dom_info), GFP_KERNEL);
if (!pinfo->dom_info)
return -ENOMEM;
for (domain = 0; domain < pinfo->num_domains; domain++) {
struct reset_dom_info *dom = pinfo->dom_info + domain;
scmi_reset_domain_attributes_get(handle, domain, dom);
}
handle->reset_ops = &reset_ops;
handle->reset_priv = pinfo;
return 0;
}
static int __init scmi_reset_init(void)
{
return scmi_protocol_register(SCMI_PROTOCOL_RESET,
&scmi_reset_protocol_init);
}
subsys_initcall(scmi_reset_init);
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
enum scmi_sensor_protocol_cmd { enum scmi_sensor_protocol_cmd {
SENSOR_DESCRIPTION_GET = 0x3, SENSOR_DESCRIPTION_GET = 0x3,
SENSOR_CONFIG_SET = 0x4, SENSOR_TRIP_POINT_NOTIFY = 0x4,
SENSOR_TRIP_POINT_SET = 0x5, SENSOR_TRIP_POINT_CONFIG = 0x5,
SENSOR_READING_GET = 0x6, SENSOR_READING_GET = 0x6,
}; };
...@@ -42,9 +42,10 @@ struct scmi_msg_resp_sensor_description { ...@@ -42,9 +42,10 @@ struct scmi_msg_resp_sensor_description {
} desc[0]; } desc[0];
}; };
struct scmi_msg_set_sensor_config { struct scmi_msg_sensor_trip_point_notify {
__le32 id; __le32 id;
__le32 event_control; __le32 event_control;
#define SENSOR_TP_NOTIFY_ALL BIT(0)
}; };
struct scmi_msg_set_sensor_trip_point { struct scmi_msg_set_sensor_trip_point {
...@@ -119,7 +120,7 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle, ...@@ -119,7 +120,7 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle,
do { do {
/* Set the number of sensors to be skipped/already read */ /* Set the number of sensors to be skipped/already read */
*(__le32 *)t->tx.buf = cpu_to_le32(desc_index); put_unaligned_le32(desc_index, t->tx.buf);
ret = scmi_do_xfer(handle, t); ret = scmi_do_xfer(handle, t);
if (ret) if (ret)
...@@ -135,9 +136,10 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle, ...@@ -135,9 +136,10 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle,
} }
for (cnt = 0; cnt < num_returned; cnt++) { for (cnt = 0; cnt < num_returned; cnt++) {
u32 attrh; u32 attrh, attrl;
struct scmi_sensor_info *s; struct scmi_sensor_info *s;
attrl = le32_to_cpu(buf->desc[cnt].attributes_low);
attrh = le32_to_cpu(buf->desc[cnt].attributes_high); attrh = le32_to_cpu(buf->desc[cnt].attributes_high);
s = &si->sensors[desc_index + cnt]; s = &si->sensors[desc_index + cnt];
s->id = le32_to_cpu(buf->desc[cnt].id); s->id = le32_to_cpu(buf->desc[cnt].id);
...@@ -146,6 +148,8 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle, ...@@ -146,6 +148,8 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle,
/* Sign extend to a full s8 */ /* Sign extend to a full s8 */
if (s->scale & SENSOR_SCALE_SIGN) if (s->scale & SENSOR_SCALE_SIGN)
s->scale |= SENSOR_SCALE_EXTEND; s->scale |= SENSOR_SCALE_EXTEND;
s->async = SUPPORTS_ASYNC_READ(attrl);
s->num_trip_points = NUM_TRIP_POINTS(attrl);
strlcpy(s->name, buf->desc[cnt].name, SCMI_MAX_STR_SIZE); strlcpy(s->name, buf->desc[cnt].name, SCMI_MAX_STR_SIZE);
} }
...@@ -160,15 +164,15 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle, ...@@ -160,15 +164,15 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle,
return ret; return ret;
} }
static int static int scmi_sensor_trip_point_notify(const struct scmi_handle *handle,
scmi_sensor_configuration_set(const struct scmi_handle *handle, u32 sensor_id) u32 sensor_id, bool enable)
{ {
int ret; int ret;
u32 evt_cntl = BIT(0); u32 evt_cntl = enable ? SENSOR_TP_NOTIFY_ALL : 0;
struct scmi_xfer *t; struct scmi_xfer *t;
struct scmi_msg_set_sensor_config *cfg; struct scmi_msg_sensor_trip_point_notify *cfg;
ret = scmi_xfer_get_init(handle, SENSOR_CONFIG_SET, ret = scmi_xfer_get_init(handle, SENSOR_TRIP_POINT_NOTIFY,
SCMI_PROTOCOL_SENSOR, sizeof(*cfg), 0, &t); SCMI_PROTOCOL_SENSOR, sizeof(*cfg), 0, &t);
if (ret) if (ret)
return ret; return ret;
...@@ -183,15 +187,16 @@ scmi_sensor_configuration_set(const struct scmi_handle *handle, u32 sensor_id) ...@@ -183,15 +187,16 @@ scmi_sensor_configuration_set(const struct scmi_handle *handle, u32 sensor_id)
return ret; return ret;
} }
static int scmi_sensor_trip_point_set(const struct scmi_handle *handle, static int
u32 sensor_id, u8 trip_id, u64 trip_value) scmi_sensor_trip_point_config(const struct scmi_handle *handle, u32 sensor_id,
u8 trip_id, u64 trip_value)
{ {
int ret; int ret;
u32 evt_cntl = SENSOR_TP_BOTH; u32 evt_cntl = SENSOR_TP_BOTH;
struct scmi_xfer *t; struct scmi_xfer *t;
struct scmi_msg_set_sensor_trip_point *trip; struct scmi_msg_set_sensor_trip_point *trip;
ret = scmi_xfer_get_init(handle, SENSOR_TRIP_POINT_SET, ret = scmi_xfer_get_init(handle, SENSOR_TRIP_POINT_CONFIG,
SCMI_PROTOCOL_SENSOR, sizeof(*trip), 0, &t); SCMI_PROTOCOL_SENSOR, sizeof(*trip), 0, &t);
if (ret) if (ret)
return ret; return ret;
...@@ -209,11 +214,13 @@ static int scmi_sensor_trip_point_set(const struct scmi_handle *handle, ...@@ -209,11 +214,13 @@ static int scmi_sensor_trip_point_set(const struct scmi_handle *handle,
} }
static int scmi_sensor_reading_get(const struct scmi_handle *handle, static int scmi_sensor_reading_get(const struct scmi_handle *handle,
u32 sensor_id, bool async, u64 *value) u32 sensor_id, u64 *value)
{ {
int ret; int ret;
struct scmi_xfer *t; struct scmi_xfer *t;
struct scmi_msg_sensor_reading_get *sensor; struct scmi_msg_sensor_reading_get *sensor;
struct sensors_info *si = handle->sensor_priv;
struct scmi_sensor_info *s = si->sensors + sensor_id;
ret = scmi_xfer_get_init(handle, SENSOR_READING_GET, ret = scmi_xfer_get_init(handle, SENSOR_READING_GET,
SCMI_PROTOCOL_SENSOR, sizeof(*sensor), SCMI_PROTOCOL_SENSOR, sizeof(*sensor),
...@@ -223,14 +230,18 @@ static int scmi_sensor_reading_get(const struct scmi_handle *handle, ...@@ -223,14 +230,18 @@ static int scmi_sensor_reading_get(const struct scmi_handle *handle,
sensor = t->tx.buf; sensor = t->tx.buf;
sensor->id = cpu_to_le32(sensor_id); sensor->id = cpu_to_le32(sensor_id);
sensor->flags = cpu_to_le32(async ? SENSOR_READ_ASYNC : 0);
ret = scmi_do_xfer(handle, t); if (s->async) {
if (!ret) { sensor->flags = cpu_to_le32(SENSOR_READ_ASYNC);
__le32 *pval = t->rx.buf; ret = scmi_do_xfer_with_response(handle, t);
if (!ret)
*value = le32_to_cpu(*pval); *value = get_unaligned_le64((void *)
*value |= (u64)le32_to_cpu(*(pval + 1)) << 32; ((__le32 *)t->rx.buf + 1));
} else {
sensor->flags = cpu_to_le32(0);
ret = scmi_do_xfer(handle, t);
if (!ret)
*value = get_unaligned_le64(t->rx.buf);
} }
scmi_xfer_put(handle, t); scmi_xfer_put(handle, t);
...@@ -255,8 +266,8 @@ static int scmi_sensor_count_get(const struct scmi_handle *handle) ...@@ -255,8 +266,8 @@ static int scmi_sensor_count_get(const struct scmi_handle *handle)
static struct scmi_sensor_ops sensor_ops = { static struct scmi_sensor_ops sensor_ops = {
.count_get = scmi_sensor_count_get, .count_get = scmi_sensor_count_get,
.info_get = scmi_sensor_info_get, .info_get = scmi_sensor_info_get,
.configuration_set = scmi_sensor_configuration_set, .trip_point_notify = scmi_sensor_trip_point_notify,
.trip_point_set = scmi_sensor_trip_point_set, .trip_point_config = scmi_sensor_trip_point_config,
.reading_get = scmi_sensor_reading_get, .reading_get = scmi_sensor_reading_get,
}; };
......
...@@ -1445,6 +1445,15 @@ config GPIO_XRA1403 ...@@ -1445,6 +1445,15 @@ config GPIO_XRA1403
help help
GPIO driver for EXAR XRA1403 16-bit SPI-based GPIO expander. GPIO driver for EXAR XRA1403 16-bit SPI-based GPIO expander.
config GPIO_MOXTET
tristate "Turris Mox Moxtet bus GPIO expander"
depends on MOXTET
help
Say yes here if you are building for the Turris Mox router.
This is the driver needed for configuring the GPIOs via the Moxtet
bus. For example the Mox module with SFP cage needs this driver
so that phylink can use corresponding GPIOs.
endmenu endmenu
menu "USB GPIO expanders" menu "USB GPIO expanders"
......
...@@ -93,6 +93,7 @@ obj-$(CONFIG_GPIO_ML_IOH) += gpio-ml-ioh.o ...@@ -93,6 +93,7 @@ obj-$(CONFIG_GPIO_ML_IOH) += gpio-ml-ioh.o
obj-$(CONFIG_GPIO_MLXBF) += gpio-mlxbf.o obj-$(CONFIG_GPIO_MLXBF) += gpio-mlxbf.o
obj-$(CONFIG_GPIO_MM_LANTIQ) += gpio-mm-lantiq.o obj-$(CONFIG_GPIO_MM_LANTIQ) += gpio-mm-lantiq.o
obj-$(CONFIG_GPIO_MOCKUP) += gpio-mockup.o obj-$(CONFIG_GPIO_MOCKUP) += gpio-mockup.o
obj-$(CONFIG_GPIO_MOXTET) += gpio-moxtet.o
obj-$(CONFIG_GPIO_MPC5200) += gpio-mpc5200.o obj-$(CONFIG_GPIO_MPC5200) += gpio-mpc5200.o
obj-$(CONFIG_GPIO_MPC8XXX) += gpio-mpc8xxx.o obj-$(CONFIG_GPIO_MPC8XXX) += gpio-mpc8xxx.o
obj-$(CONFIG_GPIO_MSIC) += gpio-msic.o obj-$(CONFIG_GPIO_MSIC) += gpio-msic.o
......
// SPDX-License-Identifier: GPL-2.0
/*
* Turris Mox Moxtet GPIO expander
*
* Copyright (C) 2018 Marek Behun <marek.behun@nic.cz>
*/
#include <linux/bitops.h>
#include <linux/gpio/driver.h>
#include <linux/moxtet.h>
#include <linux/module.h>
#define MOXTET_GPIO_NGPIOS 12
#define MOXTET_GPIO_INPUTS 4
struct moxtet_gpio_desc {
u16 in_mask;
u16 out_mask;
};
static const struct moxtet_gpio_desc descs[] = {
[TURRIS_MOX_MODULE_SFP] = {
.in_mask = GENMASK(2, 0),
.out_mask = GENMASK(5, 4),
},
};
struct moxtet_gpio_chip {
struct device *dev;
struct gpio_chip gpio_chip;
const struct moxtet_gpio_desc *desc;
};
static int moxtet_gpio_get_value(struct gpio_chip *gc, unsigned int offset)
{
struct moxtet_gpio_chip *chip = gpiochip_get_data(gc);
int ret;
if (chip->desc->in_mask & BIT(offset)) {
ret = moxtet_device_read(chip->dev);
} else if (chip->desc->out_mask & BIT(offset)) {
ret = moxtet_device_written(chip->dev);
if (ret >= 0)
ret <<= MOXTET_GPIO_INPUTS;
} else {
return -EINVAL;
}
if (ret < 0)
return ret;
return !!(ret & BIT(offset));
}
static void moxtet_gpio_set_value(struct gpio_chip *gc, unsigned int offset,
int val)
{
struct moxtet_gpio_chip *chip = gpiochip_get_data(gc);
int state;
state = moxtet_device_written(chip->dev);
if (state < 0)
return;
offset -= MOXTET_GPIO_INPUTS;
if (val)
state |= BIT(offset);
else
state &= ~BIT(offset);
moxtet_device_write(chip->dev, state);
}
static int moxtet_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
{
struct moxtet_gpio_chip *chip = gpiochip_get_data(gc);
/* All lines are hard wired to be either input or output, not both. */
if (chip->desc->in_mask & BIT(offset))
return 1;
else if (chip->desc->out_mask & BIT(offset))
return 0;
else
return -EINVAL;
}
static int moxtet_gpio_direction_input(struct gpio_chip *gc,
unsigned int offset)
{
struct moxtet_gpio_chip *chip = gpiochip_get_data(gc);
if (chip->desc->in_mask & BIT(offset))
return 0;
else if (chip->desc->out_mask & BIT(offset))
return -ENOTSUPP;
else
return -EINVAL;
}
static int moxtet_gpio_direction_output(struct gpio_chip *gc,
unsigned int offset, int val)
{
struct moxtet_gpio_chip *chip = gpiochip_get_data(gc);
if (chip->desc->out_mask & BIT(offset))
moxtet_gpio_set_value(gc, offset, val);
else if (chip->desc->in_mask & BIT(offset))
return -ENOTSUPP;
else
return -EINVAL;
return 0;
}
static int moxtet_gpio_probe(struct device *dev)
{
struct moxtet_gpio_chip *chip;
struct device_node *nc = dev->of_node;
int id;
id = to_moxtet_device(dev)->id;
if (id >= ARRAY_SIZE(descs)) {
dev_err(dev, "%pOF Moxtet device id 0x%x is not supported by gpio-moxtet driver\n",
nc, id);
return -ENOTSUPP;
}
chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;
chip->dev = dev;
chip->gpio_chip.parent = dev;
chip->desc = &descs[id];
dev_set_drvdata(dev, chip);
chip->gpio_chip.label = dev_name(dev);
chip->gpio_chip.get_direction = moxtet_gpio_get_direction;
chip->gpio_chip.direction_input = moxtet_gpio_direction_input;
chip->gpio_chip.direction_output = moxtet_gpio_direction_output;
chip->gpio_chip.get = moxtet_gpio_get_value;
chip->gpio_chip.set = moxtet_gpio_set_value;
chip->gpio_chip.base = -1;
chip->gpio_chip.ngpio = MOXTET_GPIO_NGPIOS;
chip->gpio_chip.can_sleep = true;
chip->gpio_chip.owner = THIS_MODULE;
return devm_gpiochip_add_data(dev, &chip->gpio_chip, chip);
}
static const struct of_device_id moxtet_gpio_dt_ids[] = {
{ .compatible = "cznic,moxtet-gpio", },
{},
};
MODULE_DEVICE_TABLE(of, moxtet_gpio_dt_ids);
static const enum turris_mox_module_id moxtet_gpio_module_table[] = {
TURRIS_MOX_MODULE_SFP,
0,
};
static struct moxtet_driver moxtet_gpio_driver = {
.driver = {
.name = "moxtet-gpio",
.of_match_table = moxtet_gpio_dt_ids,
.probe = moxtet_gpio_probe,
},
.id_table = moxtet_gpio_module_table,
};
module_moxtet_driver(moxtet_gpio_driver);
MODULE_AUTHOR("Marek Behun <marek.behun@nic.cz>");
MODULE_DESCRIPTION("Turris Mox Moxtet GPIO expander");
MODULE_LICENSE("GPL v2");
...@@ -72,7 +72,7 @@ static int scmi_hwmon_read(struct device *dev, enum hwmon_sensor_types type, ...@@ -72,7 +72,7 @@ static int scmi_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
const struct scmi_handle *h = scmi_sensors->handle; const struct scmi_handle *h = scmi_sensors->handle;
sensor = *(scmi_sensors->info[type] + channel); sensor = *(scmi_sensors->info[type] + channel);
ret = h->sensor_ops->reading_get(h, sensor->id, false, &value); ret = h->sensor_ops->reading_get(h, sensor->id, &value);
if (ret) if (ret)
return ret; return ret;
......
...@@ -116,9 +116,20 @@ config RESET_QCOM_PDC ...@@ -116,9 +116,20 @@ config RESET_QCOM_PDC
to control reset signals provided by PDC for Modem, Compute, to control reset signals provided by PDC for Modem, Compute,
Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS. Display, GPU, Debug, AOP, Sensors, Audio, SP and APPS.
config RESET_SCMI
tristate "Reset driver controlled via ARM SCMI interface"
depends on ARM_SCMI_PROTOCOL || COMPILE_TEST
default ARM_SCMI_PROTOCOL
help
This driver provides support for reset signal/domains that are
controlled by firmware that implements the SCMI interface.
This driver uses SCMI Message Protocol to interact with the
firmware controlling all the reset signals.
config RESET_SIMPLE config RESET_SIMPLE
bool "Simple Reset Controller Driver" if COMPILE_TEST bool "Simple Reset Controller Driver" if COMPILE_TEST
default ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARCH_ASPEED || ARCH_BITMAIN default ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARCH_ASPEED || ARCH_BITMAIN || ARC
help help
This enables a simple reset controller driver for reset lines that This enables a simple reset controller driver for reset lines that
that can be asserted and deasserted by toggling bits in a contiguous, that can be asserted and deasserted by toggling bits in a contiguous,
......
...@@ -18,6 +18,7 @@ obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o ...@@ -18,6 +18,7 @@ obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o
obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o
obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o
obj-$(CONFIG_RESET_QCOM_PDC) += reset-qcom-pdc.o obj-$(CONFIG_RESET_QCOM_PDC) += reset-qcom-pdc.o
obj-$(CONFIG_RESET_SCMI) += reset-scmi.o
obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o
obj-$(CONFIG_RESET_STM32MP157) += reset-stm32mp1.o obj-$(CONFIG_RESET_STM32MP157) += reset-stm32mp1.o
obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
......
...@@ -169,9 +169,9 @@ static const struct imx7_src_signal imx8mq_src_signals[IMX8MQ_RESET_NUM] = { ...@@ -169,9 +169,9 @@ static const struct imx7_src_signal imx8mq_src_signals[IMX8MQ_RESET_NUM] = {
[IMX8MQ_RESET_OTG2_PHY_RESET] = { SRC_USBOPHY2_RCR, BIT(0) }, [IMX8MQ_RESET_OTG2_PHY_RESET] = { SRC_USBOPHY2_RCR, BIT(0) },
[IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N] = { SRC_MIPIPHY_RCR, BIT(1) }, [IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N] = { SRC_MIPIPHY_RCR, BIT(1) },
[IMX8MQ_RESET_MIPI_DSI_RESET_N] = { SRC_MIPIPHY_RCR, BIT(2) }, [IMX8MQ_RESET_MIPI_DSI_RESET_N] = { SRC_MIPIPHY_RCR, BIT(2) },
[IMX8MQ_RESET_MIPI_DIS_DPI_RESET_N] = { SRC_MIPIPHY_RCR, BIT(3) }, [IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N] = { SRC_MIPIPHY_RCR, BIT(3) },
[IMX8MQ_RESET_MIPI_DIS_ESC_RESET_N] = { SRC_MIPIPHY_RCR, BIT(4) }, [IMX8MQ_RESET_MIPI_DSI_ESC_RESET_N] = { SRC_MIPIPHY_RCR, BIT(4) },
[IMX8MQ_RESET_MIPI_DIS_PCLK_RESET_N] = { SRC_MIPIPHY_RCR, BIT(5) }, [IMX8MQ_RESET_MIPI_DSI_PCLK_RESET_N] = { SRC_MIPIPHY_RCR, BIT(5) },
[IMX8MQ_RESET_PCIEPHY] = { SRC_PCIEPHY_RCR, [IMX8MQ_RESET_PCIEPHY] = { SRC_PCIEPHY_RCR,
BIT(2) | BIT(1) }, BIT(2) | BIT(1) },
[IMX8MQ_RESET_PCIEPHY_PERST] = { SRC_PCIEPHY_RCR, BIT(3) }, [IMX8MQ_RESET_PCIEPHY_PERST] = { SRC_PCIEPHY_RCR, BIT(3) },
...@@ -220,9 +220,9 @@ static int imx8mq_reset_set(struct reset_controller_dev *rcdev, ...@@ -220,9 +220,9 @@ static int imx8mq_reset_set(struct reset_controller_dev *rcdev,
case IMX8MQ_RESET_PCIE_CTRL_APPS_EN: case IMX8MQ_RESET_PCIE_CTRL_APPS_EN:
case IMX8MQ_RESET_PCIE2_CTRL_APPS_EN: /* fallthrough */ case IMX8MQ_RESET_PCIE2_CTRL_APPS_EN: /* fallthrough */
case IMX8MQ_RESET_MIPI_DIS_PCLK_RESET_N: /* fallthrough */ case IMX8MQ_RESET_MIPI_DSI_PCLK_RESET_N: /* fallthrough */
case IMX8MQ_RESET_MIPI_DIS_ESC_RESET_N: /* fallthrough */ case IMX8MQ_RESET_MIPI_DSI_ESC_RESET_N: /* fallthrough */
case IMX8MQ_RESET_MIPI_DIS_DPI_RESET_N: /* fallthrough */ case IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N: /* fallthrough */
case IMX8MQ_RESET_MIPI_DSI_RESET_N: /* fallthrough */ case IMX8MQ_RESET_MIPI_DSI_RESET_N: /* fallthrough */
case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N: /* fallthrough */ case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N: /* fallthrough */
value = assert ? 0 : bit; value = assert ? 0 : bit;
......
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/* /*
* Amlogic Meson Reset Controller driver * Amlogic Meson Reset Controller driver
* *
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright (c) 2016 BayLibre, SAS.
* Author: Neil Armstrong <narmstrong@baylibre.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
* The full GNU General Public License is included in this distribution
* in the file called COPYING.
*
* BSD LICENSE
*
* Copyright (c) 2016 BayLibre, SAS. * Copyright (c) 2016 BayLibre, SAS.
* Author: Neil Armstrong <narmstrong@baylibre.com> * Author: Neil Armstrong <narmstrong@baylibre.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <linux/err.h> #include <linux/err.h>
#include <linux/init.h> #include <linux/init.h>
......
// SPDX-License-Identifier: GPL-2.0
/*
* ARM System Control and Management Interface (ARM SCMI) reset driver
*
* Copyright (C) 2019 ARM Ltd.
*/
#include <linux/module.h>
#include <linux/of.h>
#include <linux/device.h>
#include <linux/reset-controller.h>
#include <linux/scmi_protocol.h>
/**
* struct scmi_reset_data - reset controller information structure
* @rcdev: reset controller entity
* @handle: ARM SCMI handle used for communication with system controller
*/
struct scmi_reset_data {
struct reset_controller_dev rcdev;
const struct scmi_handle *handle;
};
#define to_scmi_reset_data(p) container_of((p), struct scmi_reset_data, rcdev)
#define to_scmi_handle(p) (to_scmi_reset_data(p)->handle)
/**
* scmi_reset_assert() - assert device reset
* @rcdev: reset controller entity
* @id: ID of the reset to be asserted
*
* This function implements the reset driver op to assert a device's reset
* using the ARM SCMI protocol.
*
* Return: 0 for successful request, else a corresponding error value
*/
static int
scmi_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
{
const struct scmi_handle *handle = to_scmi_handle(rcdev);
return handle->reset_ops->assert(handle, id);
}
/**
* scmi_reset_deassert() - deassert device reset
* @rcdev: reset controller entity
* @id: ID of the reset to be deasserted
*
* This function implements the reset driver op to deassert a device's reset
* using the ARM SCMI protocol.
*
* Return: 0 for successful request, else a corresponding error value
*/
static int
scmi_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
{
const struct scmi_handle *handle = to_scmi_handle(rcdev);
return handle->reset_ops->deassert(handle, id);
}
/**
* scmi_reset_reset() - reset the device
* @rcdev: reset controller entity
* @id: ID of the reset signal to be reset(assert + deassert)
*
* This function implements the reset driver op to trigger a device's
* reset signal using the ARM SCMI protocol.
*
* Return: 0 for successful request, else a corresponding error value
*/
static int
scmi_reset_reset(struct reset_controller_dev *rcdev, unsigned long id)
{
const struct scmi_handle *handle = to_scmi_handle(rcdev);
return handle->reset_ops->reset(handle, id);
}
static const struct reset_control_ops scmi_reset_ops = {
.assert = scmi_reset_assert,
.deassert = scmi_reset_deassert,
.reset = scmi_reset_reset,
};
static int scmi_reset_probe(struct scmi_device *sdev)
{
struct scmi_reset_data *data;
struct device *dev = &sdev->dev;
struct device_node *np = dev->of_node;
const struct scmi_handle *handle = sdev->handle;
if (!handle || !handle->reset_ops)
return -ENODEV;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->rcdev.ops = &scmi_reset_ops;
data->rcdev.owner = THIS_MODULE;
data->rcdev.of_node = np;
data->rcdev.nr_resets = handle->reset_ops->num_domains_get(handle);
return devm_reset_controller_register(dev, &data->rcdev);
}
static const struct scmi_device_id scmi_id_table[] = {
{ SCMI_PROTOCOL_RESET },
{ },
};
MODULE_DEVICE_TABLE(scmi, scmi_id_table);
static struct scmi_driver scmi_reset_driver = {
.name = "scmi-reset",
.probe = scmi_reset_probe,
.id_table = scmi_id_table,
};
module_scmi_driver(scmi_reset_driver);
MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>");
MODULE_DESCRIPTION("ARM SCMI reset controller driver");
MODULE_LICENSE("GPL v2");
...@@ -127,6 +127,9 @@ static const struct of_device_id reset_simple_dt_ids[] = { ...@@ -127,6 +127,9 @@ static const struct of_device_id reset_simple_dt_ids[] = {
{ .compatible = "aspeed,ast2500-lpc-reset" }, { .compatible = "aspeed,ast2500-lpc-reset" },
{ .compatible = "bitmain,bm1880-reset", { .compatible = "bitmain,bm1880-reset",
.data = &reset_simple_active_low }, .data = &reset_simple_active_low },
{ .compatible = "snps,dw-high-reset" },
{ .compatible = "snps,dw-low-reset",
.data = &reset_simple_active_low },
{ /* sentinel */ }, { /* sentinel */ },
}; };
......
...@@ -73,7 +73,7 @@ static u64 get_mc_fw_base_address(void) ...@@ -73,7 +73,7 @@ static u64 get_mc_fw_base_address(void)
mcfbaregs = ioremap(mc_base_addr.start, resource_size(&mc_base_addr)); mcfbaregs = ioremap(mc_base_addr.start, resource_size(&mc_base_addr));
if (!mcfbaregs) { if (!mcfbaregs) {
pr_err("could not map MC Firmaware Base registers\n"); pr_err("could not map MC Firmware Base registers\n");
return 0; return 0;
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* General Purpose functions for the global management of the * General Purpose functions for the global management of the
* QUICC Engine (QE). * QUICC Engine (QE).
*/ */
#include <linux/bitmap.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -39,29 +40,32 @@ static DEFINE_SPINLOCK(qe_lock); ...@@ -39,29 +40,32 @@ static DEFINE_SPINLOCK(qe_lock);
DEFINE_SPINLOCK(cmxgcr_lock); DEFINE_SPINLOCK(cmxgcr_lock);
EXPORT_SYMBOL(cmxgcr_lock); EXPORT_SYMBOL(cmxgcr_lock);
/* QE snum state */
enum qe_snum_state {
QE_SNUM_STATE_USED,
QE_SNUM_STATE_FREE
};
/* QE snum */
struct qe_snum {
u8 num;
enum qe_snum_state state;
};
/* We allocate this here because it is used almost exclusively for /* We allocate this here because it is used almost exclusively for
* the communication processor devices. * the communication processor devices.
*/ */
struct qe_immap __iomem *qe_immr; struct qe_immap __iomem *qe_immr;
EXPORT_SYMBOL(qe_immr); EXPORT_SYMBOL(qe_immr);
static struct qe_snum snums[QE_NUM_OF_SNUM]; /* Dynamically allocated SNUMs */ static u8 snums[QE_NUM_OF_SNUM]; /* Dynamically allocated SNUMs */
static DECLARE_BITMAP(snum_state, QE_NUM_OF_SNUM);
static unsigned int qe_num_of_snum; static unsigned int qe_num_of_snum;
static phys_addr_t qebase = -1; static phys_addr_t qebase = -1;
static struct device_node *qe_get_device_node(void)
{
struct device_node *qe;
/*
* Newer device trees have an "fsl,qe" compatible property for the QE
* node, but we still need to support older device trees.
*/
qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
if (qe)
return qe;
return of_find_node_by_type(NULL, "qe");
}
static phys_addr_t get_qe_base(void) static phys_addr_t get_qe_base(void)
{ {
struct device_node *qe; struct device_node *qe;
...@@ -71,12 +75,9 @@ static phys_addr_t get_qe_base(void) ...@@ -71,12 +75,9 @@ static phys_addr_t get_qe_base(void)
if (qebase != -1) if (qebase != -1)
return qebase; return qebase;
qe = of_find_compatible_node(NULL, NULL, "fsl,qe"); qe = qe_get_device_node();
if (!qe) { if (!qe)
qe = of_find_node_by_type(NULL, "qe"); return qebase;
if (!qe)
return qebase;
}
ret = of_address_to_resource(qe, 0, &res); ret = of_address_to_resource(qe, 0, &res);
if (!ret) if (!ret)
...@@ -170,12 +171,9 @@ unsigned int qe_get_brg_clk(void) ...@@ -170,12 +171,9 @@ unsigned int qe_get_brg_clk(void)
if (brg_clk) if (brg_clk)
return brg_clk; return brg_clk;
qe = of_find_compatible_node(NULL, NULL, "fsl,qe"); qe = qe_get_device_node();
if (!qe) { if (!qe)
qe = of_find_node_by_type(NULL, "qe"); return brg_clk;
if (!qe)
return brg_clk;
}
prop = of_get_property(qe, "brg-frequency", &size); prop = of_get_property(qe, "brg-frequency", &size);
if (prop && size == sizeof(*prop)) if (prop && size == sizeof(*prop))
...@@ -281,7 +279,6 @@ EXPORT_SYMBOL(qe_clock_source); ...@@ -281,7 +279,6 @@ EXPORT_SYMBOL(qe_clock_source);
*/ */
static void qe_snums_init(void) static void qe_snums_init(void)
{ {
int i;
static const u8 snum_init_76[] = { static const u8 snum_init_76[] = {
0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D, 0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D,
0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x88, 0x89, 0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x88, 0x89,
...@@ -302,19 +299,39 @@ static void qe_snums_init(void) ...@@ -302,19 +299,39 @@ static void qe_snums_init(void)
0x28, 0x29, 0x38, 0x39, 0x48, 0x49, 0x58, 0x59, 0x28, 0x29, 0x38, 0x39, 0x48, 0x49, 0x58, 0x59,
0x68, 0x69, 0x78, 0x79, 0x80, 0x81, 0x68, 0x69, 0x78, 0x79, 0x80, 0x81,
}; };
static const u8 *snum_init; struct device_node *qe;
const u8 *snum_init;
int i;
qe_num_of_snum = qe_get_num_of_snums(); bitmap_zero(snum_state, QE_NUM_OF_SNUM);
qe_num_of_snum = 28; /* The default number of snum for threads is 28 */
qe = qe_get_device_node();
if (qe) {
i = of_property_read_variable_u8_array(qe, "fsl,qe-snums",
snums, 1, QE_NUM_OF_SNUM);
if (i > 0) {
of_node_put(qe);
qe_num_of_snum = i;
return;
}
/*
* Fall back to legacy binding of using the value of
* fsl,qe-num-snums to choose one of the static arrays
* above.
*/
of_property_read_u32(qe, "fsl,qe-num-snums", &qe_num_of_snum);
of_node_put(qe);
}
if (qe_num_of_snum == 76) if (qe_num_of_snum == 76) {
snum_init = snum_init_76; snum_init = snum_init_76;
else } else if (qe_num_of_snum == 28 || qe_num_of_snum == 46) {
snum_init = snum_init_46; snum_init = snum_init_46;
} else {
for (i = 0; i < qe_num_of_snum; i++) { pr_err("QE: unsupported value of fsl,qe-num-snums: %u\n", qe_num_of_snum);
snums[i].num = snum_init[i]; return;
snums[i].state = QE_SNUM_STATE_FREE;
} }
memcpy(snums, snum_init, qe_num_of_snum);
} }
int qe_get_snum(void) int qe_get_snum(void)
...@@ -324,12 +341,10 @@ int qe_get_snum(void) ...@@ -324,12 +341,10 @@ int qe_get_snum(void)
int i; int i;
spin_lock_irqsave(&qe_lock, flags); spin_lock_irqsave(&qe_lock, flags);
for (i = 0; i < qe_num_of_snum; i++) { i = find_first_zero_bit(snum_state, qe_num_of_snum);
if (snums[i].state == QE_SNUM_STATE_FREE) { if (i < qe_num_of_snum) {
snums[i].state = QE_SNUM_STATE_USED; set_bit(i, snum_state);
snum = snums[i].num; snum = snums[i];
break;
}
} }
spin_unlock_irqrestore(&qe_lock, flags); spin_unlock_irqrestore(&qe_lock, flags);
...@@ -339,14 +354,10 @@ EXPORT_SYMBOL(qe_get_snum); ...@@ -339,14 +354,10 @@ EXPORT_SYMBOL(qe_get_snum);
void qe_put_snum(u8 snum) void qe_put_snum(u8 snum)
{ {
int i; const u8 *p = memchr(snums, snum, qe_num_of_snum);
for (i = 0; i < qe_num_of_snum; i++) { if (p)
if (snums[i].num == snum) { clear_bit(p - snums, snum_state);
snums[i].state = QE_SNUM_STATE_FREE;
break;
}
}
} }
EXPORT_SYMBOL(qe_put_snum); EXPORT_SYMBOL(qe_put_snum);
...@@ -572,16 +583,9 @@ struct qe_firmware_info *qe_get_firmware_info(void) ...@@ -572,16 +583,9 @@ struct qe_firmware_info *qe_get_firmware_info(void)
initialized = 1; initialized = 1;
/* qe = qe_get_device_node();
* Newer device trees have an "fsl,qe" compatible property for the QE if (!qe)
* node, but we still need to support older device trees. return NULL;
*/
qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
if (!qe) {
qe = of_find_node_by_type(NULL, "qe");
if (!qe)
return NULL;
}
/* Find the 'firmware' child node */ /* Find the 'firmware' child node */
fw = of_get_child_by_name(qe, "firmware"); fw = of_get_child_by_name(qe, "firmware");
...@@ -627,16 +631,9 @@ unsigned int qe_get_num_of_risc(void) ...@@ -627,16 +631,9 @@ unsigned int qe_get_num_of_risc(void)
unsigned int num_of_risc = 0; unsigned int num_of_risc = 0;
const u32 *prop; const u32 *prop;
qe = of_find_compatible_node(NULL, NULL, "fsl,qe"); qe = qe_get_device_node();
if (!qe) { if (!qe)
/* Older devices trees did not have an "fsl,qe" return num_of_risc;
* compatible property, so we need to look for
* the QE node by name.
*/
qe = of_find_node_by_type(NULL, "qe");
if (!qe)
return num_of_risc;
}
prop = of_get_property(qe, "fsl,qe-num-riscs", &size); prop = of_get_property(qe, "fsl,qe-num-riscs", &size);
if (prop && size == sizeof(*prop)) if (prop && size == sizeof(*prop))
...@@ -650,37 +647,7 @@ EXPORT_SYMBOL(qe_get_num_of_risc); ...@@ -650,37 +647,7 @@ EXPORT_SYMBOL(qe_get_num_of_risc);
unsigned int qe_get_num_of_snums(void) unsigned int qe_get_num_of_snums(void)
{ {
struct device_node *qe; return qe_num_of_snum;
int size;
unsigned int num_of_snums;
const u32 *prop;
num_of_snums = 28; /* The default number of snum for threads is 28 */
qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
if (!qe) {
/* Older devices trees did not have an "fsl,qe"
* compatible property, so we need to look for
* the QE node by name.
*/
qe = of_find_node_by_type(NULL, "qe");
if (!qe)
return num_of_snums;
}
prop = of_get_property(qe, "fsl,qe-num-snums", &size);
if (prop && size == sizeof(*prop)) {
num_of_snums = *prop;
if ((num_of_snums < 28) || (num_of_snums > QE_NUM_OF_SNUM)) {
/* No QE ever has fewer than 28 SNUMs */
pr_err("QE: number of snum is invalid\n");
of_node_put(qe);
return -EINVAL;
}
}
of_node_put(qe);
return num_of_snums;
} }
EXPORT_SYMBOL(qe_get_num_of_snums); EXPORT_SYMBOL(qe_get_num_of_snums);
......
...@@ -170,7 +170,7 @@ struct rcar_sysc_pd { ...@@ -170,7 +170,7 @@ struct rcar_sysc_pd {
struct generic_pm_domain genpd; struct generic_pm_domain genpd;
struct rcar_sysc_ch ch; struct rcar_sysc_ch ch;
unsigned int flags; unsigned int flags;
char name[0]; char name[];
}; };
static inline struct rcar_sysc_pd *to_rcar_pd(struct generic_pm_domain *d) static inline struct rcar_sysc_pd *to_rcar_pd(struct generic_pm_domain *d)
......
...@@ -148,6 +148,7 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg) ...@@ -148,6 +148,7 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
*/ */
optee_cq_wait_for_completion(&optee->call_queue, &w); optee_cq_wait_for_completion(&optee->call_queue, &w);
} else if (OPTEE_SMC_RETURN_IS_RPC(res.a0)) { } else if (OPTEE_SMC_RETURN_IS_RPC(res.a0)) {
might_sleep();
param.a0 = res.a0; param.a0 = res.a0;
param.a1 = res.a1; param.a1 = res.a1;
param.a2 = res.a2; param.a2 = res.a2;
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Constant for device tree bindings for Turris Mox module configuration bus
*
* Copyright (C) 2019 Marek Behun <marek.behun@nic.cz>
*/
#ifndef _DT_BINDINGS_BUS_MOXTET_H
#define _DT_BINDINGS_BUS_MOXTET_H
#define MOXTET_IRQ_PCI 0
#define MOXTET_IRQ_USB3 4
#define MOXTET_IRQ_PERIDOT(n) (8 + (n))
#define MOXTET_IRQ_TOPAZ 12
#endif /* _DT_BINDINGS_BUS_MOXTET_H */
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/* /*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright (c) 2016 BayLibre, SAS. * Copyright (c) 2016 BayLibre, SAS.
* Author: Neil Armstrong <narmstrong@baylibre.com> * Author: Neil Armstrong <narmstrong@baylibre.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
* The full GNU General Public License is included in this distribution
* in the file called COPYING.
*
* BSD LICENSE
*
* Copyright (c) 2016 BayLibre, SAS.
* Author: Neil Armstrong <narmstrong@baylibre.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _DT_BINDINGS_AMLOGIC_MESON_GXBB_RESET_H #ifndef _DT_BINDINGS_AMLOGIC_MESON_GXBB_RESET_H
#define _DT_BINDINGS_AMLOGIC_MESON_GXBB_RESET_H #define _DT_BINDINGS_AMLOGIC_MESON_GXBB_RESET_H
......
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/* /*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright (c) 2016 BayLibre, SAS. * Copyright (c) 2016 BayLibre, SAS.
* Author: Neil Armstrong <narmstrong@baylibre.com> * Author: Neil Armstrong <narmstrong@baylibre.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
* The full GNU General Public License is included in this distribution
* in the file called COPYING.
*
* BSD LICENSE
*
* Copyright (c) 2016 BayLibre, SAS.
* Author: Neil Armstrong <narmstrong@baylibre.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _DT_BINDINGS_AMLOGIC_MESON8B_RESET_H #ifndef _DT_BINDINGS_AMLOGIC_MESON8B_RESET_H
#define _DT_BINDINGS_AMLOGIC_MESON8B_RESET_H #define _DT_BINDINGS_AMLOGIC_MESON8B_RESET_H
......
...@@ -31,33 +31,33 @@ ...@@ -31,33 +31,33 @@
#define IMX8MQ_RESET_OTG2_PHY_RESET 20 #define IMX8MQ_RESET_OTG2_PHY_RESET 20
#define IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N 21 #define IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N 21
#define IMX8MQ_RESET_MIPI_DSI_RESET_N 22 #define IMX8MQ_RESET_MIPI_DSI_RESET_N 22
#define IMX8MQ_RESET_MIPI_DIS_DPI_RESET_N 23 #define IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N 23
#define IMX8MQ_RESET_MIPI_DIS_ESC_RESET_N 24 #define IMX8MQ_RESET_MIPI_DSI_ESC_RESET_N 24
#define IMX8MQ_RESET_MIPI_DIS_PCLK_RESET_N 25 #define IMX8MQ_RESET_MIPI_DSI_PCLK_RESET_N 25
#define IMX8MQ_RESET_PCIEPHY 26 #define IMX8MQ_RESET_PCIEPHY 26
#define IMX8MQ_RESET_PCIEPHY_PERST 27 #define IMX8MQ_RESET_PCIEPHY_PERST 27
#define IMX8MQ_RESET_PCIE_CTRL_APPS_EN 28 #define IMX8MQ_RESET_PCIE_CTRL_APPS_EN 28
#define IMX8MQ_RESET_PCIE_CTRL_APPS_TURNOFF 29 #define IMX8MQ_RESET_PCIE_CTRL_APPS_TURNOFF 29
#define IMX8MQ_RESET_HDMI_PHY_APB_RESET 30 #define IMX8MQ_RESET_HDMI_PHY_APB_RESET 30 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_DISP_RESET 31 #define IMX8MQ_RESET_DISP_RESET 31
#define IMX8MQ_RESET_GPU_RESET 32 #define IMX8MQ_RESET_GPU_RESET 32
#define IMX8MQ_RESET_VPU_RESET 33 #define IMX8MQ_RESET_VPU_RESET 33
#define IMX8MQ_RESET_PCIEPHY2 34 #define IMX8MQ_RESET_PCIEPHY2 34 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_PCIEPHY2_PERST 35 #define IMX8MQ_RESET_PCIEPHY2_PERST 35 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_PCIE2_CTRL_APPS_EN 36 #define IMX8MQ_RESET_PCIE2_CTRL_APPS_EN 36 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_PCIE2_CTRL_APPS_TURNOFF 37 #define IMX8MQ_RESET_PCIE2_CTRL_APPS_TURNOFF 37 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_MIPI_CSI1_CORE_RESET 38 #define IMX8MQ_RESET_MIPI_CSI1_CORE_RESET 38 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_MIPI_CSI1_PHY_REF_RESET 39 #define IMX8MQ_RESET_MIPI_CSI1_PHY_REF_RESET 39 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_MIPI_CSI1_ESC_RESET 40 #define IMX8MQ_RESET_MIPI_CSI1_ESC_RESET 40 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_MIPI_CSI2_CORE_RESET 41 #define IMX8MQ_RESET_MIPI_CSI2_CORE_RESET 41 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_MIPI_CSI2_PHY_REF_RESET 42 #define IMX8MQ_RESET_MIPI_CSI2_PHY_REF_RESET 42 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_MIPI_CSI2_ESC_RESET 43 #define IMX8MQ_RESET_MIPI_CSI2_ESC_RESET 43 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_DDRC1_PRST 44 #define IMX8MQ_RESET_DDRC1_PRST 44
#define IMX8MQ_RESET_DDRC1_CORE_RESET 45 #define IMX8MQ_RESET_DDRC1_CORE_RESET 45
#define IMX8MQ_RESET_DDRC1_PHY_RESET 46 #define IMX8MQ_RESET_DDRC1_PHY_RESET 46
#define IMX8MQ_RESET_DDRC2_PRST 47 #define IMX8MQ_RESET_DDRC2_PRST 47 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_DDRC2_CORE_RESET 48 #define IMX8MQ_RESET_DDRC2_CORE_RESET 48 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_DDRC2_PHY_RESET 49 #define IMX8MQ_RESET_DDRC2_PHY_RESET 49 /* i.MX8MM does NOT support */
#define IMX8MQ_RESET_NUM 50 #define IMX8MQ_RESET_NUM 50
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Turris Mox module configuration bus driver
*
* Copyright (C) 2019 Marek Behun <marek.behun@nic.cz>
*/
#ifndef __LINUX_MOXTET_H
#define __LINUX_MOXTET_H
#include <linux/device.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/mutex.h>
#define TURRIS_MOX_MAX_MODULES 10
enum turris_mox_cpu_module_id {
TURRIS_MOX_CPU_ID_EMMC = 0x00,
TURRIS_MOX_CPU_ID_SD = 0x10,
};
enum turris_mox_module_id {
TURRIS_MOX_MODULE_FIRST = 0x01,
TURRIS_MOX_MODULE_SFP = 0x01,
TURRIS_MOX_MODULE_PCI = 0x02,
TURRIS_MOX_MODULE_TOPAZ = 0x03,
TURRIS_MOX_MODULE_PERIDOT = 0x04,
TURRIS_MOX_MODULE_USB3 = 0x05,
TURRIS_MOX_MODULE_PCI_BRIDGE = 0x06,
TURRIS_MOX_MODULE_LAST = 0x06,
};
#define MOXTET_NIRQS 16
extern struct bus_type moxtet_type;
struct moxtet {
struct device *dev;
struct mutex lock;
u8 modules[TURRIS_MOX_MAX_MODULES];
int count;
u8 tx[TURRIS_MOX_MAX_MODULES];
int dev_irq;
struct {
struct irq_domain *domain;
struct irq_chip chip;
unsigned long masked, exists;
struct moxtet_irqpos {
u8 idx;
u8 bit;
} position[MOXTET_NIRQS];
} irq;
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_root;
#endif
};
struct moxtet_driver {
const enum turris_mox_module_id *id_table;
struct device_driver driver;
};
static inline struct moxtet_driver *
to_moxtet_driver(struct device_driver *drv)
{
if (!drv)
return NULL;
return container_of(drv, struct moxtet_driver, driver);
}
extern int __moxtet_register_driver(struct module *owner,
struct moxtet_driver *mdrv);
static inline void moxtet_unregister_driver(struct moxtet_driver *mdrv)
{
if (mdrv)
driver_unregister(&mdrv->driver);
}
#define moxtet_register_driver(driver) \
__moxtet_register_driver(THIS_MODULE, driver)
#define module_moxtet_driver(__moxtet_driver) \
module_driver(__moxtet_driver, moxtet_register_driver, \
moxtet_unregister_driver)
struct moxtet_device {
struct device dev;
struct moxtet *moxtet;
enum turris_mox_module_id id;
unsigned int idx;
};
extern int moxtet_device_read(struct device *dev);
extern int moxtet_device_write(struct device *dev, u8 val);
extern int moxtet_device_written(struct device *dev);
static inline struct moxtet_device *
to_moxtet_device(struct device *dev)
{
if (!dev)
return NULL;
return container_of(dev, struct moxtet_device, dev);
}
#endif /* __LINUX_MOXTET_H */
// SPDX-License-Identifier: GPL-2.0 /* SPDX-License-Identifier: GPL-2.0-only */
/* /*
* SCMI Message Protocol driver header * SCMI Message Protocol driver header
* *
...@@ -71,7 +71,7 @@ struct scmi_clk_ops { ...@@ -71,7 +71,7 @@ struct scmi_clk_ops {
int (*rate_get)(const struct scmi_handle *handle, u32 clk_id, int (*rate_get)(const struct scmi_handle *handle, u32 clk_id,
u64 *rate); u64 *rate);
int (*rate_set)(const struct scmi_handle *handle, u32 clk_id, int (*rate_set)(const struct scmi_handle *handle, u32 clk_id,
u32 config, u64 rate); u64 rate);
int (*enable)(const struct scmi_handle *handle, u32 clk_id); int (*enable)(const struct scmi_handle *handle, u32 clk_id);
int (*disable)(const struct scmi_handle *handle, u32 clk_id); int (*disable)(const struct scmi_handle *handle, u32 clk_id);
}; };
...@@ -145,6 +145,8 @@ struct scmi_sensor_info { ...@@ -145,6 +145,8 @@ struct scmi_sensor_info {
u32 id; u32 id;
u8 type; u8 type;
s8 scale; s8 scale;
u8 num_trip_points;
bool async;
char name[SCMI_MAX_STR_SIZE]; char name[SCMI_MAX_STR_SIZE];
}; };
...@@ -167,9 +169,9 @@ enum scmi_sensor_class { ...@@ -167,9 +169,9 @@ enum scmi_sensor_class {
* *
* @count_get: get the count of sensors provided by SCMI * @count_get: get the count of sensors provided by SCMI
* @info_get: get the information of the specified sensor * @info_get: get the information of the specified sensor
* @configuration_set: control notifications on cross-over events for * @trip_point_notify: control notifications on cross-over events for
* the trip-points * the trip-points
* @trip_point_set: selects and configures a trip-point of interest * @trip_point_config: selects and configures a trip-point of interest
* @reading_get: gets the current value of the sensor * @reading_get: gets the current value of the sensor
*/ */
struct scmi_sensor_ops { struct scmi_sensor_ops {
...@@ -177,12 +179,32 @@ struct scmi_sensor_ops { ...@@ -177,12 +179,32 @@ struct scmi_sensor_ops {
const struct scmi_sensor_info *(*info_get) const struct scmi_sensor_info *(*info_get)
(const struct scmi_handle *handle, u32 sensor_id); (const struct scmi_handle *handle, u32 sensor_id);
int (*configuration_set)(const struct scmi_handle *handle, int (*trip_point_notify)(const struct scmi_handle *handle,
u32 sensor_id); u32 sensor_id, bool enable);
int (*trip_point_set)(const struct scmi_handle *handle, u32 sensor_id, int (*trip_point_config)(const struct scmi_handle *handle,
u8 trip_id, u64 trip_value); u32 sensor_id, u8 trip_id, u64 trip_value);
int (*reading_get)(const struct scmi_handle *handle, u32 sensor_id, int (*reading_get)(const struct scmi_handle *handle, u32 sensor_id,
bool async, u64 *value); u64 *value);
};
/**
* struct scmi_reset_ops - represents the various operations provided
* by SCMI Reset Protocol
*
* @num_domains_get: get the count of reset domains provided by SCMI
* @name_get: gets the name of a reset domain
* @latency_get: gets the reset latency for the specified reset domain
* @reset: resets the specified reset domain
* @assert: explicitly assert reset signal of the specified reset domain
* @deassert: explicitly deassert reset signal of the specified reset domain
*/
struct scmi_reset_ops {
int (*num_domains_get)(const struct scmi_handle *handle);
char *(*name_get)(const struct scmi_handle *handle, u32 domain);
int (*latency_get)(const struct scmi_handle *handle, u32 domain);
int (*reset)(const struct scmi_handle *handle, u32 domain);
int (*assert)(const struct scmi_handle *handle, u32 domain);
int (*deassert)(const struct scmi_handle *handle, u32 domain);
}; };
/** /**
...@@ -194,6 +216,7 @@ struct scmi_sensor_ops { ...@@ -194,6 +216,7 @@ struct scmi_sensor_ops {
* @perf_ops: pointer to set of performance protocol operations * @perf_ops: pointer to set of performance protocol operations
* @clk_ops: pointer to set of clock protocol operations * @clk_ops: pointer to set of clock protocol operations
* @sensor_ops: pointer to set of sensor protocol operations * @sensor_ops: pointer to set of sensor protocol operations
* @reset_ops: pointer to set of reset protocol operations
* @perf_priv: pointer to private data structure specific to performance * @perf_priv: pointer to private data structure specific to performance
* protocol(for internal use only) * protocol(for internal use only)
* @clk_priv: pointer to private data structure specific to clock * @clk_priv: pointer to private data structure specific to clock
...@@ -202,6 +225,8 @@ struct scmi_sensor_ops { ...@@ -202,6 +225,8 @@ struct scmi_sensor_ops {
* protocol(for internal use only) * protocol(for internal use only)
* @sensor_priv: pointer to private data structure specific to sensors * @sensor_priv: pointer to private data structure specific to sensors
* protocol(for internal use only) * protocol(for internal use only)
* @reset_priv: pointer to private data structure specific to reset
* protocol(for internal use only)
*/ */
struct scmi_handle { struct scmi_handle {
struct device *dev; struct device *dev;
...@@ -210,11 +235,13 @@ struct scmi_handle { ...@@ -210,11 +235,13 @@ struct scmi_handle {
struct scmi_clk_ops *clk_ops; struct scmi_clk_ops *clk_ops;
struct scmi_power_ops *power_ops; struct scmi_power_ops *power_ops;
struct scmi_sensor_ops *sensor_ops; struct scmi_sensor_ops *sensor_ops;
struct scmi_reset_ops *reset_ops;
/* for protocol internal use */ /* for protocol internal use */
void *perf_priv; void *perf_priv;
void *clk_priv; void *clk_priv;
void *power_priv; void *power_priv;
void *sensor_priv; void *sensor_priv;
void *reset_priv;
}; };
enum scmi_std_protocol { enum scmi_std_protocol {
...@@ -224,6 +251,7 @@ enum scmi_std_protocol { ...@@ -224,6 +251,7 @@ enum scmi_std_protocol {
SCMI_PROTOCOL_PERF = 0x13, SCMI_PROTOCOL_PERF = 0x13,
SCMI_PROTOCOL_CLOCK = 0x14, SCMI_PROTOCOL_CLOCK = 0x14,
SCMI_PROTOCOL_SENSOR = 0x15, SCMI_PROTOCOL_SENSOR = 0x15,
SCMI_PROTOCOL_RESET = 0x16,
}; };
struct scmi_device { struct scmi_device {
......
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