mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Antony Pavlov <antonynpavlov@gmail.com>
Cc: "Clément Leger" <cleger@kalray.eu>, barebox@lists.infradead.org
Subject: Re: [RFC v3 1/5] PCI: initial commit
Date: Mon, 30 Jun 2014 12:18:23 +0200	[thread overview]
Message-ID: <1404123503.4305.16.camel@weser.hi.pengutronix.de> (raw)
In-Reply-To: <1403735538-25437-2-git-send-email-antonynpavlov@gmail.com>

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@gmail.com>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@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/  |


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-06-30 10:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25 22:32 [RFC v3 0/5] barebox PCI support Antony Pavlov
2014-06-25 22:32 ` [RFC v3 1/5] PCI: initial commit Antony Pavlov
2014-06-30 10:18   ` Lucas Stach [this message]
2014-07-01  7:29     ` Clément Léger
2014-07-01  7:48       ` Antony Pavlov
2014-06-25 22:32 ` [RFC v3 2/5] commands: add 'lspci' command Antony Pavlov
2014-06-30 10:21   ` Lucas Stach
2014-06-30 17:32     ` Antony Pavlov
2014-06-25 22:32 ` [RFC v3 3/5] net: add RealTek RTL-8139 PCI Ethernet driver Antony Pavlov
2014-06-25 22:32 ` [RFC v3 4/5] MIPS: add PCI support for GT64120-based Malta board Antony Pavlov
2014-06-25 22:32 ` [RFC v3 5/5] MIPS: qemu-malta_defconfig: enable PCI & network stuff Antony Pavlov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404123503.4305.16.camel@weser.hi.pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=cleger@kalray.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox