intel_scu_pcidrv.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #include <linux/errno.h>
  10. #include <linux/init.h>
  11. #include <linux/pci.h>
  12. #include <asm/intel-mid.h>
  13. #include <asm/intel_scu_ipc.h>
  14. static int intel_scu_pci_probe(struct pci_dev *pdev,
  15. const struct pci_device_id *id)
  16. {
  17. void (*setup_fn)(void) = (void (*)(void))id->driver_data;
  18. struct intel_scu_ipc_data scu_data = {};
  19. struct intel_scu_ipc_dev *scu;
  20. int ret;
  21. ret = pcim_enable_device(pdev);
  22. if (ret)
  23. return ret;
  24. scu_data.mem = pdev->resource[0];
  25. scu_data.irq = pdev->irq;
  26. scu = intel_scu_ipc_register(&pdev->dev, &scu_data);
  27. if (IS_ERR(scu))
  28. return PTR_ERR(scu);
  29. if (setup_fn)
  30. setup_fn();
  31. return 0;
  32. }
  33. static void intel_mid_scu_setup(void)
  34. {
  35. intel_scu_devices_create();
  36. }
  37. static const struct pci_device_id pci_ids[] = {
  38. { PCI_VDEVICE(INTEL, 0x080e),
  39. .driver_data = (kernel_ulong_t)intel_mid_scu_setup },
  40. { PCI_VDEVICE(INTEL, 0x08ea),
  41. .driver_data = (kernel_ulong_t)intel_mid_scu_setup },
  42. { PCI_VDEVICE(INTEL, 0x0a94) },
  43. { PCI_VDEVICE(INTEL, 0x11a0),
  44. .driver_data = (kernel_ulong_t)intel_mid_scu_setup },
  45. { PCI_VDEVICE(INTEL, 0x1a94) },
  46. { PCI_VDEVICE(INTEL, 0x5a94) },
  47. {}
  48. };
  49. static struct pci_driver intel_scu_pci_driver = {
  50. .driver = {
  51. .suppress_bind_attrs = true,
  52. },
  53. .name = "intel_scu",
  54. .id_table = pci_ids,
  55. .probe = intel_scu_pci_probe,
  56. };
  57. builtin_pci_driver(intel_scu_pci_driver);