From patchwork Tue Jan 9 23:04:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 857826 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QloJHf8q"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zGSSF2xj7z9s82 for ; Wed, 10 Jan 2018 10:06:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758677AbeAIXFd (ORCPT ); Tue, 9 Jan 2018 18:05:33 -0500 Received: from mail-qk0-f193.google.com ([209.85.220.193]:36272 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758621AbeAIXFb (ORCPT ); Tue, 9 Jan 2018 18:05:31 -0500 Received: by mail-qk0-f193.google.com with SMTP id d21so9707963qkj.3; Tue, 09 Jan 2018 15:05:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IVEcklQdC95hdgj7+nw0LdEkUCxr/gkHcnWfhyJvzQc=; b=QloJHf8qDIilrp0fwFBztBS1OS4YU1qYIjFVmCmqmXu/Yw7BkElD59TIlrf1dHmB8o rtoKLUxHXWmHKFojGIHVqC0hgpxW2fbbjWVaKKHphFMbQvNjXYdFJBI52aEBivJ93WgM 01HXQFSvCS7TMMnF6ER4Hgcrc8ng/W8HxLnpoQ/PT35NWmEVqleousFrPp5TJHmrMtRQ nWWBXwk3l2p4VVIWLdbBEJ9v9fyAfxYjup5kzd4gFz3eAqo0XbsYBvyvVxMXicJHxYM/ GfBKSHrMrH7zfw1A9RxQtPAeA1yX5zGtcoF/RKcCGBdgAdjfLeJW1YA+MXbmbq26j1XD dHDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IVEcklQdC95hdgj7+nw0LdEkUCxr/gkHcnWfhyJvzQc=; b=M01ptZLG8W0Zk2o3W93ZAs7qfDeCaAifmW442ejxYrW9x5ZZdwG8tIMgWOgzXgEccZ F0oEScz3jy9o6jILAyh4QiqWSD1nLIAH6EpYsq+7+i2Ci3cyrGI1jy4FzyXFTWeKs44e tci2Wx1OhpinrYLV+AkzSxltqCGrKPRCAEfrlnKC1EUzNUxEy76lkNCN7bx6JgiOBAJC sd7AIVJKzCcZQL5X34Sf5ETKDHEe1CuFcGhpGnauqeMkrM6GMW65PgtyHP4xMJAN2qR4 M+gV4aOz6/9oJ7MAgKqg9b3CiF5TQVWq+TFaIzr7UaqdZjRhZzp41MPcOQvM4xgnTO0p IdOA== X-Gm-Message-State: AKwxytegY8RFSz9U3GJpA6nroKDUst4A869l0ccAI0sk6FSQkGrUbtfS EcB478L9YfoyR/0/+bess/4= X-Google-Smtp-Source: ACJfBovxru8DNwD1oX40tFEcm/WNMP51Elyo6bvkgH+8egqwRvXZMuN+pN4ztMnpfaYucu+B7t15IQ== X-Received: by 10.55.93.195 with SMTP id r186mr22467766qkb.251.1515539130690; Tue, 09 Jan 2018 15:05:30 -0800 (PST) Received: from stbirv-lnx-3.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id p187sm2987468qkf.41.2018.01.09.15.05.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Jan 2018 15:05:29 -0800 (PST) From: Florian Fainelli To: bcm-kernel-feedback-list@broadcom.com Cc: Florian Fainelli , Tejun Heo , Kishon Vijay Abraham I , Heiko Stuebner , Srinath Mannam , Krzysztof Kozlowski , Vivek Gautam , Dan Carpenter , linux-ide@vger.kernel.org (open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/3] ata: Allow having a port recovery callback Date: Tue, 9 Jan 2018 15:04:55 -0800 Message-Id: <1515539097-26742-2-git-send-email-f.fainelli@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515539097-26742-1-git-send-email-f.fainelli@gmail.com> References: <1515539097-26742-1-git-send-email-f.fainelli@gmail.com> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Some AHCI controllers may need to recovery from a failure to identify a drive, such as the Broadcom AHCI controller, make that possible at both the libata-core.c and AHCI controller level such that we can provide such an error recovery callback. Signed-off-by: Florian Fainelli --- drivers/ata/libata-core.c | 2 ++ include/linux/libata.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 3c09122bf038..921c2813af07 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -2045,6 +2045,8 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, if (ata_msg_warn(ap)) ata_dev_warn(dev, "failed to IDENTIFY (%s, err_mask=0x%x)\n", reason, err_mask); + if (ap->host->ops->port_recovery) + ap->host->ops->port_recovery(ap); return rc; } diff --git a/include/linux/libata.h b/include/linux/libata.h index ed9826b21c5e..23646a557ab2 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -956,6 +956,7 @@ struct ata_port_operations { int (*port_resume)(struct ata_port *ap); int (*port_start)(struct ata_port *ap); void (*port_stop)(struct ata_port *ap); + void (*port_recovery)(struct ata_port *ap); void (*host_stop)(struct ata_host *host); #ifdef CONFIG_ATA_SFF From patchwork Tue Jan 9 23:04:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 857825 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rBi04cxJ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zGSSB4PqDz9s82 for ; Wed, 10 Jan 2018 10:06:18 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758774AbeAIXGC (ORCPT ); Tue, 9 Jan 2018 18:06:02 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:44662 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758684AbeAIXFe (ORCPT ); Tue, 9 Jan 2018 18:05:34 -0500 Received: by mail-qt0-f194.google.com with SMTP id m59so19929592qte.11; Tue, 09 Jan 2018 15:05:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=l6D87hgRspijf88GOOe72lRm1zJsTp3X/BIZYLK9pEs=; b=rBi04cxJJ3gaxA+836PPTWZ0UcyJeBk6k5RRM1hW3lijVQu79LeXuA47ENgVPeWx1L dx8kF1P1riYTSC+I/6iAlD5dFKeDWoaAUZktWZMuNcWQT5ykmWEOySXSKNg8OSJHFI/R d8hw0WmR8w1dODKq8eGAZmbsFod8Z6TJEjXlZdtm+Zf7G3RkzSX/OOx8CQD6hsjYjpRD 5gjPqQJ1cOIs9svNECxmQ9xWZtNySMsQU+w9P5cV+7bB1L2LOP7g2jNVYMU/WU1R4I3K SN+jSoiTYGmsKo7F9CHQuL9mKFKpQZLhP3M14Wj+NGVJwc8ezx8sCnOOcwjqhKYyGucq CWEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=l6D87hgRspijf88GOOe72lRm1zJsTp3X/BIZYLK9pEs=; b=jMMJEJf/y2Xq45nGy0A23Dh4JGM+MF+abhgBwQPnpLvD86QDQsNu+vqrPDxHkUyAjF rihX87qJQbw1L82tS5F6Q0QGHH6gYQDIIQbGUq7hujS8DG2c/RuL1qUiwr8fveJAQWNn UDJ5wzAEbixQyx4r4qCFK6vZbgBbXqNDnIjwwkt/azmbS4nVov67yDGBkzD9k4MypQT+ DqlZHnz/LL3ytKO3lIPbP/ouETx/aGUZLbdKYuLotIF/udNtyMRPweExtJzo+sBPRR1O AksOpyWG6uAjkRajlhTmqUsshMpUOmbwB27ZDob3O/fkTH67qxdHS3ckV4sW3Wcm6OvZ vdmw== X-Gm-Message-State: AKwxytfBzTsy5+Akv/adkEMhBTNPF4pph8Drj2Dit9mfJ6C73j6yUSuu aM1vrPB6nJnQ2cBAknSLfiQ= X-Google-Smtp-Source: ACJfBov9e3hkKNEHDgyTX+qlTes8J1198lj68Z3VA0qjjc0fS5Yj9JZPkaHRgtvno3SFRI0zEedxTw== X-Received: by 10.200.15.24 with SMTP id e24mr7607770qtk.133.1515539133177; Tue, 09 Jan 2018 15:05:33 -0800 (PST) Received: from stbirv-lnx-3.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id p187sm2987468qkf.41.2018.01.09.15.05.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Jan 2018 15:05:32 -0800 (PST) From: Florian Fainelli To: bcm-kernel-feedback-list@broadcom.com Cc: Florian Fainelli , Tejun Heo , Kishon Vijay Abraham I , Heiko Stuebner , Srinath Mannam , Krzysztof Kozlowski , Vivek Gautam , Dan Carpenter , linux-ide@vger.kernel.org (open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/3] phy: brcm-sata: Implementation calibrate callback Date: Tue, 9 Jan 2018 15:04:56 -0800 Message-Id: <1515539097-26742-3-git-send-email-f.fainelli@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515539097-26742-1-git-send-email-f.fainelli@gmail.com> References: <1515539097-26742-1-git-send-email-f.fainelli@gmail.com> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Implement the calibration callback to allow turning on the Clock-Data Recovery module clamping when necessary. Signed-off-by: Florian Fainelli --- drivers/phy/broadcom/phy-brcm-sata.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/phy/broadcom/phy-brcm-sata.c b/drivers/phy/broadcom/phy-brcm-sata.c index 3f953db70288..8000ce312d95 100644 --- a/drivers/phy/broadcom/phy-brcm-sata.c +++ b/drivers/phy/broadcom/phy-brcm-sata.c @@ -150,6 +150,9 @@ enum sata_phy_regs { TXPMD_TX_FREQ_CTRL_CONTROL2_FMIN_MASK = 0x3ff, TXPMD_TX_FREQ_CTRL_CONTROL3 = 0x84, TXPMD_TX_FREQ_CTRL_CONTROL3_FMAX_MASK = 0x3ff, + + RXPMD_REG_BANK = 0x1c0, + RXPMD_RX_FREQ_MON_CONTROL1 = 0x87, }; enum sata_phy_ctrl_regs { @@ -505,8 +508,37 @@ static int brcm_sata_phy_init(struct phy *phy) return rc; } +static void brcm_stb_sata_calibrate(struct brcm_sata_port *port) +{ + void __iomem *base = brcm_sata_pcb_base(port); + struct brcm_sata_phy *priv = port->phy_priv; + u32 tmp = BIT(8); + + brcm_sata_phy_wr(base, RXPMD_REG_BANK, RXPMD_RX_FREQ_MON_CONTROL1, + ~tmp, tmp); +} + +static int brcm_sata_phy_calibrate(struct phy *phy) +{ + struct brcm_sata_port *port = phy_get_drvdata(phy); + int rc = -EOPNOTSUPP; + + switch (port->phy_priv->version) { + case BRCM_SATA_PHY_STB_28NM: + case BRCM_SATA_PHY_STB_40NM: + brcm_stb_sata_calibrate(port); + rc = 0; + break; + default: + break; + }; + + return rc; +} + static const struct phy_ops phy_ops = { .init = brcm_sata_phy_init, + .calibrate = brcm_sata_phy_calibrate, .owner = THIS_MODULE, }; From patchwork Tue Jan 9 23:04:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 857824 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NVWZ699d"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zGSRd40sGz9s82 for ; Wed, 10 Jan 2018 10:05:49 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758753AbeAIXFj (ORCPT ); Tue, 9 Jan 2018 18:05:39 -0500 Received: from mail-qk0-f194.google.com ([209.85.220.194]:41676 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758621AbeAIXFg (ORCPT ); Tue, 9 Jan 2018 18:05:36 -0500 Received: by mail-qk0-f194.google.com with SMTP id a8so20703709qkb.8; Tue, 09 Jan 2018 15:05:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=N3Ej/w7rSaMEYmCmV5Br8hOD6gR5XhIbFl0US2tqWY4=; b=NVWZ699dbBIwv+8XVIxQlu3/NGF1XE32G/5fFzEQ3JE6tLZ3/udu06Dd5G0+kZBgvM qhZnf+BetqQMBSp6FvuNmWHFbiu3H/+Rv3g3ZcZw2zYdwYfLPHPntBSxrir+J1cwnig7 xsitJSjaCkvot5AtLaXDqLnNWU4jG5sxj5Ql0Rb9payDtGEdHktcS6wIAjOHe6czAlww 94YH+ErdeasjckpC0NkybhbpvkHCvyvwUNhf9Jf6hPuG7t/bJ3bD4yuvMui0sTLefhm0 kTQ2eyjYi1/lL9kMn6hLsduGmRhUrQKs76wlsieDt2FMNfyqZeJsMtVWWElm3ibD9YiI KJPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N3Ej/w7rSaMEYmCmV5Br8hOD6gR5XhIbFl0US2tqWY4=; b=g9zLv1C5yKrc1gw55TzZSj0r1J5O3tnJk1zRbR8TFsInjbsc2JpPFV7GN5/75HKLB6 YrSyGoa8GGUBOflxIkOw5gCO/7NJIAjBWhZ9rnbjnaKj6RtaQN229+B+iEwlRn9Bw/48 9f1hUa1nb2710Lgo5pJ2nNanIKvUe/YNsbut71aMInZVZULuG+6vms3BTkomrIMmHpus JIk5CRnbY4pz1/696wb6tynsMy+YjQTjqDWIPygm2J04dEeMMurppTp0tXLTYRHtPWha glOcmVHNwaeTpZImLP/NcRN2xRA5K5av6GE/s3BzYbpb8LtBRa5znn6gqCXNQtQqHlcB crhQ== X-Gm-Message-State: AKwxytc6iTX0s1Ju5oypjRrfxnurnZREuSUetTDEZBayFVzY/7O2VMi5 JSVP/ximqYF6VMh50BPHrvY= X-Google-Smtp-Source: ACJfBossot0UH6y+mRsLARDSm8OH7rNiDJx3tptMJ10Eg6fZeb4h7CFtdAHDC0xlClinE1d8imDUbA== X-Received: by 10.55.54.9 with SMTP id d9mr22159980qka.33.1515539135691; Tue, 09 Jan 2018 15:05:35 -0800 (PST) Received: from stbirv-lnx-3.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id p187sm2987468qkf.41.2018.01.09.15.05.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Jan 2018 15:05:34 -0800 (PST) From: Florian Fainelli To: bcm-kernel-feedback-list@broadcom.com Cc: Florian Fainelli , Tejun Heo , Kishon Vijay Abraham I , Heiko Stuebner , Srinath Mannam , Krzysztof Kozlowski , Vivek Gautam , Dan Carpenter , linux-ide@vger.kernel.org (open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/3] ata: ahci_brcm: Recover from failures to identify devices Date: Tue, 9 Jan 2018 15:04:57 -0800 Message-Id: <1515539097-26742-4-git-send-email-f.fainelli@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515539097-26742-1-git-send-email-f.fainelli@gmail.com> References: <1515539097-26742-1-git-send-email-f.fainelli@gmail.com> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org When powering up, the SATA controller may fail to mount the HDD. The SATA controller will lock up, preventing it from negotiating to a lower speed or transmitting data. Root cause is power supply noise creating resonance at 6 Ghz and 3 GHz frequencies, which causes instability in the Clock-Data Recovery (CDR) frontend module, resulting in false acquisition of the clock at SATA 6G/3G speeds. The SATA controller may fail to mount the HDD and lock up, requiring a power cycle. Broadcom chips suspected of being susceptible to this issue include BCM7445, BCM7439, and BCM7366. The Kernel implements an error recovery mechanism that resets the SATA PHY and digital controller when the controller locks up. During this error recovery process, typically there is less activity on the board and Broadcom STB chip, so that the power supply is less noisy, thus allowing the SATA controller to lock correctly. Signed-off-by: Florian Fainelli --- drivers/ata/ahci_brcm.c | 83 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 8 deletions(-) diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c index ad3b8826ec79..2dfdc2bbe55b 100644 --- a/drivers/ata/ahci_brcm.c +++ b/drivers/ata/ahci_brcm.c @@ -96,14 +96,6 @@ struct brcm_ahci_priv { enum brcm_ahci_version version; }; -static const struct ata_port_info ahci_brcm_port_info = { - .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM, - .link_flags = ATA_LFLAG_NO_DB_DELAY, - .pio_mask = ATA_PIO4, - .udma_mask = ATA_UDMA6, - .port_ops = &ahci_platform_ops, -}; - static inline u32 brcm_sata_readreg(void __iomem *addr) { /* @@ -269,6 +261,81 @@ static void brcm_sata_init(struct brcm_ahci_priv *priv) brcm_sata_writereg(data, ctrl); } +static void brcm_ahci_port_recovery(struct ata_port *ap) +{ + struct ata_host *host = ap->host; + struct ahci_host_priv *hpriv = host->private_data; + struct brcm_ahci_priv *priv = hpriv->plat_data; + void __iomem *mmio = hpriv->mmio; + unsigned long flags; + int i, rc; + u32 ctl; + + /* Disable host interrupts */ + spin_lock_irqsave(&host->lock, flags); + ctl = readl(mmio + HOST_CTL); + ctl &= ~HOST_IRQ_EN; + writel(ctl, mmio + HOST_CTL); + readl(mmio + HOST_CTL); /* flush */ + spin_unlock_irqrestore(&host->lock, flags); + + /* Perform the SATA PHY reset sequence */ + brcm_sata_phy_disable(priv, ap->port_no); + + /* Bring the PHY back on */ + brcm_sata_phy_enable(priv, ap->port_no); + + /* Re-initialize and calibrate the PHY */ + for (i = 0; i < hpriv->nports; i++) { + rc = phy_init(hpriv->phys[i]); + if (rc) + goto disable_phys; + + rc = phy_calibrate(hpriv->phys[i]); + if (rc) { + phy_exit(hpriv->phys[i]); + goto disable_phys; + } + } + + /* Re-enable host interrupts */ + spin_lock_irqsave(&host->lock, flags); + ctl = readl(mmio + HOST_CTL); + ctl |= HOST_IRQ_EN; + writel(ctl, mmio + HOST_CTL); + readl(mmio + HOST_CTL); /* flush */ + spin_unlock_irqrestore(&host->lock, flags); + + return; + +disable_phys: + while (--i >= 0) { + phy_power_off(hpriv->phys[i]); + phy_exit(hpriv->phys[i]); + } +} + +static void brcm_ahci_host_stop(struct ata_host *host) +{ + struct ahci_host_priv *hpriv = host->private_data; + + ahci_platform_disable_resources(hpriv); +} + +static struct ata_port_operations ahci_brcm_platform_ops = { + .inherits = &ahci_ops, + .host_stop = brcm_ahci_host_stop, + .port_recovery = brcm_ahci_port_recovery, +}; + +static const struct ata_port_info ahci_brcm_port_info = { + .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM, + .link_flags = ATA_LFLAG_NO_DB_DELAY, + .pio_mask = ATA_PIO4, + .udma_mask = ATA_UDMA6, + .port_ops = &ahci_brcm_platform_ops, +}; + #ifdef CONFIG_PM_SLEEP static int brcm_ahci_suspend(struct device *dev) {