Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 141 additions & 0 deletions Documentation/devicetree/bindings/pci/spacemit,k1-pcie-rc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/pci/spacemit,k1-pcie-rc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: SpacemiT K1 PCI Express Root Complex

maintainers:
- Alex Elder <elder@riscstar.com>

description:
The SpacemiT K1 SoC PCIe root complex controller is based on the
Synopsys DesignWare PCIe IP.

properties:
compatible:
const: spacemit,k1-pcie-rc.yaml

reg:
items:
- description: DesignWare PCIe registers
- description: ATU address space
- description: PCIe configuration space
- description: Link control registers

reg-names:
items:
- const: dbi
- const: atu
- const: config
- const: link

clocks:
items:
- description: DWC PCIe Data Bus Interface (DBI) clock
- description: DWC PCIe application AXI-bus Master interface clock
- description: DWC PCIe application AXI-bus Slave interface clock.

clock-names:
items:
- const: dbi
- const: mstr
- const: slv

resets:
items:
- description: DWC PCIe Data Bus Interface (DBI) reset
- description: DWC PCIe application AXI-bus Master interface reset
- description: DWC PCIe application AXI-bus Slave interface reset.
- description: Global reset; must be deasserted for PHY to function

reset-names:
items:
- const: dbi
- const: mstr
- const: slv
- const: global

interrupts-extended:
maxItems: 1

spacemit,syscon-pmu:
description:
PHandle that refers to the APMU system controller, whose
regmap is used in managing resets and link state.
$ref: /schemas/types.yaml#/definitions/phandle

device_type:
const: pci

max-link-speed:
const: 2

num-viewport:
const: 8

required:
- compatible
- reg
- clocks
- clock-names
- resets
- reset-names
- spacemit,syscon-pmu
- "#address-cells"
- "#size-cells"
- device_type
- max-link-speed
- bus-range
- num-viewport

additionalProperties: false

examples:
- |
#include <dt-bindings/clock/spacemit,k1-syscon.h>
pcie0: pcie@ca000000 {
compatible = "spacemit,k1-pcie-rc";
reg = <0x0 0xca000000 0x0 0x00001000>,
<0x0 0xca300000 0x0 0x0001ff24>,
<0x0 0x8f000000 0x0 0x00002000>,
<0x0 0xc0b20000 0x0 0x00001000>;
reg-names = "dbi",
"atu",
"config",
"link";

ranges = <0x01000000 0x8f002000 0x0 0x8f002000 0x0 0x100000>,
<0x02000000 0x80000000 0x0 0x80000000 0x0 0x0f000000>;

clocks = <&syscon_apmu CLK_PCIE0_DBI>,
<&syscon_apmu CLK_PCIE0_MASTER>,
<&syscon_apmu CLK_PCIE0_SLAVE>;
clock-names = "dbi",
"mstr",
"slv";

resets = <&syscon_apmu RESET_PCIE0_DBI>,
<&syscon_apmu RESET_PCIE0_MASTER>,
<&syscon_apmu RESET_PCIE0_SLAVE>,
<&syscon_apmu RESET_PCIE0_GLOBAL>;
reset-names = "dbi",
"mstr",
"slv",
"global";

interrupts-extended = <&plic 141>;

spacemit,syscon-pmu = <&syscon_apmu 0x03cc>;

#address-cells = <3>;
#size-cells = <2>;

device_type = "pci";
max-link-speed = <2>;
bus-range = <0x00 0xff>;
num-viewport = <8>;

status = "disabled";
};
110 changes: 110 additions & 0 deletions Documentation/devicetree/bindings/phy/spacemit,k1-combo-phy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/phy/spacemit,k1-combo-phy.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: SpacemiT K1 PCIe/USB3 Combo PHY

maintainers:
- Alex Elder <elder@riscstar.com>

description:
Of the three PHYs on the SpacemiT K1 SoC capable of being used for
PCIe, one is a combo PHY that can also be configured for use by a
USB 3 controller. Using PCIe or USB 3 is a board design decision.

The combo PHY is also the only PCIe PHY that is able to determine
PCIe calibration values to use, and this must be determined before
the other two PCIe PHYs can be used. This calibration must be
performed with the combo PHY in PCIe mode, and is this is done
when the combo PHY is probed.

During normal operation, the PCIe or USB port driver is responsible
for ensuring all clocks needed by a PHY are enabled, and all resets
affecting the PHY are deasserted. However, for the combo PHY to
perform calibration independent of whether it's later used for
PCIe or USB, all PCIe mode clocks and resets must be defined.

properties:
compatible:
const: spacemit,k1-combo-phy

reg:
items:
- description: PHY control registers

clocks:
items:
- description: DWC PCIe Data Bus Interface (DBI) clock
- description: DWC PCIe application AXI-bus Master interface clock
- description: DWC PCIe application AXI-bus Slave interface clock.

clock-names:
items:
- const: dbi
- const: mstr
- const: slv

