Skip to content

Commit f75a27d

Browse files
paliLorenzo Pieralisi
authored andcommitted
PCI: ftpci100: Use PCI_CONF1_ADDRESS() macro
Simplify pci-ftpci100.c driver code and use new PCI_CONF1_ADDRESS() macro for accessing PCI config space. Link: https://lore.kernel.org/r/20220924092404.31776-3-pali@kernel.org Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
1 parent 8a9b7ef commit f75a27d

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

drivers/pci/controller/pci-ftpci100.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,6 @@
103103
#define FARADAY_PCI_DMA_MEM2_BASE 0x00000000
104104
#define FARADAY_PCI_DMA_MEM3_BASE 0x00000000
105105

106-
/* Defines for PCI configuration command register */
107-
#define PCI_CONF_ENABLE BIT(31)
108-
#define PCI_CONF_WHERE(r) ((r) & 0xFC)
109-
#define PCI_CONF_BUS(b) (((b) & 0xFF) << 16)
110-
#define PCI_CONF_DEVICE(d) (((d) & 0x1F) << 11)
111-
#define PCI_CONF_FUNCTION(f) (((f) & 0x07) << 8)
112-
113106
/**
114107
* struct faraday_pci_variant - encodes IP block differences
115108
* @cascaded_irq: this host has cascaded IRQs from an interrupt controller
@@ -190,11 +183,8 @@ static int faraday_raw_pci_read_config(struct faraday_pci *p, int bus_number,
190183
unsigned int fn, int config, int size,
191184
u32 *value)
192185
{
193-
writel(PCI_CONF_BUS(bus_number) |
194-
PCI_CONF_DEVICE(PCI_SLOT(fn)) |
195-
PCI_CONF_FUNCTION(PCI_FUNC(fn)) |
196-
PCI_CONF_WHERE(config) |
197-
PCI_CONF_ENABLE,
186+
writel(PCI_CONF1_ADDRESS(bus_number, PCI_SLOT(fn),
187+
PCI_FUNC(fn), config),
198188
p->base + FTPCI_CONFIG);
199189

200190
*value = readl(p->base + FTPCI_DATA);
@@ -225,11 +215,8 @@ static int faraday_raw_pci_write_config(struct faraday_pci *p, int bus_number,
225215
{
226216
int ret = PCIBIOS_SUCCESSFUL;
227217

228-
writel(PCI_CONF_BUS(bus_number) |
229-
PCI_CONF_DEVICE(PCI_SLOT(fn)) |
230-
PCI_CONF_FUNCTION(PCI_FUNC(fn)) |
231-
PCI_CONF_WHERE(config) |
232-
PCI_CONF_ENABLE,
218+
writel(PCI_CONF1_ADDRESS(bus_number, PCI_SLOT(fn),
219+
PCI_FUNC(fn), config),
233220
p->base + FTPCI_CONFIG);
234221

235222
switch (size) {

0 commit comments

Comments
 (0)