All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Oliver Schinagl
	<oliver+list-dxLnbx3+1qmEVqv0pETR8A@public.gmane.org>,
	linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	Oliver Schinagl <oliver-dxLnbx3+1qmEVqv0pETR8A@public.gmane.org>,
	Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH v2 1/4] libahci: Add a pre ahci_start_engine hook
Date: Sat,  4 Jan 2014 10:14:35 +0100	[thread overview]
Message-ID: <1388826878-5602-2-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1388826878-5602-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

From: Oliver Schinagl <oliver-dxLnbx3+1qmEVqv0pETR8A@public.gmane.org>

Allwinner A10 and A20 ARM SoCs have an AHCI sata controller which need a
special register to be poked before starting the DMA engine.

This register gets reset on an ahci_stop_engine call, so there is no other
place then ahci_start_engine where this poking can be done.

This commit adds a pre ahci_start_engine hook for use by the Allwinner AHCI
driver (and potentially other drivers in the future).

Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 drivers/ata/ahci.h    | 2 ++
 drivers/ata/libahci.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 2289efd..1bba479 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -323,6 +323,8 @@ struct ahci_host_priv {
 	u32			em_msg_type;	/* EM message type */
 	struct clk		*clk;		/* Only for platforms supporting clk */
 	void			*plat_data;	/* Other platform data */
+	/* Optional pre ahci_start_engine hook */
+	void			(*pre_start_engine)(struct ata_port *ap);
 };
 
 extern int ahci_ignore_sss;
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index c482f8c..780e9df 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -568,8 +568,12 @@ static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 void ahci_start_engine(struct ata_port *ap)
 {
 	void __iomem *port_mmio = ahci_port_base(ap);
+	struct ahci_host_priv *hpriv = ap->host->private_data;
 	u32 tmp;
 
+	if (hpriv->pre_start_engine)
+		hpriv->pre_start_engine(ap);
+
 	/* start DMA */
 	tmp = readl(port_mmio + PORT_CMD);
 	tmp |= PORT_CMD_START;
-- 
1.8.4.2

WARNING: multiple messages have this Message-ID (diff)
From: hdegoede@redhat.com (Hans de Goede)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/4] libahci: Add a pre ahci_start_engine hook
Date: Sat,  4 Jan 2014 10:14:35 +0100	[thread overview]
Message-ID: <1388826878-5602-2-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1388826878-5602-1-git-send-email-hdegoede@redhat.com>

From: Oliver Schinagl <oliver@schinagl.nl>

Allwinner A10 and A20 ARM SoCs have an AHCI sata controller which need a
special register to be poked before starting the DMA engine.

This register gets reset on an ahci_stop_engine call, so there is no other
place then ahci_start_engine where this poking can be done.

This commit adds a pre ahci_start_engine hook for use by the Allwinner AHCI
driver (and potentially other drivers in the future).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/ata/ahci.h    | 2 ++
 drivers/ata/libahci.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 2289efd..1bba479 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -323,6 +323,8 @@ struct ahci_host_priv {
 	u32			em_msg_type;	/* EM message type */
 	struct clk		*clk;		/* Only for platforms supporting clk */
 	void			*plat_data;	/* Other platform data */
+	/* Optional pre ahci_start_engine hook */
+	void			(*pre_start_engine)(struct ata_port *ap);
 };
 
 extern int ahci_ignore_sss;
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index c482f8c..780e9df 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -568,8 +568,12 @@ static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 void ahci_start_engine(struct ata_port *ap)
 {
 	void __iomem *port_mmio = ahci_port_base(ap);
+	struct ahci_host_priv *hpriv = ap->host->private_data;
 	u32 tmp;
 
+	if (hpriv->pre_start_engine)
+		hpriv->pre_start_engine(ap);
+
 	/* start DMA */
 	tmp = readl(port_mmio + PORT_CMD);
 	tmp |= PORT_CMD_START;
-- 
1.8.4.2

  parent reply	other threads:[~2014-01-04  9:14 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-04  9:14 [PATCH v2 0/4] ARM: sunxi: Add ahci-sunxi driver for Allwinner SoCs sata Hans de Goede
2014-01-04  9:14 ` Hans de Goede
     [not found] ` <1388826878-5602-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-04  9:14   ` Hans de Goede [this message]
2014-01-04  9:14     ` [PATCH v2 1/4] libahci: Add a pre ahci_start_engine hook Hans de Goede
     [not found]     ` <1388826878-5602-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-12 12:06       ` Tejun Heo
2014-01-12 12:06         ` Tejun Heo
2014-01-04  9:14   ` [PATCH v2 2/4] ARM: sunxi: Add ahci-sunxi driver for the Allwinner SUNXi SoCs sata Hans de Goede
2014-01-04  9:14     ` Hans de Goede
     [not found]     ` <1388826878-5602-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-04 21:39       ` Arnd Bergmann
2014-01-04 21:39         ` Arnd Bergmann
2014-01-04 21:47         ` Arnd Bergmann
2014-01-04 21:47           ` Arnd Bergmann
2014-01-05 12:42           ` Olliver Schinagl
2014-01-05 12:42             ` Olliver Schinagl
     [not found]             ` <52C9534E.4000701-dxLnbx3+1qmEVqv0pETR8A@public.gmane.org>
2014-01-05 13:06               ` Hans de Goede
2014-01-05 13:06                 ` Hans de Goede
2014-01-05 13:32               ` Hans de Goede
2014-01-05 13:32                 ` Hans de Goede
     [not found]                 ` <52C95ED0.5060207-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-05 14:00                   ` Olliver Schinagl
2014-01-05 14:00                     ` Olliver Schinagl
2014-01-04 23:44         ` Hans de Goede
2014-01-04 23:44           ` Hans de Goede
     [not found]           ` <52C89CC6.3010409-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-01-05 11:35             ` Arnd Bergmann
2014-01-05 11:35               ` Arnd Bergmann
     [not found]               ` <201401051235.11910.arnd-r2nGTMty4D4@public.gmane.org>
2014-01-05 13:29                 ` Hans de Goede
2014-01-05 13:29                   ` Hans de Goede
2014-01-04  9:14   ` [PATCH v2 3/4] ARM: sun4i: dts: Add ahci / sata support Hans de Goede
2014-01-04  9:14     ` Hans de Goede
2014-01-04  9:14   ` [PATCH v2 4/4] ARM: sun7i: " Hans de Goede
2014-01-04  9:14     ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1388826878-5602-2-git-send-email-hdegoede@redhat.com \
    --to=hdegoede-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=oliver+list-dxLnbx3+1qmEVqv0pETR8A@public.gmane.org \
    --cc=oliver-dxLnbx3+1qmEVqv0pETR8A@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.