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