intel-spi-platform.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Intel PCH/PCU SPI flash platform driver.
  3. *
  4. * Copyright (C) 2016, Intel Corporation
  5. * Author: Mika Westerberg <mika.westerberg@linux.intel.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/ioport.h>
  12. #include <linux/module.h>
  13. #include <linux/platform_device.h>
  14. #include "intel-spi.h"
  15. static int intel_spi_platform_probe(struct platform_device *pdev)
  16. {
  17. struct intel_spi_boardinfo *info;
  18. struct intel_spi *ispi;
  19. struct resource *mem;
  20. info = dev_get_platdata(&pdev->dev);
  21. if (!info)
  22. return -EINVAL;
  23. mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  24. ispi = intel_spi_probe(&pdev->dev, mem, info);
  25. if (IS_ERR(ispi))
  26. return PTR_ERR(ispi);
  27. platform_set_drvdata(pdev, ispi);
  28. return 0;
  29. }
  30. static int intel_spi_platform_remove(struct platform_device *pdev)
  31. {
  32. struct intel_spi *ispi = platform_get_drvdata(pdev);
  33. return intel_spi_remove(ispi);
  34. }
  35. static struct platform_driver intel_spi_platform_driver = {
  36. .probe = intel_spi_platform_probe,
  37. .remove = intel_spi_platform_remove,
  38. .driver = {
  39. .name = "intel-spi",
  40. },
  41. };
  42. module_platform_driver(intel_spi_platform_driver);
  43. MODULE_DESCRIPTION("Intel PCH/PCU SPI flash platform driver");
  44. MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
  45. MODULE_LICENSE("GPL v2");
  46. MODULE_ALIAS("platform:intel-spi");