devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [RFC] Add AArch64 support for PCI
@ 2014-02-03 18:43 Liviu Dudau
  2014-02-03 18:43 ` [PATCH] arm64: Add architecture " Liviu Dudau
  0 siblings, 1 reply; 27+ messages in thread
From: Liviu Dudau @ 2014-02-03 18:43 UTC (permalink / raw)
  To: linux-pci, Bjorn Helgaas, Catalin Marinas, Will Deacon
  Cc: devicetree@vger.kernel.org, linaro-kernel, Arnd Bergmann, LKML,
	LAKML

Hi,

This patch adds support for PCI to AArch64. It is based on the patch posted
here [1] that adds support for creating generic host bridge structure from
device tree. With that in place, I was able to boot an FPGA platform that
has PCIe host bridge support and use a PCIe network card.

The API used is different from the one used by ARM architecture. There is
no pci_common_init_dev() function and no hw_pci structure, as that is no
longer needed. Once the last signature is added to the legal agreement, I
will post the host bridge driver code that I am using. Meanwhile, here
is an example of what the probe function looks like, posted as an example:

static int myhostbridge_probe(struct platform_device *pdev)
{
	int err;
	struct device_node *dev;
	struct pci_host_bridge *bridge;
	struct resource bus_range;
	struct myhostbridge_port *pp;
	LIST_HEAD(resources);

	dev = pdev->dev.of_node;

	if (!of_device_is_available(dev)) {
		pr_warn("%s: disabled\n", dev->full_name);
		return -ENODEV;
	}

	pp = kzalloc(sizeof(struct myhostbridge_port), GFP_KERNEL);
	if (!pp)
		return -ENOMEM;

	err = of_pci_parse_bus_range(dev, &bus_range);
	if (err) {
		bus_range.start = 0;
		bus_range.end = 255;
		bus_range.flags = IORESOURCE_BUS;
	}
	pci_add_resource(&resources, &bus_range);

	bridge = pci_host_bridge_of_init(&pdev->dev, 0, &myhostbridge_ops, pp, &resources);
	if (!bridge) {
		err = -EINVAL;
		goto bridge_init_fail;
	}

	err = myhostbridge_setup(bridge->bus);
	if (err)
		goto bridge_init_fail;

	/*
	 * Add flags here, this is just an example
	 */
	pci_add_flags(PCI_ENABLE_PROC_DOMAINS | PCI_COMPAT_DOMAIN_0);
	pci_add_flags(PCI_REASSIGN_ALL_BUS | PCI_REASSIGN_ALL_RSRC);

	bus_range.end = pci_scan_child_bus(bridge->bus);
	pci_bus_update_busn_res_end(bridge->bus, bus_range.end);

	pci_assign_unassigned_bus_resources(bridge->bus);

	pci_bus_add_devices(bridge->bus);

	return 0;

bridge_init_fail:
	kfree(pp);
	pci_free_resource_list(&resources);
	return err;
}

Best regards,
Liviu

[1] http://marc.info/?l=linux-pci&m=139145254821334&w=2

Liviu Dudau (1):
  arm64: Add support for PCI

 arch/arm64/Kconfig            |  17 +++++++
 arch/arm64/include/asm/Kbuild |   1 +
 arch/arm64/include/asm/io.h   |   4 ++
 arch/arm64/include/asm/pci.h  |  35 +++++++++++++
 arch/arm64/kernel/Makefile    |   1 +
 arch/arm64/kernel/pci.c       | 112 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 170 insertions(+)
 create mode 100644 arch/arm64/include/asm/pci.h
 create mode 100644 arch/arm64/kernel/pci.c

-- 
1.8.5.3

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2014-02-20 14:38 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-03 18:43 [PATCH] [RFC] Add AArch64 support for PCI Liviu Dudau
2014-02-03 18:43 ` [PATCH] arm64: Add architecture " Liviu Dudau
2014-02-03 18:58   ` Arnd Bergmann
2014-02-03 19:18     ` Liviu Dudau
2014-02-03 19:21       ` kodiak furr
2014-02-03 20:05       ` Arnd Bergmann
2014-02-03 21:36         ` Liviu Dudau
2014-02-04  8:44           ` Arnd Bergmann
2014-02-04 11:09             ` Liviu Dudau
2014-02-04 11:54               ` Arnd Bergmann
2014-02-04 16:41             ` Catalin Marinas
2014-02-03 23:07         ` Rob Herring
2014-02-03 23:31           ` Jason Gunthorpe
2014-02-04  9:44             ` Arnd Bergmann
2014-02-04 13:57               ` Rob Herring
2014-02-04 19:50                 ` Arnd Bergmann
2014-02-04 18:15               ` Jason Gunthorpe
2014-02-04 18:34                 ` Arnd Bergmann
2014-02-04 19:10                   ` Jason Gunthorpe
2014-02-04 19:21                     ` Arnd Bergmann
2014-02-04  9:01           ` Arnd Bergmann
2014-02-03 22:34   ` Andrew Murray
2014-02-04 12:29     ` Liviu Dudau
2014-02-04 13:23       ` Andrew Murray
2014-02-04 16:18         ` Arnd Bergmann
2014-02-18  6:33   ` Yijing Wang
2014-02-20 14:38     ` Liviu Dudau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).