Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c23bfc38 authored by Russell King's avatar Russell King
Browse files

ARM: PCI: provide a default bus scan implementation



Most PCI implementations perform simple root bus scanning.  Rather than
having each group of platforms provide a duplicated bus scan function,
provide the PCI configuration ops structure via the hw_pci structure,
and call the root bus scanning function from core ARM PCI code.

Acked-by: default avatarKrzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent daeb4c0c
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ static int it8152_pci_write_config(struct pci_bus *bus,
	return PCIBIOS_SUCCESSFUL;
}

static struct pci_ops it8152_ops = {
struct pci_ops it8152_ops = {
	.read = it8152_pci_read_config,
	.write = it8152_pci_write_config,
};
@@ -346,9 +346,4 @@ void pcibios_set_master(struct pci_dev *dev)
}


struct pci_bus * __init it8152_pci_scan_bus(int nr, struct pci_sys_data *sys)
{
	return pci_scan_root_bus(NULL, nr, &it8152_ops, sys, &sys->resources);
}

EXPORT_SYMBOL(dma_set_coherent_mask);
+1 −10
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ via82c505_write_config(struct pci_bus *bus, unsigned int devfn, int where,
	return PCIBIOS_SUCCESSFUL;
}

static struct pci_ops via82c505_ops = {
struct pci_ops via82c505_ops = {
	.read	= via82c505_read_config,
	.write	= via82c505_write_config,
};
@@ -81,12 +81,3 @@ int __init via82c505_setup(int nr, struct pci_sys_data *sys)
{
	return (nr == 0);
}

struct pci_bus * __init via82c505_scan_bus(int nr, struct pci_sys_data *sysdata)
{
	if (nr == 0)
		return pci_scan_root_bus(NULL, 0, &via82c505_ops, sysdata,
					 &sysdata->resources);

	return NULL;
}
+1 −1
Original line number Diff line number Diff line
@@ -110,6 +110,6 @@ extern void it8152_irq_demux(unsigned int irq, struct irq_desc *desc);
extern void it8152_init_irq(void);
extern int it8152_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
extern int it8152_pci_setup(int nr, struct pci_sys_data *sys);
extern struct pci_bus *it8152_pci_scan_bus(int nr, struct pci_sys_data *sys);
extern struct pci_ops it8152_ops;

#endif /* __ASM_HARDWARE_IT8152_H */
+6 −4
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#define __ASM_MACH_PCI_H

struct pci_sys_data;
struct pci_ops;
struct pci_bus;

struct hw_pci {
@@ -19,6 +20,7 @@ struct hw_pci {
	int		domain;
#endif
	struct list_head buses;
	struct pci_ops	*ops;
	int		nr_controllers;
	int		(*setup)(int nr, struct pci_sys_data *);
	struct pci_bus *(*scan)(int nr, struct pci_sys_data *);
@@ -56,22 +58,22 @@ void pci_common_init(struct hw_pci *);
/*
 * PCI controllers
 */
extern struct pci_ops iop3xx_ops;
extern int iop3xx_pci_setup(int nr, struct pci_sys_data *);
extern struct pci_bus *iop3xx_pci_scan_bus(int nr, struct pci_sys_data *);
extern void iop3xx_pci_preinit(void);
extern void iop3xx_pci_preinit_cond(void);

extern struct pci_ops dc21285_ops;
extern int dc21285_setup(int nr, struct pci_sys_data *);
extern struct pci_bus *dc21285_scan_bus(int nr, struct pci_sys_data *);
extern void dc21285_preinit(void);
extern void dc21285_postinit(void);

extern struct pci_ops via82c505_ops;
extern int via82c505_setup(int nr, struct pci_sys_data *);
extern struct pci_bus *via82c505_scan_bus(int nr, struct pci_sys_data *);
extern void via82c505_init(void *sysdata);

extern struct pci_ops pci_v3_ops;
extern int pci_v3_setup(int nr, struct pci_sys_data *);
extern struct pci_bus *pci_v3_scan_bus(int nr, struct pci_sys_data *);
extern void pci_v3_preinit(void);
extern void pci_v3_postinit(void);

+5 −1
Original line number Diff line number Diff line
@@ -452,7 +452,11 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
					 &iomem_resource, sys->mem_offset);
			}

			if (hw->scan)
				sys->bus = hw->scan(nr, sys);
			else
				sys->bus = pci_scan_root_bus(NULL, sys->busnr,
						hw->ops, sys, &sys->resources);

			if (!sys->bus)
				panic("PCI: unable to scan bus!");
Loading