Skip to content

Commit 751776f

Browse files
committed
Merge branch 'pci/controller/rzg3s-host'
- Use pci_generic_config_write(), not custom wrapper, since we don't need the writability provided by the wrapper (Claudiu Beznea) - Drop lock around RZG3S_PCI_MSIRS and RZG3S_PCI_PINTRCVIS updates since they are RW1C registers (Claudiu Beznea) - Fix a device node reference leak in rzg3s_pcie_host_parse_port() (Felix Gu) * pci/controller/rzg3s-host: PCI: rzg3s-host: Fix device node reference leak in rzg3s_pcie_host_parse_port() PCI: rzg3s-host: Drop the lock on RZG3S_PCI_MSIRS and RZG3S_PCI_PINTRCVIS PCI: rzg3s-host: Use pci_generic_config_write() for the root bus
2 parents 7e4d2a0 + e43e2aa commit 751776f

1 file changed

Lines changed: 9 additions & 28 deletions

File tree

drivers/pci/controller/pcie-rzg3s-host.c

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
#define RZG3S_PCI_PINTRCVIE_INTX(i) BIT(i)
7474
#define RZG3S_PCI_PINTRCVIE_MSI BIT(4)
7575

76+
/* Register is R/W1C, it doesn't require locking. */
7677
#define RZG3S_PCI_PINTRCVIS 0x114
7778
#define RZG3S_PCI_PINTRCVIS_INTX(i) BIT(i)
7879
#define RZG3S_PCI_PINTRCVIS_MSI BIT(4)
@@ -114,6 +115,8 @@
114115
#define RZG3S_PCI_MSIRE_ENA BIT(0)
115116

116117
#define RZG3S_PCI_MSIRM(id) (0x608 + (id) * 0x10)
118+
119+
/* Register is R/W1C, it doesn't require locking. */
117120
#define RZG3S_PCI_MSIRS(id) (0x60c + (id) * 0x10)
118121

119122
#define RZG3S_PCI_AWBASEL(id) (0x1000 + (id) * 0x20)
@@ -439,28 +442,9 @@ static void __iomem *rzg3s_pcie_root_map_bus(struct pci_bus *bus,
439442
return host->pcie + where;
440443
}
441444

442-
/* Serialized by 'pci_lock' */
443-
static int rzg3s_pcie_root_write(struct pci_bus *bus, unsigned int devfn,
444-
int where, int size, u32 val)
445-
{
446-
struct rzg3s_pcie_host *host = bus->sysdata;
447-
int ret;
448-
449-
/* Enable access control to the CFGU */
450-
writel_relaxed(RZG3S_PCI_PERM_CFG_HWINIT_EN,
451-
host->axi + RZG3S_PCI_PERM);
452-
453-
ret = pci_generic_config_write(bus, devfn, where, size, val);
454-
455-
/* Disable access control to the CFGU */
456-
writel_relaxed(0, host->axi + RZG3S_PCI_PERM);
457-
458-
return ret;
459-
}
460-
461445
static struct pci_ops rzg3s_pcie_root_ops = {
462446
.read = pci_generic_config_read,
463-
.write = rzg3s_pcie_root_write,
447+
.write = pci_generic_config_write,
464448
.map_bus = rzg3s_pcie_root_map_bus,
465449
};
466450

@@ -526,8 +510,6 @@ static void rzg3s_pcie_msi_irq_ack(struct irq_data *d)
526510
u8 reg_bit = d->hwirq % RZG3S_PCI_MSI_INT_PER_REG;
527511
u8 reg_id = d->hwirq / RZG3S_PCI_MSI_INT_PER_REG;
528512

529-
guard(raw_spinlock_irqsave)(&host->hw_lock);
530-
531513
writel_relaxed(BIT(reg_bit), host->axi + RZG3S_PCI_MSIRS(reg_id));
532514
}
533515

@@ -859,8 +841,6 @@ static void rzg3s_pcie_intx_irq_ack(struct irq_data *d)
859841
{
860842
struct rzg3s_pcie_host *host = irq_data_get_irq_chip_data(d);
861843

862-
guard(raw_spinlock_irqsave)(&host->hw_lock);
863-
864844
rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PINTRCVIS,
865845
RZG3S_PCI_PINTRCVIS_INTX(d->hwirq),
866846
RZG3S_PCI_PINTRCVIS_INTX(d->hwirq));
@@ -1065,14 +1045,14 @@ static int rzg3s_pcie_config_init(struct rzg3s_pcie_host *host)
10651045
writel_relaxed(0xffffffff, host->pcie + RZG3S_PCI_CFG_BARMSK00L);
10661046
writel_relaxed(0xffffffff, host->pcie + RZG3S_PCI_CFG_BARMSK00U);
10671047

1048+
/* Disable access control to the CFGU */
1049+
writel_relaxed(0, host->axi + RZG3S_PCI_PERM);
1050+
10681051
/* Update bus info */
10691052
writeb_relaxed(primary_bus, host->pcie + PCI_PRIMARY_BUS);
10701053
writeb_relaxed(secondary_bus, host->pcie + PCI_SECONDARY_BUS);
10711054
writeb_relaxed(subordinate_bus, host->pcie + PCI_SUBORDINATE_BUS);
10721055

1073-
/* Disable access control to the CFGU */
1074-
writel_relaxed(0, host->axi + RZG3S_PCI_PERM);
1075-
10761056
return 0;
10771057
}
10781058

@@ -1162,7 +1142,8 @@ static int rzg3s_pcie_resets_prepare_and_get(struct rzg3s_pcie_host *host)
11621142

11631143
static int rzg3s_pcie_host_parse_port(struct rzg3s_pcie_host *host)
11641144
{
1165-
struct device_node *of_port = of_get_next_child(host->dev->of_node, NULL);
1145+
struct device_node *of_port __free(device_node) =
1146+
of_get_next_child(host->dev->of_node, NULL);
11661147
struct rzg3s_pcie_port *port = &host->port;
11671148
int ret;
11681149

0 commit comments

Comments
 (0)