Merge tag 'perf-urgent-for-mingo-20160809' of git://git.kernel.org/pub/scm/linux...
[deliverable/linux.git] / drivers / pci / host / pci-host-generic.c
CommitLineData
ce292991
WD
1/*
2 * Simple, generic PCI host controller driver targetting firmware-initialised
3 * systems and virtual machines (e.g. the PCI emulation provided by kvmtool).
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright (C) 2014 ARM Limited
18 *
19 * Author: Will Deacon <will.deacon@arm.com>
20 */
21
22#include <linux/kernel.h>
99849bf3 23#include <linux/init.h>
ce292991
WD
24#include <linux/of_address.h>
25#include <linux/of_pci.h>
80955f9e 26#include <linux/pci-ecam.h>
ce292991
WD
27#include <linux/platform_device.h>
28
1958e717 29static struct pci_ecam_ops gen_pci_cfg_cam_bus_ops = {
ce292991 30 .bus_shift = 16,
1958e717
J
31 .pci_ops = {
32 .map_bus = pci_ecam_map_bus,
9a280337
DD
33 .read = pci_generic_config_read,
34 .write = pci_generic_config_write,
35 }
ce292991
WD
36};
37
38static const struct of_device_id gen_pci_of_match[] = {
39 { .compatible = "pci-host-cam-generic",
40 .data = &gen_pci_cfg_cam_bus_ops },
41
42 { .compatible = "pci-host-ecam-generic",
1958e717 43 .data = &pci_generic_ecam_ops },
ce292991
WD
44
45 { },
46};
1958e717 47
d51b3710
DD
48static int gen_pci_probe(struct platform_device *pdev)
49{
d51b3710 50 const struct of_device_id *of_id;
1958e717 51 struct pci_ecam_ops *ops;
d51b3710 52
1958e717
J
53 of_id = of_match_node(gen_pci_of_match, pdev->dev.of_node);
54 ops = (struct pci_ecam_ops *)of_id->data;
d51b3710 55
1958e717 56 return pci_host_common_probe(pdev, ops);
d51b3710
DD
57}
58
ce292991
WD
59static struct platform_driver gen_pci_driver = {
60 .driver = {
61 .name = "pci-host-generic",
ce292991
WD
62 .of_match_table = gen_pci_of_match,
63 },
64 .probe = gen_pci_probe,
65};
99849bf3 66builtin_platform_driver(gen_pci_driver);
This page took 0.093988 seconds and 5 git commands to generate.