Skip to content

Commit 4e639f1

Browse files
marcanMani-Sadhasivam
authored andcommitted
PCI: apple: Add T602x PCIe support
This version of the hardware moved around a bunch of registers, so we avoid the old compatible for these and introduce register offset structures to handle the differences. Signed-off-by: Hector Martin <[email protected]> Signed-off-by: Alyssa Rosenzweig <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Tested-by: Janne Grunau <[email protected]> Reviewed-by: Rob Herring (Arm) <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Alyssa Rosenzweig <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 3f1ccd6 commit 4e639f1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/pci/controller/pcie-apple.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@
124124
#define PORT_TUNSTAT_PERST_ACK_PEND BIT(1)
125125
#define PORT_PREFMEM_ENABLE 0x00994
126126

127+
/* T602x (M2-pro and co) */
128+
#define PORT_T602X_MSIADDR 0x016c
129+
#define PORT_T602X_MSIADDR_HI 0x0170
130+
#define PORT_T602X_PERST 0x082c
131+
#define PORT_T602X_RID2SID 0x3000
132+
#define PORT_T602X_MSIMAP 0x3800
133+
127134
#define PORT_MSIMAP_ENABLE BIT(31)
128135
#define PORT_MSIMAP_TARGET GENMASK(7, 0)
129136

@@ -158,6 +165,18 @@ static const struct hw_info t8103_hw = {
158165
.max_rid2sid = 64,
159166
};
160167

168+
static const struct hw_info t602x_hw = {
169+
.phy_lane_ctl = 0,
170+
.port_msiaddr = PORT_T602X_MSIADDR,
171+
.port_msiaddr_hi = PORT_T602X_MSIADDR_HI,
172+
.port_refclk = 0,
173+
.port_perst = PORT_T602X_PERST,
174+
.port_rid2sid = PORT_T602X_RID2SID,
175+
.port_msimap = PORT_T602X_MSIMAP,
176+
/* 16 on t602x, guess for autodetect on future HW */
177+
.max_rid2sid = 512,
178+
};
179+
161180
struct apple_pcie {
162181
struct mutex lock;
163182
struct device *dev;
@@ -425,6 +444,7 @@ static int apple_pcie_port_setup_irq(struct apple_pcie_port *port)
425444
/* Disable all interrupts */
426445
writel_relaxed(~0, port->base + PORT_INTMSK);
427446
writel_relaxed(~0, port->base + PORT_INTSTAT);
447+
writel_relaxed(~0, port->base + PORT_LINKCMDSTS);
428448

429449
irq_set_chained_handler_and_data(irq, apple_port_irq_handler, port);
430450

@@ -863,6 +883,7 @@ static int apple_pcie_probe(struct platform_device *pdev)
863883
}
864884

865885
static const struct of_device_id apple_pcie_of_match[] = {
886+
{ .compatible = "apple,t6020-pcie", .data = &t602x_hw },
866887
{ .compatible = "apple,pcie", .data = &t8103_hw },
867888
{ }
868889
};

0 commit comments

Comments
 (0)