summaryrefslogtreecommitdiffstats
path: root/drivers/block/ahci.c
diff options
context:
space:
mode:
authorIan Campbell <ijc@hellion.org.uk>2014-07-18 20:38:41 +0100
committerHans de Goede <hdegoede@redhat.com>2014-07-31 15:37:22 +0200
commita6e50a88d8d3724fc75f1c6959b80a6c7c69cbad (patch)
tree820888fa2425b2cb4a3fa8dee2cae624ed4702af /drivers/block/ahci.c
parent25b4adbba018633b943a99322bfb2fb819c0bafb (diff)
downloadtalos-obmc-uboot-a6e50a88d8d3724fc75f1c6959b80a6c7c69cbad.tar.gz
talos-obmc-uboot-a6e50a88d8d3724fc75f1c6959b80a6c7c69cbad.zip
ahci: provide sunxi SATA driver using AHCI platform framework
This enables the necessary clocks, in AHB0 and in PLL6_CFG. This is done for sun7i only since I don't have access to any other sunxi platforms with sata included. The PHY setup is derived from the Alwinner releases and Linux, but is mostly undocumented. The Allwinner AHCI controller also requires some magic (and, again, undocumented) DMA initialisation when starting a port. This is added under a suitable ifdef. This option is enabled for Cubieboard, Cubieboard2 and Cubietruck based on contents of Linux DTS files, including SATA power pin config taken from the DTS. All build tested, but runtime tested on Cubieboard2 and Cubietruck only. Signed-off-by: Ian Campbell <ijc@hellion.org.uk> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/block/ahci.c')
-rw-r--r--drivers/block/ahci.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
index 4df804671a..dce99adc6b 100644
--- a/drivers/block/ahci.c
+++ b/drivers/block/ahci.c
@@ -129,6 +129,14 @@ int __weak ahci_link_up(struct ahci_probe_ent *probe_ent, u8 port)
return 1;
}
+#ifdef CONFIG_SUNXI_AHCI
+/* The sunxi AHCI controller requires this undocumented setup */
+static void sunxi_dma_init(volatile u8 *port_mmio)
+{
+ clrsetbits_le32(port_mmio + PORT_P0DMACR, 0x0000ff00, 0x00004400);
+}
+#endif
+
static int ahci_host_init(struct ahci_probe_ent *probe_ent)
{
#ifndef CONFIG_SCSI_AHCI_PLAT
@@ -213,6 +221,10 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent)
msleep(500);
}
+#ifdef CONFIG_SUNXI_AHCI
+ sunxi_dma_init(port_mmio);
+#endif
+
/* Add the spinup command to whatever mode bits may
* already be on in the command register.
*/
@@ -545,6 +557,10 @@ static int ahci_port_start(u8 port)
writel_with_flush(pp->rx_fis, port_mmio + PORT_FIS_ADDR);
+#ifdef CONFIG_SUNXI_AHCI
+ sunxi_dma_init(port_mmio);
+#endif
+
writel_with_flush(PORT_CMD_ICC_ACTIVE | PORT_CMD_FIS_RX |
PORT_CMD_POWER_ON | PORT_CMD_SPIN_UP |
PORT_CMD_START, port_mmio + PORT_CMD);
OpenPOWER on IntegriCloud