Skip to content

Commit 30eccd3

Browse files
committed
Merge branch 'pci/controller/stm32'
- Update pinctrl documentation of initial states and use in runtime suspend/resume (Christian Bruel) - Add pinctrl_pm_select_init_state() for use by stm32 driver, which needs it during resume (Christian Bruel) - Add devicetree bindings and drivers for the STMicroelectronics STM32MP25 in host and endpoint modes (Christian Bruel) * pci/controller/stm32: MAINTAINERS: Add entry for ST STM32MP25 PCIe drivers PCI: stm32-ep: Add PCIe Endpoint support for STM32MP25 dt-bindings: PCI: Add STM32MP25 PCIe Endpoint bindings PCI: stm32: Add PCIe host support for STM32MP25 dt-bindings: PCI: Add STM32MP25 PCIe Root Complex bindings pinctrl: Add pinctrl_pm_select_init_state helper function Documentation: pinctrl: Describe PM helper functions for standard states.
2 parents 0157e11 + c86a24d commit 30eccd3

File tree

12 files changed

+1067
-2
lines changed

12 files changed

+1067
-2
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/pci/st,stm32-pcie-common.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: STM32MP25 PCIe RC/EP controller
8+
9+
maintainers:
10+
- Christian Bruel <christian.bruel@foss.st.com>
11+
12+
description:
13+
STM32MP25 PCIe RC/EP common properties
14+
15+
properties:
16+
clocks:
17+
maxItems: 1
18+
description: PCIe system clock
19+
20+
resets:
21+
maxItems: 1
22+
23+
power-domains:
24+
maxItems: 1
25+
26+
access-controllers:
27+
maxItems: 1
28+
29+
required:
30+
- clocks
31+
- resets
32+
33+
additionalProperties: true
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/pci/st,stm32-pcie-ep.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: STMicroelectronics STM32MP25 PCIe Endpoint
8+
9+
maintainers:
10+
- Christian Bruel <christian.bruel@foss.st.com>
11+
12+
description:
13+
PCIe endpoint controller based on the Synopsys DesignWare PCIe core.
14+
15+
allOf:
16+
- $ref: /schemas/pci/snps,dw-pcie-ep.yaml#
17+
- $ref: /schemas/pci/st,stm32-pcie-common.yaml#
18+
19+
properties:
20+
compatible:
21+
const: st,stm32mp25-pcie-ep
22+
23+
reg:
24+
items:
25+
- description: Data Bus Interface (DBI) registers.
26+
- description: Data Bus Interface (DBI) shadow registers.
27+
- description: Internal Address Translation Unit (iATU) registers.
28+
- description: PCIe configuration registers.
29+
30+
reg-names:
31+
items:
32+
- const: dbi
33+
- const: dbi2
34+
- const: atu
35+
- const: addr_space
36+
37+
reset-gpios:
38+
description: GPIO controlled connection to PERST# signal
39+
maxItems: 1
40+
41+
phys:
42+
maxItems: 1
43+
44+
required:
45+
- phys
46+
- reset-gpios
47+
48+
unevaluatedProperties: false
49+
50+
examples:
51+
- |
52+
#include <dt-bindings/clock/st,stm32mp25-rcc.h>
53+
#include <dt-bindings/gpio/gpio.h>
54+
#include <dt-bindings/phy/phy.h>
55+
#include <dt-bindings/reset/st,stm32mp25-rcc.h>
56+
57+
pcie-ep@48400000 {
58+
compatible = "st,stm32mp25-pcie-ep";
59+
reg = <0x48400000 0x400000>,
60+
<0x48500000 0x100000>,
61+
<0x48700000 0x80000>,
62+
<0x10000000 0x10000000>;
63+
reg-names = "dbi", "dbi2", "atu", "addr_space";
64+
clocks = <&rcc CK_BUS_PCIE>;
65+
phys = <&combophy PHY_TYPE_PCIE>;
66+
resets = <&rcc PCIE_R>;
67+
pinctrl-names = "default", "init";
68+
pinctrl-0 = <&pcie_pins_a>;
69+
pinctrl-1 = <&pcie_init_pins_a>;
70+
reset-gpios = <&gpioj 8 GPIO_ACTIVE_LOW>;
71+
access-controllers = <&rifsc 68>;
72+
power-domains = <&CLUSTER_PD>;
73+
};
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/pci/st,stm32-pcie-host.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: STMicroelectronics STM32MP25 PCIe Root Complex
8+
9+
maintainers:
10+
- Christian Bruel <christian.bruel@foss.st.com>
11+
12+
description:
13+
PCIe root complex controller based on the Synopsys DesignWare PCIe core.
14+
15+
allOf:
16+
- $ref: /schemas/pci/snps,dw-pcie.yaml#
17+
- $ref: /schemas/pci/st,stm32-pcie-common.yaml#
18+
19+
properties:
20+
compatible:
21+
const: st,stm32mp25-pcie-rc
22+
23+
reg:
24+
items:
25+
- description: Data Bus Interface (DBI) registers.
26+
- description: PCIe configuration registers.
27+
28+
reg-names:
29+
items:
30+
- const: dbi
31+
- const: config
32+
33+
msi-parent:
34+
maxItems: 1
35+
36+
patternProperties:
37+
'^pcie@[0-2],0$':
38+
type: object
39+
$ref: /schemas/pci/pci-pci-bridge.yaml#
40+
41+
properties:
42+
reg:
43+
maxItems: 1
44+
45+
phys:
46+
maxItems: 1
47+
48+
reset-gpios:
49+
description: GPIO controlled connection to PERST# signal
50+
maxItems: 1
51+
52+
wake-gpios:
53+
description: GPIO used as WAKE# input signal
54+
maxItems: 1
55+
56+
required:
57+
- phys
58+
- ranges
59+
60+
unevaluatedProperties: false
61+
62+
required:
63+
- interrupt-map
64+
- interrupt-map-mask
65+
- ranges
66+
- dma-ranges
67+
68+
unevaluatedProperties: false
69+
70+
examples:
71+
- |
72+
#include <dt-bindings/clock/st,stm32mp25-rcc.h>
73+
#include <dt-bindings/gpio/gpio.h>
74+
#include <dt-bindings/interrupt-controller/arm-gic.h>
75+
#include <dt-bindings/phy/phy.h>
76+
#include <dt-bindings/reset/st,stm32mp25-rcc.h>
77+
78+
pcie@48400000 {
79+
compatible = "st,stm32mp25-pcie-rc";
80+
device_type = "pci";
81+
reg = <0x48400000 0x400000>,
82+
<0x10000000 0x10000>;
83+
reg-names = "dbi", "config";
84+
#interrupt-cells = <1>;
85+
interrupt-map-mask = <0 0 0 7>;
86+
interrupt-map = <0 0 0 1 &intc 0 0 GIC_SPI 264 IRQ_TYPE_LEVEL_HIGH>,
87+
<0 0 0 2 &intc 0 0 GIC_SPI 265 IRQ_TYPE_LEVEL_HIGH>,
88+
<0 0 0 3 &intc 0 0 GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>,
89+
<0 0 0 4 &intc 0 0 GIC_SPI 267 IRQ_TYPE_LEVEL_HIGH>;
90+
#address-cells = <3>;
91+
#size-cells = <2>;
92+
ranges = <0x01000000 0x0 0x00000000 0x10010000 0x0 0x10000>,
93+
<0x02000000 0x0 0x10020000 0x10020000 0x0 0x7fe0000>,
94+
<0x42000000 0x0 0x18000000 0x18000000 0x0 0x8000000>;
95+
dma-ranges = <0x42000000 0x0 0x80000000 0x80000000 0x0 0x80000000>;
96+
clocks = <&rcc CK_BUS_PCIE>;
97+
resets = <&rcc PCIE_R>;
98+
msi-parent = <&v2m0>;
99+
access-controllers = <&rifsc 68>;
100+
power-domains = <&CLUSTER_PD>;
101+
102+
pcie@0,0 {
103+
device_type = "pci";
104+
reg = <0x0 0x0 0x0 0x0 0x0>;
105+
phys = <&combophy PHY_TYPE_PCIE>;
106+
wake-gpios = <&gpioh 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
107+
reset-gpios = <&gpioj 8 GPIO_ACTIVE_LOW>;
108+
#address-cells = <3>;
109+
#size-cells = <2>;
110+
ranges;
111+
};
112+
};

