ahci_mvebu.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #include <log.h>
  9. /*
  10. * Dummy implementation that can be overwritten by a board
  11. * specific function
  12. */
  13. __weak int board_ahci_enable(void)
  14. {
  15. return 0;
  16. }
  17. static int mvebu_ahci_bind(struct udevice *dev)
  18. {
  19. struct udevice *scsi_dev;
  20. int ret;
  21. ret = ahci_bind_scsi(dev, &scsi_dev);
  22. if (ret) {
  23. debug("%s: Failed to bind (err=%d\n)", __func__, ret);
  24. return ret;
  25. }
  26. return 0;
  27. }
  28. static int mvebu_ahci_probe(struct udevice *dev)
  29. {
  30. /*
  31. * Board specific SATA / AHCI enable code, e.g. enable the
  32. * AHCI power or deassert reset
  33. */
  34. board_ahci_enable();
  35. ahci_probe_scsi(dev, (ulong)dev_remap_addr(dev));
  36. return 0;
  37. }
  38. static const struct udevice_id mvebu_ahci_ids[] = {
  39. { .compatible = "marvell,armada-380-ahci" },
  40. { .compatible = "marvell,armada-3700-ahci" },
  41. { .compatible = "marvell,armada-8k-ahci" },
  42. { .compatible = "cavium,octeon-7130-ahci" },
  43. { }
  44. };
  45. U_BOOT_DRIVER(ahci_mvebu_drv) = {
  46. .name = "ahci_mvebu",
  47. .id = UCLASS_AHCI,
  48. .of_match = mvebu_ahci_ids,
  49. .bind = mvebu_ahci_bind,
  50. .probe = mvebu_ahci_probe,
  51. };