Skip to content

Commit cfa7c64

Browse files
committed
Merge branch 'for-3.17-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
Pull libata fixes from Tejun Heo: "Two patches are to add PCI IDs for ICH9 and all others are device specific fixes. Nothing too interesting" * 'for-3.17-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: ahci_xgene: Fix the link down in first attempt for the APM X-Gene SoC AHCI SATA host controller driver. ahci_xgene: Skip the PHY and clock initialization if already configured by the firmware. ahci: add pcid for Marvel 0x9182 controller ata: Disabling the async PM for JMicron chip 363/361 ata_piix: Add Device IDs for Intel 9 Series PCH ahci: Add Device IDs for Intel 9 Series PCH ata: ahci_tegra: Read calibration fuse
2 parents b531f5d + 0babe61 commit cfa7c64

File tree

5 files changed

+99
-18
lines changed

5 files changed

+99
-18
lines changed

drivers/ata/ahci.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,14 @@ static const struct pci_device_id ahci_pci_tbl[] = {
305305
{ PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */
306306
{ PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */
307307
{ 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 */
308316

309317
/* JMicron 360/1/3/5/6, match class to avoid IDE function */
310318
{ 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[] = {
442450
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a),
443451
.driver_data = board_ahci_yes_fbs }, /* 88se9172 */
444452
{ 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),
445455
.driver_data = board_ahci_yes_fbs }, /* 88se9172 */
446456
{ PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192),
447457
.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)
13291339
else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000)
13301340
ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS;
13311341

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+
13321354
/* acquire resources */
13331355
rc = pcim_enable_device(pdev);
13341356
if (rc)

drivers/ata/ahci_tegra.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@
1818
*/
1919

2020
#include <linux/ahci_platform.h>
21-
#include <linux/reset.h>
2221
#include <linux/errno.h>
2322
#include <linux/kernel.h>
2423
#include <linux/module.h>
2524
#include <linux/of_device.h>
2625
#include <linux/platform_device.h>
2726
#include <linux/regulator/consumer.h>
27+
#include <linux/reset.h>
28+
29+
#include <soc/tegra/fuse.h>
2830
#include <soc/tegra/pmc.h>
31+
2932
#include "ahci.h"
3033

3134
#define SATA_CONFIGURATION_0 0x180
@@ -180,9 +183,12 @@ static int tegra_ahci_controller_init(struct ahci_host_priv *hpriv)
180183

181184
/* Pad calibration */
182185

183-
/* FIXME Always use calibration 0. Change this to read the calibration
184-
* fuse once the fuse driver has landed. */
185-
val = 0;
186+
ret = tegra_fuse_readl(FUSE_SATA_CALIB, &val);
187+
if (ret) {
188+
dev_err(&tegra->pdev->dev,
189+
"failed to read calibration fuse: %d\n", ret);
190+
return ret;
191+
}
186192

187193
calib = tegra124_pad_calibration[val & FUSE_SATA_CALIB_MASK];
188194

drivers/ata/ahci_xgene.c

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@
7878
#define CFG_MEM_RAM_SHUTDOWN 0x00000070
7979
#define BLOCK_MEM_RDY 0x00000074
8080

81+
/* Max retry for link down */
82+
#define MAX_LINK_DOWN_RETRY 3
83+
8184
struct xgene_ahci_context {
8285
struct ahci_host_priv *hpriv;
8386
struct device *dev;
@@ -145,6 +148,14 @@ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc)
145148
return rc;
146149
}
147150

151+
static 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+
148159
/**
149160
* xgene_ahci_read_id - Read ID data from the specified device
150161
* @dev: device
@@ -229,8 +240,11 @@ static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel)
229240
* and Gen1 (1.5Gbps). Otherwise during long IO stress test, the PHY will
230241
* report disparity error and etc. In addition, during COMRESET, there can
231242
* 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
233-
* algorithm is followed to proper configure the hardware PHY during COMRESET:
243+
* SERR_10B_8B_ERR, the PHY receiver line must be reseted. Also during long
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:
234248
*
235249
* Alg Part 1:
236250
* 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)
246260
* Alg Part 2:
247261
* 1. On link up, if there are any SERR_DISPARITY and SERR_10B_8B_ERR error
248262
* 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
250264
*
251265
* 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:
252272
* 1. Clear any pending from register PORT_SCR_ERR.
253273
*
254274
* 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,
267287
u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
268288
void __iomem *port_mmio = ahci_port_base(ap);
269289
struct ata_taskfile tf;
290+
int link_down_retry = 0;
270291
int rc;
271-
u32 val;
272-
273-
/* clear D2H reception area to properly wait for D2H FIS */
274-
ata_tf_init(link->device, &tf);
275-
tf.command = ATA_BUSY;
276-
ata_tf_to_fis(&tf, 0, 0, d2h_fis);
277-
rc = sata_link_hardreset(link, timing, deadline, online,
292+
u32 val, sstatus;
293+
294+
do {
295+
/* clear D2H reception area to properly wait for D2H FIS */
296+
ata_tf_init(link->device, &tf);
297+
tf.command = ATA_BUSY;
298+
ata_tf_to_fis(&tf, 0, 0, d2h_fis);
299+
rc = sata_link_hardreset(link, timing, deadline, online,
278300
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+
}
279307

280-
val = readl(port_mmio + PORT_SCR_ERR);
281-
if (val & (SERR_DISPARITY | SERR_10B_8B_ERR))
282-
dev_warn(ctx->dev, "link has error\n");
308+
sata_scr_read(link, SCR_STATUS, &sstatus);
309+
} while (link_down_retry++ < MAX_LINK_DOWN_RETRY &&
310+
(sstatus & 0xff) == 0x1);
283311

284312
/* clear all errors if any pending */
285313
val = readl(port_mmio + PORT_SCR_ERR);
@@ -467,6 +495,11 @@ static int xgene_ahci_probe(struct platform_device *pdev)
467495
return -ENODEV;
468496
}
469497

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+
470503
/* Due to errata, HW requires full toggle transition */
471504
rc = ahci_platform_enable_clks(hpriv);
472505
if (rc)
@@ -479,7 +512,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)
479512

480513
/* Configure the host controller */
481514
xgene_ahci_hw_init(hpriv);
482-
515+
skip_clk_phy:
483516
hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_NCQ;
484517

485518
rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info);

drivers/ata/ata_piix.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,14 @@ static const struct pci_device_id piix_pci_tbl[] = {
340340
{ 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt },
341341
/* SATA Controller IDE (Coleto Creek) */
342342
{ 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 },
343351

344352
{ } /* terminate list */
345353
};

drivers/ata/pata_jmicron.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,18 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i
143143
};
144144
const struct ata_port_info *ppi[] = { &info, NULL };
145145

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+
146158
return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0);
147159
}
148160

0 commit comments

Comments
 (0)