160-ahci-add-pre-start-hook.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From 3eec76bc21d78e56ac8404b59f29dd9dbbd1528a Mon Sep 17 00:00:00 2001
  2. From: Oliver Schinagl <[email protected]>
  3. Date: Mon, 2 Dec 2013 16:13:32 +0100
  4. Subject: [PATCH] libahci: Add a pre ahci_start_engine hook
  5. Allwinner A10 and A20 ARM SoCs have an AHCI sata controller which need a
  6. special register to be poked before starting the DMA engine.
  7. This register gets reset on an ahci_stop_engine call, so there is no other
  8. place then ahci_start_engine where this poking can be done.
  9. This commit adds a pre ahci_start_engine hook for use by the Allwinner AHCI
  10. driver (and potentially other drivers in the future).
  11. Signed-off-by: Hans de Goede <[email protected]>
  12. ---
  13. drivers/ata/ahci.h | 2 ++
  14. drivers/ata/libahci.c | 4 ++++
  15. 2 files changed, 6 insertions(+)
  16. --- a/drivers/ata/ahci.h
  17. +++ b/drivers/ata/ahci.h
  18. @@ -323,6 +323,8 @@ struct ahci_host_priv {
  19. u32 em_msg_type; /* EM message type */
  20. struct clk *clk; /* Only for platforms supporting clk */
  21. void *plat_data; /* Other platform data */
  22. + /* Optional pre ahci_start_engine hook */
  23. + void (*pre_start_engine)(struct ata_port *ap);
  24. };
  25. extern int ahci_ignore_sss;
  26. --- a/drivers/ata/libahci.c
  27. +++ b/drivers/ata/libahci.c
  28. @@ -568,8 +568,12 @@ static int ahci_scr_write(struct ata_lin
  29. void ahci_start_engine(struct ata_port *ap)
  30. {
  31. void __iomem *port_mmio = ahci_port_base(ap);
  32. + struct ahci_host_priv *hpriv = ap->host->private_data;
  33. u32 tmp;
  34. + if (hpriv->pre_start_engine)
  35. + hpriv->pre_start_engine(ap);
  36. +
  37. /* start DMA */
  38. tmp = readl(port_mmio + PORT_CMD);
  39. tmp |= PORT_CMD_START;