Skip to content

Commit b8a98b6

Browse files
committed
Merge tag 'pci-v5.16-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI fixes from Bjorn Helgaas: - Revert emulation of Marvell Armada A3720 expansion ROM because it doesn't work as expected (Marek Behún) - Assert PERST# in Apple M1 driver to fix initialization when booting from bootloaders using PCIe, such as U-Boot (Marc Zyngier) - Describe PERST# as active low in Apple T8103 DT and update driver to match (Marc Zyngier) * tag 'pci-v5.16-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: PCI: apple: Fix PERST# polarity arm64: dts: apple: t8103: Mark PCIe PERST# polarity active low in DT PCI: apple: Follow the PCIe specifications when resetting the port Revert "PCI: aardvark: Fix support for PCI_ROM_ADDRESS1 on emulated bridge"
2 parents 2ca4b65 + 8762051 commit b8a98b6

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

arch/arm64/boot/dts/apple/t8103.dtsi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Copyright The Asahi Linux Contributors
88
*/
99

10+
#include <dt-bindings/gpio/gpio.h>
1011
#include <dt-bindings/interrupt-controller/apple-aic.h>
1112
#include <dt-bindings/interrupt-controller/irq.h>
1213
#include <dt-bindings/pinctrl/apple.h>
@@ -281,7 +282,7 @@
281282
port00: pci@0,0 {
282283
device_type = "pci";
283284
reg = <0x0 0x0 0x0 0x0 0x0>;
284-
reset-gpios = <&pinctrl_ap 152 0>;
285+
reset-gpios = <&pinctrl_ap 152 GPIO_ACTIVE_LOW>;
285286
max-link-speed = <2>;
286287

287288
#address-cells = <3>;
@@ -301,7 +302,7 @@
301302
port01: pci@1,0 {
302303
device_type = "pci";
303304
reg = <0x800 0x0 0x0 0x0 0x0>;
304-
reset-gpios = <&pinctrl_ap 153 0>;
305+
reset-gpios = <&pinctrl_ap 153 GPIO_ACTIVE_LOW>;
305306
max-link-speed = <2>;
306307

307308
#address-cells = <3>;
@@ -321,7 +322,7 @@
321322
port02: pci@2,0 {
322323
device_type = "pci";
323324
reg = <0x1000 0x0 0x0 0x0 0x0>;
324-
reset-gpios = <&pinctrl_ap 33 0>;
325+
reset-gpios = <&pinctrl_ap 33 GPIO_ACTIVE_LOW>;
325326
max-link-speed = <1>;
326327

327328
#address-cells = <3>;

drivers/pci/controller/pci-aardvark.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#define PCIE_CORE_DEV_ID_REG 0x0
3333
#define PCIE_CORE_CMD_STATUS_REG 0x4
3434
#define PCIE_CORE_DEV_REV_REG 0x8
35-
#define PCIE_CORE_EXP_ROM_BAR_REG 0x30
3635
#define PCIE_CORE_PCIEXP_CAP 0xc0
3736
#define PCIE_CORE_ERR_CAPCTL_REG 0x118
3837
#define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX BIT(5)
@@ -774,10 +773,6 @@ advk_pci_bridge_emul_base_conf_read(struct pci_bridge_emul *bridge,
774773
*value = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG);
775774
return PCI_BRIDGE_EMUL_HANDLED;
776775

777-
case PCI_ROM_ADDRESS1:
778-
*value = advk_readl(pcie, PCIE_CORE_EXP_ROM_BAR_REG);
779-
return PCI_BRIDGE_EMUL_HANDLED;
780-
781776
case PCI_INTERRUPT_LINE: {
782777
/*
783778
* From the whole 32bit register we support reading from HW only
@@ -810,10 +805,6 @@ advk_pci_bridge_emul_base_conf_write(struct pci_bridge_emul *bridge,
810805
advk_writel(pcie, new, PCIE_CORE_CMD_STATUS_REG);
811806
break;
812807

813-
case PCI_ROM_ADDRESS1:
814-
advk_writel(pcie, new, PCIE_CORE_EXP_ROM_BAR_REG);
815-
break;
816-
817808
case PCI_INTERRUPT_LINE:
818809
if (mask & (PCI_BRIDGE_CTL_BUS_RESET << 16)) {
819810
u32 val = advk_readl(pcie, PCIE_CORE_CTRL1_REG);

drivers/pci/controller/pcie-apple.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
516516
int ret, i;
517517

518518
reset = gpiod_get_from_of_node(np, "reset-gpios", 0,
519-
GPIOD_OUT_LOW, "#PERST");
519+
GPIOD_OUT_LOW, "PERST#");
520520
if (IS_ERR(reset))
521521
return PTR_ERR(reset);
522522

@@ -539,12 +539,22 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
539539

540540
rmw_set(PORT_APPCLK_EN, port->base + PORT_APPCLK);
541541

542+
/* Assert PERST# before setting up the clock */
543+
gpiod_set_value(reset, 1);
544+
542545
ret = apple_pcie_setup_refclk(pcie, port);
543546
if (ret < 0)
544547
return ret;
545548

549+
/* The minimal Tperst-clk value is 100us (PCIe CEM r5.0, 2.9.2) */
550+
usleep_range(100, 200);
551+
552+
/* Deassert PERST# */
546553
rmw_set(PORT_PERST_OFF, port->base + PORT_PERST);
547-
gpiod_set_value(reset, 1);
554+
gpiod_set_value(reset, 0);
555+
556+
/* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */
557+
msleep(100);
548558

549559
ret = readl_relaxed_poll_timeout(port->base + PORT_STATUS, stat,
550560
stat & PORT_STATUS_READY, 100, 250000);

0 commit comments

Comments
 (0)