aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.c22
-rw-r--r--drivers/ata/ahci_tegra.c14
-rw-r--r--drivers/ata/ahci_xgene.c61
-rw-r--r--drivers/ata/ata_piix.c8
-rw-r--r--drivers/ata/pata_jmicron.c12
5 files changed, 99 insertions, 18 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index a29f8012fb08..a0cc0edafc78 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -305,6 +305,14 @@ static const struct pci_device_id ahci_pci_tbl[] = {
305 { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */ 305 { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */
306 { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */ 306 { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */
307 { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */ 307 { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */
308 { PCI_VDEVICE(INTEL, 0x8c82), board_ahci }, /* 9 Series AHCI */
309 { PCI_VDEVICE(INTEL, 0x8c83), board_ahci }, /* 9 Series AHCI */
310 { PCI_VDEVICE(INTEL, 0x8c84), board_ahci }, /* 9 Series RAID */
311 { PCI_VDEVICE(INTEL, 0x8c85), board_ahci }, /* 9 Series RAID */
312 { PCI_VDEVICE(INTEL, 0x8c86), board_ahci }, /* 9 Series RAID */
313 { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */
314 { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */
315 { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */
308 316
309 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 317 /* JMicron 360/1/3/5/6, match class to avoid IDE function */
310 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 318 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
@@ -442,6 +450,8 @@ static const struct pci_device_id ahci_pci_tbl[] = {
442 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a), 450 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a),
443 .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ 451 .driver_data = board_ahci_yes_fbs }, /* 88se9172 */
444 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9172), 452 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9172),
453 .driver_data = board_ahci_yes_fbs }, /* 88se9182 */
454 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9182),
445 .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ 455 .driver_data = board_ahci_yes_fbs }, /* 88se9172 */
446 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192), 456 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192),
447 .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ 457 .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */
@@ -1329,6 +1339,18 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1329 else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) 1339 else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000)
1330 ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS; 1340 ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS;
1331 1341
1342 /*
1343 * The JMicron chip 361/363 contains one SATA controller and one
1344 * PATA controller,for powering on these both controllers, we must
1345 * follow the sequence one by one, otherwise one of them can not be
1346 * powered on successfully, so here we disable the async suspend
1347 * method for these chips.
1348 */
1349 if (pdev->vendor == PCI_VENDOR_ID_JMICRON &&
1350 (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 ||
1351 pdev->device == PCI_DEVICE_ID_JMICRON_JMB361))
1352 device_disable_async_suspend(&pdev->dev);
1353
1332 /* acquire resources */ 1354 /* acquire resources */
1333 rc = pcim_enable_device(pdev); 1355 rc = pcim_enable_device(pdev);
1334 if (rc) 1356 if (rc)
diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c
index f1fef74e503c..032904402c95 100644
--- a/drivers/ata/ahci_tegra.c
+++ b/drivers/ata/ahci_tegra.c
@@ -18,14 +18,17 @@
18 */ 18 */
19 19
20#include <linux/ahci_platform.h> 20#include <linux/ahci_platform.h>
21#include <linux/reset.h>
22#include <linux/errno.h> 21#include <linux/errno.h>
23#include <linux/kernel.h> 22#include <linux/kernel.h>
24#include <linux/module.h> 23#include <linux/module.h>
25#include <linux/of_device.h> 24#include <linux/of_device.h>
26#include <linux/platform_device.h> 25#include <linux/platform_device.h>
27#include <linux/regulator/consumer.h> 26#include <linux/regulator/consumer.h>
27#include <linux/reset.h>
28
29#include <soc/tegra/fuse.h>
28#include <soc/tegra/pmc.h> 30#include <soc/tegra/pmc.h>
31
29#include "ahci.h" 32#include "ahci.h"
30 33
31#define SATA_CONFIGURATION_0 0x180 34#define SATA_CONFIGURATION_0 0x180
@@ -180,9 +183,12 @@ static int tegra_ahci_controller_init(struct ahci_host_priv *hpriv)
180 183
181 /* Pad calibration */ 184 /* Pad calibration */
182 185
183 /* FIXME Always use calibration 0. Change this to read the calibration 186 ret = tegra_fuse_readl(FUSE_SATA_CALIB, &val);
184 * fuse once the fuse driver has landed. */ 187 if (ret) {
185 val = 0; 188 dev_err(&tegra->pdev->dev,
189 "failed to read calibration fuse: %d\n", ret);
190 return ret;
191 }
186 192
187 calib = tegra124_pad_calibration[val & FUSE_SATA_CALIB_MASK]; 193 calib = tegra124_pad_calibration[val & FUSE_SATA_CALIB_MASK];
188 194
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index c6962300b93c..f03aab187f4d 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -78,6 +78,9 @@
78#define CFG_MEM_RAM_SHUTDOWN 0x00000070 78#define CFG_MEM_RAM_SHUTDOWN 0x00000070
79#define BLOCK_MEM_RDY 0x00000074 79#define BLOCK_MEM_RDY 0x00000074
80 80
81/* Max retry for link down */
82#define MAX_LINK_DOWN_RETRY 3
83
81struct xgene_ahci_context { 84struct xgene_ahci_context {
82 struct ahci_host_priv *hpriv; 85 struct ahci_host_priv *hpriv;
83 struct device *dev; 86 struct device *dev;
@@ -145,6 +148,14 @@ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc)
145 return rc; 148 return rc;
146} 149}
147 150
151static bool xgene_ahci_is_memram_inited(struct xgene_ahci_context *ctx)
152{
153 void __iomem *diagcsr = ctx->csr_diag;
154
155 return (readl(diagcsr + CFG_MEM_RAM_SHUTDOWN) == 0 &&
156 readl(diagcsr + BLOCK_MEM_RDY) == 0xFFFFFFFF);
157}
158
148/** 159/**
149 * xgene_ahci_read_id - Read ID data from the specified device 160 * xgene_ahci_read_id - Read ID data from the specified device
150 * @dev: device 161 * @dev: device
@@ -229,8 +240,11 @@ static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel)
229 * and Gen1 (1.5Gbps). Otherwise during long IO stress test, the PHY will 240 * and Gen1 (1.5Gbps). Otherwise during long IO stress test, the PHY will
230 * report disparity error and etc. In addition, during COMRESET, there can 241 * report disparity error and etc. In addition, during COMRESET, there can
231 * be error reported in the register PORT_SCR_ERR. For SERR_DISPARITY and 242 * be error reported in the register PORT_SCR_ERR. For SERR_DISPARITY and
232 * SERR_10B_8B_ERR, the PHY receiver line must be reseted. The following 243 * SERR_10B_8B_ERR, the PHY receiver line must be reseted. Also during long
233 * algorithm is followed to proper configure the hardware PHY during COMRESET: 244 * reboot cycle regression, sometimes the PHY reports link down even if the
245 * device is present because of speed negotiation failure. so need to retry
246 * the COMRESET to get the link up. The following algorithm is followed to
247 * proper configure the hardware PHY during COMRESET:
234 * 248 *
235 * Alg Part 1: 249 * Alg Part 1:
236 * 1. Start the PHY at Gen3 speed (default setting) 250 * 1. Start the PHY at Gen3 speed (default setting)
@@ -246,9 +260,15 @@ static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel)
246 * Alg Part 2: 260 * Alg Part 2:
247 * 1. On link up, if there are any SERR_DISPARITY and SERR_10B_8B_ERR error 261 * 1. On link up, if there are any SERR_DISPARITY and SERR_10B_8B_ERR error
248 * reported in the register PORT_SCR_ERR, then reset the PHY receiver line 262 * reported in the register PORT_SCR_ERR, then reset the PHY receiver line
249 * 2. Go to Alg Part 3 263 * 2. Go to Alg Part 4
250 * 264 *
251 * Alg Part 3: 265 * Alg Part 3:
266 * 1. Check the PORT_SCR_STAT to see whether device presence detected but PHY
267 * communication establishment failed and maximum link down attempts are
268 * less than Max attempts 3 then goto Alg Part 1.
269 * 2. Go to Alg Part 4.
270 *
271 * Alg Part 4:
252 * 1. Clear any pending from register PORT_SCR_ERR. 272 * 1. Clear any pending from register PORT_SCR_ERR.
253 * 273 *
254 * NOTE: For the initial version, we will NOT support Gen1/Gen2. In addition 274 * NOTE: For the initial version, we will NOT support Gen1/Gen2. In addition
@@ -267,19 +287,27 @@ static int xgene_ahci_do_hardreset(struct ata_link *link,
267 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; 287 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
268 void __iomem *port_mmio = ahci_port_base(ap); 288 void __iomem *port_mmio = ahci_port_base(ap);
269 struct ata_taskfile tf; 289 struct ata_taskfile tf;
290 int link_down_retry = 0;
270 int rc; 291 int rc;
271 u32 val; 292 u32 val, sstatus;
272 293
273 /* clear D2H reception area to properly wait for D2H FIS */ 294 do {
274 ata_tf_init(link->device, &tf); 295 /* clear D2H reception area to properly wait for D2H FIS */
275 tf.command = ATA_BUSY; 296 ata_tf_init(link->device, &tf);
276 ata_tf_to_fis(&tf, 0, 0, d2h_fis); 297 tf.command = ATA_BUSY;
277 rc = sata_link_hardreset(link, timing, deadline, online, 298 ata_tf_to_fis(&tf, 0, 0, d2h_fis);
299 rc = sata_link_hardreset(link, timing, deadline, online,
278 ahci_check_ready); 300 ahci_check_ready);
301 if (*online) {
302 val = readl(port_mmio + PORT_SCR_ERR);
303 if (val & (SERR_DISPARITY | SERR_10B_8B_ERR))
304 dev_warn(ctx->dev, "link has error\n");
305 break;
306 }
279 307
280 val = readl(port_mmio + PORT_SCR_ERR); 308 sata_scr_read(link, SCR_STATUS, &sstatus);
281 if (val & (SERR_DISPARITY | SERR_10B_8B_ERR)) 309 } while (link_down_retry++ < MAX_LINK_DOWN_RETRY &&
282 dev_warn(ctx->dev, "link has error\n"); 310 (sstatus & 0xff) == 0x1);
283 311
284 /* clear all errors if any pending */ 312 /* clear all errors if any pending */
285 val = readl(port_mmio + PORT_SCR_ERR); 313 val = readl(port_mmio + PORT_SCR_ERR);
@@ -467,6 +495,11 @@ static int xgene_ahci_probe(struct platform_device *pdev)
467 return -ENODEV; 495 return -ENODEV;
468 } 496 }
469 497
498 if (xgene_ahci_is_memram_inited(ctx)) {
499 dev_info(dev, "skip clock and PHY initialization\n");
500 goto skip_clk_phy;
501 }
502
470 /* Due to errata, HW requires full toggle transition */ 503 /* Due to errata, HW requires full toggle transition */
471 rc = ahci_platform_enable_clks(hpriv); 504 rc = ahci_platform_enable_clks(hpriv);
472 if (rc) 505 if (rc)
@@ -479,7 +512,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)
479 512
480 /* Configure the host controller */ 513 /* Configure the host controller */
481 xgene_ahci_hw_init(hpriv); 514 xgene_ahci_hw_init(hpriv);
482 515skip_clk_phy:
483 hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_NCQ; 516 hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_NCQ;
484 517
485 rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info); 518 rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info);
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 893e30e9a9ef..ffbe625e6fd2 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -340,6 +340,14 @@ static const struct pci_device_id piix_pci_tbl[] = {
340 { 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt }, 340 { 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt },
341 /* SATA Controller IDE (Coleto Creek) */ 341 /* SATA Controller IDE (Coleto Creek) */
342 { 0x8086, 0x23a6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 342 { 0x8086, 0x23a6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
343 /* SATA Controller IDE (9 Series) */
344 { 0x8086, 0x8c88, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb },
345 /* SATA Controller IDE (9 Series) */
346 { 0x8086, 0x8c89, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb },
347 /* SATA Controller IDE (9 Series) */
348 { 0x8086, 0x8c80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
349 /* SATA Controller IDE (9 Series) */
350 { 0x8086, 0x8c81, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
343 351
344 { } /* terminate list */ 352 { } /* terminate list */
345}; 353};
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 4d1a5d2c4287..47e418b8c8ba 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -143,6 +143,18 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i
143 }; 143 };
144 const struct ata_port_info *ppi[] = { &info, NULL }; 144 const struct ata_port_info *ppi[] = { &info, NULL };
145 145
146 /*
147 * The JMicron chip 361/363 contains one SATA controller and one
148 * PATA controller,for powering on these both controllers, we must
149 * follow the sequence one by one, otherwise one of them can not be
150 * powered on successfully, so here we disable the async suspend
151 * method for these chips.
152 */
153 if (pdev->vendor == PCI_VENDOR_ID_JMICRON &&
154 (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 ||
155 pdev->device == PCI_DEVICE_ID_JMICRON_JMB361))
156 device_disable_async_suspend(&pdev->dev);
157
146 return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0); 158 return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0);
147} 159}
148 160