[RFC v3 1/5] PCI: initial commit
Lucas Stach
l.stach at pengutronix.de
Mon Jun 30 03:18:23 PDT 2014
Hi Antony,
nice to see a new revision of this PCI stuff. I've used v2 as a base for
my Tegra PCI hacking during our Techweek.
This revision looks really good and I think it removes most of the
issues I've stumbled across. Some comments below.
Regards,
Lucas
Am Donnerstag, den 26.06.2014, 02:32 +0400 schrieb Antony Pavlov:
> used shorten version of linux-2.6.39 pci_ids.h
>
> Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
> drivers/Makefile | 1 +
> drivers/pci/Kconfig | 12 ++
> drivers/pci/Makefile | 8 ++
> drivers/pci/bus.c | 110 ++++++++++++++++
> drivers/pci/pci.c | 282 ++++++++++++++++++++++++++++++++++++++++
> include/linux/mod_devicetable.h | 20 +++
> include/linux/pci.h | 241 ++++++++++++++++++++++++++++++++++
> include/linux/pci_ids.h | 136 +++++++++++++++++++
> include/linux/pci_regs.h | 118 +++++++++++++++++
> 9 files changed, 928 insertions(+)
> create mode 100644 drivers/pci/Kconfig
> create mode 100644 drivers/pci/Makefile
> create mode 100644 drivers/pci/bus.c
> create mode 100644 drivers/pci/pci.c
> create mode 100644 include/linux/mod_devicetable.h
> create mode 100644 include/linux/pci.h
> create mode 100644 include/linux/pci_ids.h
> create mode 100644 include/linux/pci_regs.h
>
> diff --git a/drivers/Makefile b/drivers/Makefile
> index ef3604f..1990e86 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -26,3 +26,4 @@ obj-y += pinctrl/
> obj-y += bus/
> obj-$(CONFIG_REGULATOR) += regulator/
> obj-$(CONFIG_RESET_CONTROLLER) += reset/
> +obj-$(CONFIG_PCI) += pci/
Can we please move the Kconfig options for this into drivers/Kconfig? I
know you did it similar to the kernel, but it just does not feel right
to have those into the board/arch Kconfig. PCI is just another bus like
USB and the symbol HW_HAS_PCI should be enough to decide if we show this
options or not.
> diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
> new file mode 100644
> index 0000000..88b8dfb
> --- /dev/null
> +++ b/drivers/pci/Kconfig
> @@ -0,0 +1,12 @@
> +#
> +# PCI configuration
> +#
> +config PCI_DEBUG
> + bool "PCI Debugging"
> + depends on PCI
> + help
> + Say Y here if you want the PCI core to produce a bunch of debug
> + messages to the system log. Select this if you are having a
> + problem with PCI support and want to see more of what is going on.
> +
> + When in doubt, say N.
> diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
> new file mode 100644
> index 0000000..c7d43c3
> --- /dev/null
> +++ b/drivers/pci/Makefile
> @@ -0,0 +1,8 @@
> +#
> +# Makefile for the PCI bus specific drivers.
> +#
> +obj-y += pci.o bus.o
> +
> +ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG
> +
> +CPPFLAGS += $(ccflags-y)
[...]
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> new file mode 100644
> index 0000000..9bee73f
> --- /dev/null
> +++ b/drivers/pci/pci.c
> @@ -0,0 +1,282 @@
> +#include <common.h>
> +#include <linux/pci.h>
> +
> +#ifdef DEBUG
> +#define DBG(x...) printk(x)
> +#else
> +#define DBG(x...)
> +#endif
> +
> +static struct pci_controller *hose_head, **hose_tail = &hose_head;
> +
> +struct pci_bus *pci_root;
> +
This should really be a list, like it is in the kernel now. With the
introduction of PCI host controller drivers we have the situation where
a system may have more than one PCI root bus.
> +static struct pci_bus *pci_alloc_bus(void)
> +{
> + struct pci_bus *b;
> +
> + b = kzalloc(sizeof(*b), GFP_KERNEL);
> + if (b) {
> + INIT_LIST_HEAD(&b->node);
> + INIT_LIST_HEAD(&b->children);
> + INIT_LIST_HEAD(&b->devices);
> + INIT_LIST_HEAD(&b->slots);
> + INIT_LIST_HEAD(&b->resources);
> + }
> + return b;
> +}
> +
> +void register_pci_controller(struct pci_controller *hose)
> +{
> + struct pci_bus *bus;
> +
> + *hose_tail = hose;
> + hose_tail = &hose->next;
> +
> + bus = pci_alloc_bus();
> + hose->bus = bus;
> + bus->ops = hose->pci_ops;
> + bus->resource[0] = hose->mem_resource;
> + bus->resource[1] = hose->io_resource;
> +
> + pci_scan_bus(bus);
> +
> + pci_root = bus;
> +
> + return;
> +}
> +
[...]
--
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions | http://www.pengutronix.de/ |
More information about the barebox
mailing list