1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/of_address.h>
25#include <linux/of_pci.h>
26#include <linux/pci-ecam.h>
27#include <linux/platform_device.h>
28
29static struct pci_ecam_ops gen_pci_cfg_cam_bus_ops = {
30 .bus_shift = 16,
31 .pci_ops = {
32 .map_bus = pci_ecam_map_bus,
33 .read = pci_generic_config_read,
34 .write = pci_generic_config_write,
35 }
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",
43 .data = &pci_generic_ecam_ops },
44
45 { },
46};
47
48static int gen_pci_probe(struct platform_device *pdev)
49{
50 const struct of_device_id *of_id;
51 struct pci_ecam_ops *ops;
52
53 of_id = of_match_node(gen_pci_of_match, pdev->dev.of_node);
54 ops = (struct pci_ecam_ops *)of_id->data;
55
56 return pci_host_common_probe(pdev, ops);
57}
58
59static struct platform_driver gen_pci_driver = {
60 .driver = {
61 .name = "pci-host-generic",
62 .of_match_table = gen_pci_of_match,
63 },
64 .probe = gen_pci_probe,
65};
66builtin_platform_driver(gen_pci_driver);
67