sata.c 1018 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (C) 2016 Stefan Roese <sr@denx.de>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <ahci.h>
  8. #include <dm.h>
  9. DECLARE_GLOBAL_DATA_PTR;
  10. /*
  11. * Dummy implementation that can be overwritten by a board
  12. * specific function
  13. */
  14. __weak int board_ahci_enable(void)
  15. {
  16. return 0;
  17. }
  18. #ifdef CONFIG_ARMADA_8K
  19. /* CP110 has different AHCI port addresses */
  20. void __iomem *ahci_port_base(void __iomem *base, u32 port)
  21. {
  22. return base + 0x10000 + (port * 0x10000);
  23. }
  24. #endif
  25. static int mvebu_ahci_probe(struct udevice *dev)
  26. {
  27. /*
  28. * Board specific SATA / AHCI enable code, e.g. enable the
  29. * AHCI power or deassert reset
  30. */
  31. board_ahci_enable();
  32. ahci_init(dev_get_addr_ptr(dev));
  33. return 0;
  34. }
  35. static const struct udevice_id mvebu_ahci_ids[] = {
  36. { .compatible = "marvell,armada-3700-ahci" },
  37. { .compatible = "marvell,armada-8k-ahci" },
  38. { }
  39. };
  40. U_BOOT_DRIVER(ahci_mvebu_drv) = {
  41. .name = "ahci_mvebu",
  42. .id = UCLASS_AHCI,
  43. .of_match = mvebu_ahci_ids,
  44. .probe = mvebu_ahci_probe,
  45. };