Documentation/driver-api/pin-control.rst

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,8 +1162,55 @@ pinmux core.
11621162
Pin control requests from drivers
11631163
=================================
11641164

1165-
When a device driver is about to probe the device core will automatically
1166-
attempt to issue ``pinctrl_get_select_default()`` on these devices.
1165+
When a device driver is about to probe, the device core attaches the
1166+
standard states if they are defined in the device tree by calling
1167+
``pinctrl_bind_pins()`` on these devices.
1168+
Possible standard state names are: "default", "init", "sleep" and "idle".
1169+
1170+
- if ``default`` is defined in the device tree, it is selected before
1171+
device probe.
1172+
1173+
- if ``init`` and ``default`` are defined in the device tree, the "init"
1174+
state is selected before the driver probe and the "default" state is
1175+
selected after the driver probe.
1176+
1177+
- the ``sleep`` and ``idle`` states are for power management and can only
1178+
be selected with the PM API bellow.
1179+
1180+
PM interfaces
1181+
=================
1182+
PM runtime suspend/resume might need to execute the same init sequence as
1183+
during probe. Since the predefined states are already attached to the
1184+
device, the driver can activate these states explicitly with the
1185+
following helper functions:
1186+
1187+
- ``pinctrl_pm_select_default_state()``
1188+
- ``pinctrl_pm_select_init_state()``
1189+
- ``pinctrl_pm_select_sleep_state()``
1190+
- ``pinctrl_pm_select_idle_state()``
1191+
1192+
For example, if resuming the device depend on certain pinmux states
1193+
1194+
.. code-block:: c
1195+
1196+
foo_suspend()
1197+
{
1198+
/* suspend device */
1199+
...
1200+
1201+
pinctrl_pm_select_sleep_state(dev);
1202+
}
1203+
1204+
foo_resume()
1205+
{
1206+
pinctrl_pm_select_init_state(dev);
1207+
1208+
/* resuming device */
1209+
...
1210+
1211+
pinctrl_pm_select_default_state(dev);
1212+
}
1213+
11671214
This way driver writers do not need to add any of the boilerplate code
11681215
of the type found below. However when doing fine-grained state selection
11691216
and not using the "default" state, you may have to do some device driver
@@ -1185,6 +1232,12 @@ operation and going to sleep, moving from the ``PINCTRL_STATE_DEFAULT`` to
11851232
``PINCTRL_STATE_SLEEP`` at runtime, re-biasing or even re-muxing pins to save
11861233
current in sleep mode.
11871234

