Merge tag 'amlogic-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman...
[linux-2.6-microblaze.git] / drivers / platform / x86 / intel_scu_pcidrv.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * PCI driver for the Intel SCU.
4  *
5  * Copyright (C) 2008-2010, 2015, 2020 Intel Corporation
6  * Authors: Sreedhara DS (sreedhara.ds@intel.com)
7  *          Mika Westerberg <mika.westerberg@linux.intel.com>
8  */
9
10 #include <linux/errno.h>
11 #include <linux/init.h>
12 #include <linux/pci.h>
13
14 #include <asm/intel-mid.h>
15 #include <asm/intel_scu_ipc.h>
16
17 static int intel_scu_pci_probe(struct pci_dev *pdev,
18                                const struct pci_device_id *id)
19 {
20         void (*setup_fn)(void) = (void (*)(void))id->driver_data;
21         struct intel_scu_ipc_data scu_data = {};
22         struct intel_scu_ipc_dev *scu;
23         int ret;
24
25         ret = pcim_enable_device(pdev);
26         if (ret)
27                 return ret;
28
29         scu_data.mem = pdev->resource[0];
30         scu_data.irq = pdev->irq;
31
32         scu = intel_scu_ipc_register(&pdev->dev, &scu_data);
33         if (IS_ERR(scu))
34                 return PTR_ERR(scu);
35
36         if (setup_fn)
37                 setup_fn();
38         return 0;
39 }
40
41 static void intel_mid_scu_setup(void)
42 {
43         intel_scu_devices_create();
44 }
45
46 static const struct pci_device_id pci_ids[] = {
47         { PCI_VDEVICE(INTEL, 0x080e),
48           .driver_data = (kernel_ulong_t)intel_mid_scu_setup },
49         { PCI_VDEVICE(INTEL, 0x08ea),
50           .driver_data = (kernel_ulong_t)intel_mid_scu_setup },
51         { PCI_VDEVICE(INTEL, 0x0a94) },
52         { PCI_VDEVICE(INTEL, 0x11a0),
53           .driver_data = (kernel_ulong_t)intel_mid_scu_setup },
54         { PCI_VDEVICE(INTEL, 0x1a94) },
55         { PCI_VDEVICE(INTEL, 0x5a94) },
56         {}
57 };
58
59 static struct pci_driver intel_scu_pci_driver = {
60         .driver = {
61                 .suppress_bind_attrs = true,
62         },
63         .name = "intel_scu",
64         .id_table = pci_ids,
65         .probe = intel_scu_pci_probe,
66 };
67
68 builtin_pci_driver(intel_scu_pci_driver);