resets:
items:
- description: DWC PCIe Data Bus Interface (DBI) reset
- description: DWC PCIe application AXI-bus Master interface reset
- description: DWC PCIe application AXI-bus Slave interface reset.
- description: Global reset; must be deasserted for PHY to function

reset-names:
items:
- const: dbi
- const: mstr
- const: slv
- const: global

spacemit,syscon-pmu:
description:
PHandle that refers to the APMU system controller, whose
regmap is used in setting the mode
$ref: /schemas/types.yaml#/definitions/phandle

"#phy-cells":
const: 1
description:
The argument value (PHY_TYPE_PCIE or PHY_TYPE_USB3) determines
whether the PHY operates in PCIe or USB3 mode.

required:
- compatible
- reg
- clocks
- clock-names
- resets
- reset-names
- spacemit,syscon-pmu
- "#phy-cells"

additionalProperties: false

examples:
- |
#include <dt-bindings/clock/spacemit,k1-syscon.h>
combo_phy: phy@c0b10000 {
compatible = "spacemit,k1-combo-phy";
reg = <0xc0b10000 0x1000>;
clocks = <&syscon_apmu CLK_PCIE0_DBI>,
<&syscon_apmu CLK_PCIE0_MASTER>,
<&syscon_apmu CLK_PCIE0_SLAVE>;
clock-names = "dbi",
"mstr",
"slv";
resets = <&syscon_apmu RESET_PCIE0_DBI>,
<&syscon_apmu RESET_PCIE0_MASTER>,
<&syscon_apmu RESET_PCIE0_SLAVE>,
<&syscon_apmu RESET_PCIE0_GLOBAL>;
reset-names = "dbi",
"mstr",
"slv",
"global";
spacemit,syscon-pmu = <&syscon_apmu>;
#phy-cells = <1>;
status = "disabled";
};
49 changes: 49 additions & 0 deletions Documentation/devicetree/bindings/phy/spacemit,k1-pcie-phy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/phy/spacemit,k1-pcie-phy.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: SpacemiT K1 PCIe PHY

maintainers:
- Alex Elder <elder@riscstar.com>

description:
There are two PHYs on the SpacemiT K1 SoC used for PCIe (only).
These PHYs must be configured using calibration values that are
determined by a third "combo PHY". The combo PHY determines
these calibration values during probe so they can be used for
the two PCIe-only PHYs.

During normal operation, the PCIe port driver is responsible for
ensuring all clocks needed by a PHY are enabled, and all resets
affecting the PHY are deasserted.

properties:
compatible:
const: spacemit,k1-pcie-phy

reg:
items:
- description: PHY control registers

"#phy-cells":
const: 0

required:
- compatible
- reg
- "#phy-cells"

additionalProperties: false

examples:
- |
#include <dt-bindings/clock/spacemit,k1-syscon.h>
pcie1_phy: phy@c0c10000 {
compatible = "spacemit,k1-pcie-phy";
reg = <0xc0c10000 0x1000>;
#phy-cells = <0>;
status = "disabled";
};
28 changes: 28 additions & 0 deletions arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,34 @@
status = "okay";
};

&combo_phy {
pinctrl-names = "default";
pinctrl-0 = <&pcie0_3_cfg>;
status = "okay";
};

&pcie1_phy {
pinctrl-names = "default";
pinctrl-0 = <&pcie1_3_cfg>;
status = "okay";
};

&pcie2_phy {
pinctrl-names = "default";
pinctrl-0 = <&pcie2_4_cfg>;
status = "okay";
};

&pcie1 {
phys = <&pcie1_phy>;
status = "okay";
};

&pcie2 {
phys = <&pcie2_phy>;
status = "okay";
};

&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_2_cfg>;
Expand Down
33 changes: 33 additions & 0 deletions arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,39 @@
};
};

pcie0_3_cfg: pcie0-3-cfg {
pcie0-3-pins {
pinmux = <K1_PADCONF(54, 3)>, /* PERST# */
<K1_PADCONF(55, 3)>, /* WAKE */
<K1_PADCONF(53, 3)>; /* CLKREQ# */

bias-pull-up = <0>;
drive-strength = <21>;
};
};

pcie1_3_cfg: pcie1-3-cfg {
pcie1-3-pins {
pinmux = <K1_PADCONF(59, 4)>, /* PERST# */
<K1_PADCONF(60, 4)>, /* WAKE */
<K1_PADCONF(61, 4)>; /* CLKREQ# */

bias-pull-up = <0>;
drive-strength = <21>;
};
};

pcie2_4_cfg: pcie2-4-cfg {
pcie2-4-pins {
pinmux = <K1_PADCONF(62, 4)>, /* PERST# */
<K1_PADCONF(112, 3)>, /* WAKE */
<K1_PADCONF(117, 4)>; /* CLKREQ# */

bias-pull-up = <0>;
drive-strength = <21>;
};
};

pwm14_1_cfg: pwm14-1-cfg {
pwm14-1-pins {
pinmux = <K1_PADCONF(44, 4)>;
Expand Down
Loading
Loading