sun50i-de2.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Allwinner A64 Display Engine 2.0 Bus Driver
  4. *
  5. * Copyright (C) 2018 Icenowy Zheng <[email protected]>
  6. */
  7. #include <linux/of_platform.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/soc/sunxi/sunxi_sram.h>
  10. static int sun50i_de2_bus_probe(struct platform_device *pdev)
  11. {
  12. struct device_node *np = pdev->dev.of_node;
  13. int ret;
  14. ret = sunxi_sram_claim(&pdev->dev);
  15. if (ret)
  16. return dev_err_probe(&pdev->dev, ret,
  17. "Couldn't map SRAM to device\n");
  18. of_platform_populate(np, NULL, NULL, &pdev->dev);
  19. return 0;
  20. }
  21. static int sun50i_de2_bus_remove(struct platform_device *pdev)
  22. {
  23. sunxi_sram_release(&pdev->dev);
  24. return 0;
  25. }
  26. static const struct of_device_id sun50i_de2_bus_of_match[] = {
  27. { .compatible = "allwinner,sun50i-a64-de2", },
  28. { /* sentinel */ }
  29. };
  30. static struct platform_driver sun50i_de2_bus_driver = {
  31. .probe = sun50i_de2_bus_probe,
  32. .remove = sun50i_de2_bus_remove,
  33. .driver = {
  34. .name = "sun50i-de2-bus",
  35. .of_match_table = sun50i_de2_bus_of_match,
  36. },
  37. };
  38. builtin_platform_driver(sun50i_de2_bus_driver);