ahci_mvebu.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2016 Stefan Roese <sr@denx.de>
  4. */
  5. #include <common.h>
  6. #include <ahci.h>
  7. #include <dm.h>
  8. /*
  9. * Dummy implementation that can be overwritten by a board
  10. * specific function
  11. */
  12. __weak int board_ahci_enable(void)
  13. {
  14. return 0;
  15. }
  16. static int mvebu_ahci_bind(struct udevice *dev)
  17. {
  18. struct udevice *scsi_dev;
  19. int ret;
  20. ret = ahci_bind_scsi(dev, &scsi_dev);
  21. if (ret) {
  22. debug("%s: Failed to bind (err=%d\n)", __func__, ret);
  23. return ret;
  24. }
  25. return 0;
  26. }
  27. static int mvebu_ahci_probe(struct udevice *dev)
  28. {
  29. /*
  30. * Board specific SATA / AHCI enable code, e.g. enable the
  31. * AHCI power or deassert reset
  32. */
  33. board_ahci_enable();
  34. ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev));
  35. return 0;
  36. }
  37. static const struct udevice_id mvebu_ahci_ids[] = {
  38. { .compatible = "marvell,armada-380-ahci" },
  39. { .compatible = "marvell,armada-3700-ahci" },
  40. { .compatible = "marvell,armada-8k-ahci" },
  41. { }
  42. };
  43. U_BOOT_DRIVER(ahci_mvebu_drv) = {
  44. .name = "ahci_mvebu",
  45. .id = UCLASS_AHCI,
  46. .of_match = mvebu_ahci_ids,
  47. .bind = mvebu_ahci_bind,
  48. .probe = mvebu_ahci_probe,
  49. };