Skip to content

Commit 2bdd523

Browse files
parakabjorn-helgaas
authored andcommitted
PCI: mt7621: Add MediaTek MT7621 PCIe host controller driver
Add driver for the PCIe controller of the MT7621 SoC. [bhelgaas: rename from pci-mt7621.c to pcie-mt7621.c; also rename Kconfig symbol from PCI_MT7621 to PCIE_MT7621] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sergio Paracuellos <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]>
1 parent 27cee7d commit 2bdd523

File tree

10 files changed

+24
-134
lines changed

10 files changed

+24
-134
lines changed

arch/mips/ralink/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ choice
5151
select SYS_SUPPORTS_HIGHMEM
5252
select MIPS_GIC
5353
select CLKSRC_MIPS_GIC
54-
select HAVE_PCI if PCI_MT7621
54+
select HAVE_PCI
55+
select PCI_DRIVERS_GENERIC
5556
select SOC_BUS
5657
endchoice
5758

drivers/pci/controller/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ config PCIE_HISI_ERR
312312
Say Y here if you want error handling support
313313
for the PCIe controller's errors on HiSilicon HIP SoCs
314314

315+
config PCIE_MT7621
316+
tristate "MediaTek MT7621 PCIe Controller"
317+
depends on (RALINK && SOC_MT7621) || (MIPS && COMPILE_TEST)
318+
select PHY_MT7621_PCI
319+
default SOC_MT7621
320+
help
321+
This selects a driver for the MediaTek MT7621 PCIe Controller.
322+
315323
source "drivers/pci/controller/dwc/Kconfig"
316324
source "drivers/pci/controller/mobiveil/Kconfig"
317325
source "drivers/pci/controller/cadence/Kconfig"

drivers/pci/controller/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ obj-$(CONFIG_VMD) += vmd.o
3737
obj-$(CONFIG_PCIE_BRCMSTB) += pcie-brcmstb.o
3838
obj-$(CONFIG_PCI_LOONGSON) += pci-loongson.o
3939
obj-$(CONFIG_PCIE_HISI_ERR) += pcie-hisi-error.o
40+
obj-$(CONFIG_PCIE_MT7621) += pcie-mt7621.o
41+
4042
# pcie-hisi.o quirks are needed even without CONFIG_PCIE_DW
4143
obj-y += dwc/
4244
obj-y += mobiveil/

drivers/staging/mt7621-pci/pci-mt7621.c renamed to drivers/pci/controller/pcie-mt7621.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@
3030
#include <linux/reset.h>
3131
#include <linux/sys_soc.h>
3232

33-
/* MediaTek specific configuration registers */
33+
/* MediaTek-specific configuration registers */
3434
#define PCIE_FTS_NUM 0x70c
3535
#define PCIE_FTS_NUM_MASK GENMASK(15, 8)
3636
#define PCIE_FTS_NUM_L0(x) (((x) & 0xff) << 8)
3737

3838
/* Host-PCI bridge registers */
3939
#define RALINK_PCI_PCICFG_ADDR 0x0000
40-
#define RALINK_PCI_PCIMSK_ADDR 0x000C
40+
#define RALINK_PCI_PCIMSK_ADDR 0x000c
4141
#define RALINK_PCI_CONFIG_ADDR 0x0020
4242
#define RALINK_PCI_CONFIG_DATA 0x0024
4343
#define RALINK_PCI_MEMBASE 0x0028
44-
#define RALINK_PCI_IOBASE 0x002C
44+
#define RALINK_PCI_IOBASE 0x002c
4545

