From patchwork Sat Jan 18 23:48:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 312342 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9DDD22C00A3 for ; Sun, 19 Jan 2014 10:49:36 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751889AbaARXte (ORCPT ); Sat, 18 Jan 2014 18:49:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34787 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751869AbaARXtc (ORCPT ); Sat, 18 Jan 2014 18:49:32 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0INn2TD006673 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 18 Jan 2014 18:49:02 -0500 Received: from shalem.localdomain.com (vpn1-4-230.ams2.redhat.com [10.36.4.230]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s0INmukc020501; Sat, 18 Jan 2014 18:49:00 -0500 From: Hans de Goede To: Tejun Heo Cc: Oliver Schinagl , Maxime Ripard , Richard Zhu , linux-ide@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree , linux-sunxi@googlegroups.com, Hans de Goede Subject: [RFC v3 01/13] libahci: Allow drivers to override start_engine Date: Sun, 19 Jan 2014 00:48:43 +0100 Message-Id: <1390088935-7193-2-git-send-email-hdegoede@redhat.com> In-Reply-To: <1390088935-7193-1-git-send-email-hdegoede@redhat.com> References: <1390088935-7193-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org From: Oliver Schinagl Allwinner A10 and A20 ARM SoCs have an AHCI sata controller which needs 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 allows drivers to override ahci_start_engine behavior for use by the Allwinner AHCI driver (and potentially other drivers in the future). Signed-off-by: Hans de Goede --- drivers/ata/ahci.h | 2 ++ drivers/ata/libahci.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 2289efd..8f60f33 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 ahci_start_engine override */ + void (*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..f6eabbc 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -568,8 +568,14 @@ 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->start_engine) { + hpriv->start_engine(ap); + return; + } + /* start DMA */ tmp = readl(port_mmio + PORT_CMD); tmp |= PORT_CMD_START;