ci_hdrc_zevio.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2, as
  6. * published by the Free Software Foundation.
  7. *
  8. * Based off drivers/usb/chipidea/ci_hdrc_msm.c
  9. *
  10. */
  11. #include <linux/module.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/usb/gadget.h>
  14. #include <linux/usb/chipidea.h>
  15. #include "ci.h"
  16. static struct ci_hdrc_platform_data ci_hdrc_zevio_platdata = {
  17. .name = "ci_hdrc_zevio",
  18. .flags = CI_HDRC_REGS_SHARED | CI_HDRC_FORCE_FULLSPEED,
  19. .capoffset = DEF_CAPOFFSET,
  20. };
  21. static int ci_hdrc_zevio_probe(struct platform_device *pdev)
  22. {
  23. struct platform_device *ci_pdev;
  24. dev_dbg(&pdev->dev, "ci_hdrc_zevio_probe\n");
  25. ci_pdev = ci_hdrc_add_device(&pdev->dev,
  26. pdev->resource, pdev->num_resources,
  27. &ci_hdrc_zevio_platdata);
  28. if (IS_ERR(ci_pdev)) {
  29. dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n");
  30. return PTR_ERR(ci_pdev);
  31. }
  32. platform_set_drvdata(pdev, ci_pdev);
  33. return 0;
  34. }
  35. static int ci_hdrc_zevio_remove(struct platform_device *pdev)
  36. {
  37. struct platform_device *ci_pdev = platform_get_drvdata(pdev);
  38. ci_hdrc_remove_device(ci_pdev);
  39. return 0;
  40. }
  41. static const struct of_device_id ci_hdrc_zevio_dt_ids[] = {
  42. { .compatible = "lsi,zevio-usb", },
  43. { /* sentinel */ }
  44. };
  45. static struct platform_driver ci_hdrc_zevio_driver = {
  46. .probe = ci_hdrc_zevio_probe,
  47. .remove = ci_hdrc_zevio_remove,
  48. .driver = {
  49. .name = "zevio_usb",
  50. .of_match_table = ci_hdrc_zevio_dt_ids,
  51. },
  52. };
  53. MODULE_DEVICE_TABLE(of, ci_hdrc_zevio_dt_ids);
  54. module_platform_driver(ci_hdrc_zevio_driver);
  55. MODULE_LICENSE("GPL v2");