4646
/* PCIe RC control registers */
4747
#define RALINK_PCI_ID 0x0030
@@ -132,7 +132,7 @@ static inline void pcie_port_write(struct mt7621_pcie_port *port,
132132
static inline u32 mt7621_pci_get_cfgaddr(unsigned int bus, unsigned int slot,
133133
unsigned int func, unsigned int where)
134134
{
135-
return (((where & 0xF00) >> 8) << 24) | (bus << 16) | (slot << 11) |
135+
return (((where & 0xf00) >> 8) << 24) | (bus << 16) | (slot << 11) |
136136
(func << 8) | (where & 0xfc) | 0x80000000;
137137
}
138138

@@ -217,7 +217,7 @@ static int setup_cm_memory_region(struct pci_host_bridge *host)
217217

218218
entry = resource_list_first_type(&host->windows, IORESOURCE_MEM);
219219
if (!entry) {
220-
dev_err(dev, "Cannot get memory resource\n");
220+
dev_err(dev, "cannot get memory resource\n");
221221
return -EINVAL;
222222
}
223223

@@ -280,7 +280,7 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie,
280280
port->gpio_rst = devm_gpiod_get_index_optional(dev, "reset", slot,
281281
GPIOD_OUT_LOW);
282282
if (IS_ERR(port->gpio_rst)) {
283-
dev_err(dev, "Failed to get GPIO for PCIe%d\n", slot);
283+
dev_err(dev, "failed to get GPIO for PCIe%d\n", slot);
284284
err = PTR_ERR(port->gpio_rst);
285285
goto remove_reset;
286286
}
@@ -409,7 +409,7 @@ static int mt7621_pcie_init_ports(struct mt7621_pcie *pcie)
409409

410410
err = mt7621_pcie_init_port(port);
411411
if (err) {
412-
dev_err(dev, "Initiating port %d failed\n", slot);
412+
dev_err(dev, "initializing port %d failed\n", slot);
413413
list_del(&port->list);
414414
}
415415
}
@@ -476,7 +476,7 @@ static int mt7621_pcie_enable_ports(struct pci_host_bridge *host)
476476

477477
entry = resource_list_first_type(&host->windows, IORESOURCE_IO);
478478
if (!entry) {
479-
dev_err(dev, "Cannot get io resource\n");
479+
dev_err(dev, "cannot get io resource\n");
480480
return -EINVAL;
481481
}
482482

@@ -541,25 +541,25 @@ static int mt7621_pci_probe(struct platform_device *pdev)
541541

542542
err = mt7621_pcie_parse_dt(pcie);
543543
if (err) {
544-
dev_err(dev, "Parsing DT failed\n");
544+
dev_err(dev, "parsing DT failed\n");
545545
return err;
546546
}
547547

548548
err = mt7621_pcie_init_ports(pcie);
549549
if (err) {
550-
dev_err(dev, "Nothing connected in virtual bridges\n");
550+
dev_err(dev, "nothing connected in virtual bridges\n");
551551
return 0;
552552
}
553553

554554
err = mt7621_pcie_enable_ports(bridge);
555555
if (err) {
556-
dev_err(dev, "Error enabling pcie ports\n");
556+
dev_err(dev, "error enabling pcie ports\n");
557557
goto remove_resets;
558558
}
559559

560560
err = setup_cm_memory_region(bridge);
561561
if (err) {
562-
dev_err(dev, "Error setting up iocu mem regions\n");
562+
dev_err(dev, "error setting up iocu mem regions\n");
563563
goto remove_resets;
564564
}
565565

drivers/staging/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ source "drivers/staging/vc04_services/Kconfig"
8686

8787
source "drivers/staging/pi433/Kconfig"
8888

89-
source "drivers/staging/mt7621-pci/Kconfig"
90-
9189
source "drivers/staging/mt7621-dma/Kconfig"
9290

9391
source "drivers/staging/ralink-gdma/Kconfig"

drivers/staging/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ obj-$(CONFIG_KS7010) += ks7010/
3333
obj-$(CONFIG_GREYBUS) += greybus/
3434
obj-$(CONFIG_BCM2835_VCHIQ) += vc04_services/
3535
obj-$(CONFIG_PI433) += pi433/
36-
obj-$(CONFIG_PCI_MT7621) += mt7621-pci/
3736
obj-$(CONFIG_SOC_MT7621) += mt7621-dma/
3837
obj-$(CONFIG_DMA_RALINK) += ralink-gdma/
3938
obj-$(CONFIG_SOC_MT7621) += mt7621-dts/

drivers/staging/mt7621-pci/Kconfig

Lines changed: 0 additions & 8 deletions
This file was deleted.

drivers/staging/mt7621-pci/Makefile

Lines changed: 0 additions & 2 deletions
This file was deleted.

drivers/staging/mt7621-pci/TODO

Lines changed: 0 additions & 4 deletions
This file was deleted.

drivers/staging/mt7621-pci/mediatek,mt7621-pci.txt

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)