1235+
Another case is when the pinctrl needs to switch to a certain mode during
1236+
probe and then revert to the default state at the end of probe. For example
1237+
a PINMUX may need to be configured as a GPIO during probe. In this case, use
1238+
``PINCTRL_STATE_INIT`` to switch state before probe, then move to
1239+
``PINCTRL_STATE_DEFAULT`` at the end of probe for normal operation.
1240+
11881241
A driver may request a certain control state to be activated, usually just the
11891242
default state like this:
11901243

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19377,6 +19377,13 @@ L: linux-samsung-soc@vger.kernel.org
1937719377
S: Maintained
1937819378
F: drivers/pci/controller/dwc/pci-exynos.c
1937919379

19380+
PCI DRIVER FOR STM32MP25
19381+
M: Christian Bruel <christian.bruel@foss.st.com>
19382+
L: linux-pci@vger.kernel.org
19383+
S: Maintained
19384+
F: Documentation/devicetree/bindings/pci/st,stm32-pcie-*.yaml
19385+
F: drivers/pci/controller/dwc/*stm32*
19386+
1938019387
PCI DRIVER FOR SYNOPSYS DESIGNWARE
1938119388
M: Jingoo Han <jingoohan1@gmail.com>
1938219389
M: Manivannan Sadhasivam <mani@kernel.org>

drivers/pci/controller/dwc/Kconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,30 @@ config PCIE_SPEAR13XX
424424
help
425425
Say Y here if you want PCIe support on SPEAr13XX SoCs.
426426

427+
config PCIE_STM32_HOST
428+
tristate "STMicroelectronics STM32MP25 PCIe Controller (host mode)"
429+
depends on ARCH_STM32 || COMPILE_TEST
430+
depends on PCI_MSI
431+
select PCIE_DW_HOST
432+
help
433+
Enables Root Complex (RC) support for the DesignWare core based PCIe
434+
controller found in STM32MP25 SoC.
435+
436+
This driver can also be built as a module. If so, the module
437+
will be called pcie-stm32.
438+
439+
config PCIE_STM32_EP
440+
tristate "STMicroelectronics STM32MP25 PCIe Controller (endpoint mode)"
441+
depends on ARCH_STM32 || COMPILE_TEST
442+
depends on PCI_ENDPOINT
443+
select PCIE_DW_EP
444+
help
445+
Enables Endpoint (EP) support for the DesignWare core based PCIe
446+
controller found in STM32MP25 SoC.
447+
448+
This driver can also be built as a module. If so, the module
449+
will be called pcie-stm32-ep.
450+
427451
config PCI_DRA7XX
428452
tristate
429453

drivers/pci/controller/dwc/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ obj-$(CONFIG_PCIE_UNIPHIER) += pcie-uniphier.o
3131
obj-$(CONFIG_PCIE_UNIPHIER_EP) += pcie-uniphier-ep.o
3232
obj-$(CONFIG_PCIE_VISCONTI_HOST) += pcie-visconti.o
3333
obj-$(CONFIG_PCIE_RCAR_GEN4) += pcie-rcar-gen4.o
34+
obj-$(CONFIG_PCIE_STM32_HOST) += pcie-stm32.o
35+
obj-$(CONFIG_PCIE_STM32_EP) += pcie-stm32-ep.o
3436

3537
# The following drivers are for devices that use the generic ACPI
3638
# pci_root.c driver but don't support standard ECAM config access.

0 commit comments

Comments
 (0)