diff options
| author | Tejun Heo <tj@kernel.org> | 2014-07-30 12:49:04 -0400 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2014-07-30 12:49:04 -0400 |
| commit | e8f781836dc3335b5533f6e177a105bbe3ee7345 (patch) | |
| tree | b6f05b7bf6e69bcc436ab894b7dc84c28c746d1a /drivers/ata | |
| parent | 19f5be0f40922717e2b6e39a9822e7e7f30fd81f (diff) | |
| parent | 1a112d10f03e83fb3a2fdc4c9165865dec8a3ca6 (diff) | |
Merge branch 'for-3.16-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata into for-3.17
The scheduled ahci platform patches depend on change in
for-3.16-fixes. Pull it into for-3.17.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata')
| -rw-r--r-- | drivers/ata/ahci.c | 1 | ||||
| -rw-r--r-- | drivers/ata/ahci.h | 2 | ||||
| -rw-r--r-- | drivers/ata/ahci_imx.c | 38 | ||||
| -rw-r--r-- | drivers/ata/ahci_platform.c | 2 | ||||
| -rw-r--r-- | drivers/ata/ahci_xgene.c | 60 | ||||
| -rw-r--r-- | drivers/ata/libahci.c | 7 | ||||
| -rw-r--r-- | drivers/ata/libahci_platform.c | 7 | ||||
| -rw-r--r-- | drivers/ata/libata-core.c | 12 | ||||
| -rw-r--r-- | drivers/ata/libata-eh.c | 9 | ||||
| -rw-r--r-- | drivers/ata/pata_ep93xx.c | 2 |
10 files changed, 111 insertions, 29 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index dae5607e1115..4cd52a4541a9 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -456,6 +456,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 456 | 456 | ||
| 457 | /* Promise */ | 457 | /* Promise */ |
| 458 | { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ | 458 | { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ |
| 459 | { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode */ | ||
| 459 | 460 | ||
| 460 | /* Asmedia */ | 461 | /* Asmedia */ |
| 461 | { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */ | 462 | { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */ |
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 7137e1bbf04a..2ed84e1c70ea 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
| @@ -371,7 +371,9 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
| 371 | int pmp, unsigned long deadline, | 371 | int pmp, unsigned long deadline, |
| 372 | int (*check_ready)(struct ata_link *link)); | 372 | int (*check_ready)(struct ata_link *link)); |
| 373 | 373 | ||
| 374 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); | ||
| 374 | int ahci_stop_engine(struct ata_port *ap); | 375 | int ahci_stop_engine(struct ata_port *ap); |
| 376 | void ahci_start_fis_rx(struct ata_port *ap); | ||
| 375 | void ahci_start_engine(struct ata_port *ap); | 377 | void ahci_start_engine(struct ata_port *ap); |
| 376 | int ahci_check_ready(struct ata_link *link); | 378 | int ahci_check_ready(struct ata_link *link); |
| 377 | int ahci_kick_engine(struct ata_port *ap); | 379 | int ahci_kick_engine(struct ata_port *ap); |
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index e7be1f87d3e5..1e5fa5f21aff 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c | |||
| @@ -58,6 +58,8 @@ enum ahci_imx_type { | |||
| 58 | struct imx_ahci_priv { | 58 | struct imx_ahci_priv { |
| 59 | struct platform_device *ahci_pdev; | 59 | struct platform_device *ahci_pdev; |
| 60 | enum ahci_imx_type type; | 60 | enum ahci_imx_type type; |
| 61 | struct clk *sata_clk; | ||
| 62 | struct clk *sata_ref_clk; | ||
| 61 | struct clk *ahb_clk; | 63 | struct clk *ahb_clk; |
| 62 | struct regmap *gpr; | 64 | struct regmap *gpr; |
| 63 | bool no_device; | 65 | bool no_device; |
| @@ -225,7 +227,7 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv) | |||
| 225 | return ret; | 227 | return ret; |
| 226 | } | 228 | } |
| 227 | 229 | ||
| 228 | ret = ahci_platform_enable_clks(hpriv); | 230 | ret = clk_prepare_enable(imxpriv->sata_ref_clk); |
| 229 | if (ret < 0) | 231 | if (ret < 0) |
| 230 | goto disable_regulator; | 232 | goto disable_regulator; |
| 231 | 233 | ||
| @@ -287,7 +289,7 @@ static void imx_sata_disable(struct ahci_host_priv *hpriv) | |||
| 287 | !IMX6Q_GPR13_SATA_MPLL_CLK_EN); | 289 | !IMX6Q_GPR13_SATA_MPLL_CLK_EN); |
| 288 | } | 290 | } |
| 289 | 291 | ||
| 290 | ahci_platform_disable_clks(hpriv); | 292 | clk_disable_unprepare(imxpriv->sata_ref_clk); |
| 291 | 293 | ||
| 292 | if (hpriv->target_pwr) | 294 | if (hpriv->target_pwr) |
| 293 | regulator_disable(hpriv->target_pwr); | 295 | regulator_disable(hpriv->target_pwr); |
| @@ -320,6 +322,9 @@ static void ahci_imx_error_handler(struct ata_port *ap) | |||
| 320 | writel(reg_val | IMX_P0PHYCR_TEST_PDDQ, mmio + IMX_P0PHYCR); | 322 | writel(reg_val | IMX_P0PHYCR_TEST_PDDQ, mmio + IMX_P0PHYCR); |
| 321 | imx_sata_disable(hpriv); | 323 | imx_sata_disable(hpriv); |
| 322 | imxpriv->no_device = true; | 324 | imxpriv->no_device = true; |
| 325 | |||
| 326 | dev_info(ap->dev, "no device found, disabling link.\n"); | ||
| 327 | dev_info(ap->dev, "pass " MODULE_PARAM_PREFIX ".hotplug=1 to enable hotplug\n"); | ||
| 323 | } | 328 | } |
| 324 | 329 | ||
| 325 | static int ahci_imx_softreset(struct ata_link *link, unsigned int *class, | 330 | static int ahci_imx_softreset(struct ata_link *link, unsigned int *class, |
| @@ -540,6 +545,19 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
| 540 | imxpriv->no_device = false; | 545 | imxpriv->no_device = false; |
| 541 | imxpriv->first_time = true; | 546 | imxpriv->first_time = true; |
| 542 | imxpriv->type = (enum ahci_imx_type)of_id->data; | 547 | imxpriv->type = (enum ahci_imx_type)of_id->data; |
| 548 | |||
| 549 | imxpriv->sata_clk = devm_clk_get(dev, "sata"); | ||
| 550 | if (IS_ERR(imxpriv->sata_clk)) { | ||
| 551 | dev_err(dev, "can't get sata clock.\n"); | ||
| 552 | return PTR_ERR(imxpriv->sata_clk); | ||
| 553 | } | ||
| 554 | |||
| 555 | imxpriv->sata_ref_clk = devm_clk_get(dev, "sata_ref"); | ||
| 556 | if (IS_ERR(imxpriv->sata_ref_clk)) { | ||
| 557 | dev_err(dev, "can't get sata_ref clock.\n"); | ||
| 558 | return PTR_ERR(imxpriv->sata_ref_clk); | ||
| 559 | } | ||
| 560 | |||
| 543 | imxpriv->ahb_clk = devm_clk_get(dev, "ahb"); | 561 | imxpriv->ahb_clk = devm_clk_get(dev, "ahb"); |
| 544 | if (IS_ERR(imxpriv->ahb_clk)) { | 562 | if (IS_ERR(imxpriv->ahb_clk)) { |
| 545 | dev_err(dev, "can't get ahb clock.\n"); | 563 | dev_err(dev, "can't get ahb clock.\n"); |
| @@ -573,10 +591,14 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
| 573 | 591 | ||
| 574 | hpriv->plat_data = imxpriv; | 592 | hpriv->plat_data = imxpriv; |
| 575 | 593 | ||
| 576 | ret = imx_sata_enable(hpriv); | 594 | ret = clk_prepare_enable(imxpriv->sata_clk); |
| 577 | if (ret) | 595 | if (ret) |
| 578 | return ret; | 596 | return ret; |
| 579 | 597 | ||
| 598 | ret = imx_sata_enable(hpriv); | ||
| 599 | if (ret) | ||
| 600 | goto disable_clk; | ||
| 601 | |||
| 580 | /* | 602 | /* |
| 581 | * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL, | 603 | * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL, |
| 582 | * and IP vendor specific register IMX_TIMER1MS. | 604 | * and IP vendor specific register IMX_TIMER1MS. |
| @@ -601,16 +623,24 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
| 601 | ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, | 623 | ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, |
| 602 | 0, 0, 0); | 624 | 0, 0, 0); |
| 603 | if (ret) | 625 | if (ret) |
| 604 | imx_sata_disable(hpriv); | 626 | goto disable_sata; |
| 627 | |||
| 628 | return 0; | ||
| 605 | 629 | ||
| 630 | disable_sata: | ||
| 631 | imx_sata_disable(hpriv); | ||
| 632 | disable_clk: | ||
| 633 | clk_disable_unprepare(imxpriv->sata_clk); | ||
| 606 | return ret; | 634 | return ret; |
| 607 | } | 635 | } |
| 608 | 636 | ||
| 609 | static void ahci_imx_host_stop(struct ata_host *host) | 637 | static void ahci_imx_host_stop(struct ata_host *host) |
| 610 | { | 638 | { |
| 611 | struct ahci_host_priv *hpriv = host->private_data; | 639 | struct ahci_host_priv *hpriv = host->private_data; |
| 640 | struct imx_ahci_priv *imxpriv = hpriv->plat_data; | ||
| 612 | 641 | ||
| 613 | imx_sata_disable(hpriv); | 642 | imx_sata_disable(hpriv); |
| 643 | clk_disable_unprepare(imxpriv->sata_clk); | ||
| 614 | } | 644 | } |
| 615 | 645 | ||
| 616 | #ifdef CONFIG_PM_SLEEP | 646 | #ifdef CONFIG_PM_SLEEP |
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index ebe505c17763..b10d81ddb528 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c | |||
| @@ -58,7 +58,7 @@ static int ahci_probe(struct platform_device *pdev) | |||
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) | 60 | if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) |
| 61 | hflags |= AHCI_HFLAG_NO_FBS; | 61 | hflags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; |
| 62 | 62 | ||
| 63 | rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, | 63 | rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, |
| 64 | hflags, 0, 0); | 64 | hflags, 0, 0); |
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index 997b4178249a..1cfbdca638d2 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c | |||
| @@ -81,6 +81,7 @@ | |||
| 81 | struct xgene_ahci_context { | 81 | struct xgene_ahci_context { |
| 82 | struct ahci_host_priv *hpriv; | 82 | struct ahci_host_priv *hpriv; |
| 83 | struct device *dev; | 83 | struct device *dev; |
| 84 | u8 last_cmd[MAX_AHCI_CHN_PERCTR]; /* tracking the last command issued*/ | ||
| 84 | void __iomem *csr_core; /* Core CSR address of IP */ | 85 | void __iomem *csr_core; /* Core CSR address of IP */ |
| 85 | void __iomem *csr_diag; /* Diag CSR address of IP */ | 86 | void __iomem *csr_diag; /* Diag CSR address of IP */ |
| 86 | void __iomem *csr_axi; /* AXI CSR address of IP */ | 87 | void __iomem *csr_axi; /* AXI CSR address of IP */ |
| @@ -101,20 +102,62 @@ static int xgene_ahci_init_memram(struct xgene_ahci_context *ctx) | |||
| 101 | } | 102 | } |
| 102 | 103 | ||
| 103 | /** | 104 | /** |
| 105 | * xgene_ahci_restart_engine - Restart the dma engine. | ||
| 106 | * @ap : ATA port of interest | ||
| 107 | * | ||
| 108 | * Restarts the dma engine inside the controller. | ||
| 109 | */ | ||
| 110 | static int xgene_ahci_restart_engine(struct ata_port *ap) | ||
| 111 | { | ||
| 112 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
| 113 | |||
| 114 | ahci_stop_engine(ap); | ||
| 115 | ahci_start_fis_rx(ap); | ||
| 116 | hpriv->start_engine(ap); | ||
| 117 | |||
| 118 | return 0; | ||
| 119 | } | ||
| 120 | |||
| 121 | /** | ||
| 122 | * xgene_ahci_qc_issue - Issue commands to the device | ||
| 123 | * @qc: Command to issue | ||
| 124 | * | ||
| 125 | * Due to Hardware errata for IDENTIFY DEVICE command, the controller cannot | ||
| 126 | * clear the BSY bit after receiving the PIO setup FIS. This results in the dma | ||
| 127 | * state machine goes into the CMFatalErrorUpdate state and locks up. By | ||
| 128 | * restarting the dma engine, it removes the controller out of lock up state. | ||
| 129 | */ | ||
| 130 | static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) | ||
| 131 | { | ||
| 132 | struct ata_port *ap = qc->ap; | ||
| 133 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
| 134 | struct xgene_ahci_context *ctx = hpriv->plat_data; | ||
| 135 | int rc = 0; | ||
| 136 | |||
| 137 | if (unlikely(ctx->last_cmd[ap->port_no] == ATA_CMD_ID_ATA)) | ||
| 138 | xgene_ahci_restart_engine(ap); | ||
| 139 | |||
| 140 | rc = ahci_qc_issue(qc); | ||
| 141 | |||
| 142 | /* Save the last command issued */ | ||
| 143 | ctx->last_cmd[ap->port_no] = qc->tf.command; | ||
| 144 | |||
| 145 | return rc; | ||
| 146 | } | ||
| 147 | |||
| 148 | /** | ||
| 104 | * xgene_ahci_read_id - Read ID data from the specified device | 149 | * xgene_ahci_read_id - Read ID data from the specified device |
| 105 | * @dev: device | 150 | * @dev: device |
| 106 | * @tf: proposed taskfile | 151 | * @tf: proposed taskfile |
| 107 | * @id: data buffer | 152 | * @id: data buffer |
| 108 | * | 153 | * |
| 109 | * This custom read ID function is required due to the fact that the HW | 154 | * This custom read ID function is required due to the fact that the HW |
| 110 | * does not support DEVSLP and the controller state machine may get stuck | 155 | * does not support DEVSLP. |
| 111 | * after processing the ID query command. | ||
| 112 | */ | 156 | */ |
| 113 | static unsigned int xgene_ahci_read_id(struct ata_device *dev, | 157 | static unsigned int xgene_ahci_read_id(struct ata_device *dev, |
| 114 | struct ata_taskfile *tf, u16 *id) | 158 | struct ata_taskfile *tf, u16 *id) |
| 115 | { | 159 | { |
| 116 | u32 err_mask; | 160 | u32 err_mask; |
| 117 | void __iomem *port_mmio = ahci_port_base(dev->link->ap); | ||
| 118 | 161 | ||
| 119 | err_mask = ata_do_dev_read_id(dev, tf, id); | 162 | err_mask = ata_do_dev_read_id(dev, tf, id); |
| 120 | if (err_mask) | 163 | if (err_mask) |
| @@ -136,16 +179,6 @@ static unsigned int xgene_ahci_read_id(struct ata_device *dev, | |||
| 136 | */ | 179 | */ |
| 137 | id[ATA_ID_FEATURE_SUPP] &= ~(1 << 8); | 180 | id[ATA_ID_FEATURE_SUPP] &= ~(1 << 8); |
| 138 | 181 | ||
| 139 | /* | ||
| 140 | * Due to HW errata, restart the port if no other command active. | ||
| 141 | * Otherwise the controller may get stuck. | ||
| 142 | */ | ||
| 143 | if (!readl(port_mmio + PORT_CMD_ISSUE)) { | ||
| 144 | writel(PORT_CMD_FIS_RX, port_mmio + PORT_CMD); | ||
| 145 | readl(port_mmio + PORT_CMD); /* Force a barrier */ | ||
| 146 | writel(PORT_CMD_FIS_RX | PORT_CMD_START, port_mmio + PORT_CMD); | ||
| 147 | readl(port_mmio + PORT_CMD); /* Force a barrier */ | ||
| 148 | } | ||
| 149 | return 0; | 182 | return 0; |
| 150 | } | 183 | } |
| 151 | 184 | ||
| @@ -307,6 +340,7 @@ static struct ata_port_operations xgene_ahci_ops = { | |||
| 307 | .host_stop = xgene_ahci_host_stop, | 340 | .host_stop = xgene_ahci_host_stop, |
| 308 | .hardreset = xgene_ahci_hardreset, | 341 | .hardreset = xgene_ahci_hardreset, |
| 309 | .read_id = xgene_ahci_read_id, | 342 | .read_id = xgene_ahci_read_id, |
| 343 | .qc_issue = xgene_ahci_qc_issue, | ||
| 310 | }; | 344 | }; |
| 311 | 345 | ||
| 312 | static const struct ata_port_info xgene_ahci_port_info = { | 346 | static const struct ata_port_info xgene_ahci_port_info = { |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 40ea583d3610..d72ce0470309 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
| @@ -68,7 +68,6 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, | |||
| 68 | 68 | ||
| 69 | static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); | 69 | static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); |
| 70 | static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); | 70 | static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); |
| 71 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); | ||
| 72 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); | 71 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); |
| 73 | static int ahci_port_start(struct ata_port *ap); | 72 | static int ahci_port_start(struct ata_port *ap); |
| 74 | static void ahci_port_stop(struct ata_port *ap); | 73 | static void ahci_port_stop(struct ata_port *ap); |
| @@ -620,7 +619,7 @@ int ahci_stop_engine(struct ata_port *ap) | |||
| 620 | } | 619 | } |
| 621 | EXPORT_SYMBOL_GPL(ahci_stop_engine); | 620 | EXPORT_SYMBOL_GPL(ahci_stop_engine); |
| 622 | 621 | ||
| 623 | static void ahci_start_fis_rx(struct ata_port *ap) | 622 | void ahci_start_fis_rx(struct ata_port *ap) |
| 624 | { | 623 | { |
| 625 | void __iomem *port_mmio = ahci_port_base(ap); | 624 | void __iomem *port_mmio = ahci_port_base(ap); |
| 626 | struct ahci_host_priv *hpriv = ap->host->private_data; | 625 | struct ahci_host_priv *hpriv = ap->host->private_data; |
| @@ -646,6 +645,7 @@ static void ahci_start_fis_rx(struct ata_port *ap) | |||
| 646 | /* flush */ | 645 | /* flush */ |
| 647 | readl(port_mmio + PORT_CMD); | 646 | readl(port_mmio + PORT_CMD); |
| 648 | } | 647 | } |
| 648 | EXPORT_SYMBOL_GPL(ahci_start_fis_rx); | ||
| 649 | 649 | ||
| 650 | static int ahci_stop_fis_rx(struct ata_port *ap) | 650 | static int ahci_stop_fis_rx(struct ata_port *ap) |
| 651 | { | 651 | { |
| @@ -1945,7 +1945,7 @@ irqreturn_t ahci_interrupt(int irq, void *dev_instance) | |||
| 1945 | } | 1945 | } |
| 1946 | EXPORT_SYMBOL_GPL(ahci_interrupt); | 1946 | EXPORT_SYMBOL_GPL(ahci_interrupt); |
| 1947 | 1947 | ||
| 1948 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | 1948 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) |
| 1949 | { | 1949 | { |
| 1950 | struct ata_port *ap = qc->ap; | 1950 | struct ata_port *ap = qc->ap; |
| 1951 | void __iomem *port_mmio = ahci_port_base(ap); | 1951 | void __iomem *port_mmio = ahci_port_base(ap); |
| @@ -1974,6 +1974,7 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | |||
| 1974 | 1974 | ||
| 1975 | return 0; | 1975 | return 0; |
| 1976 | } | 1976 | } |
| 1977 | EXPORT_SYMBOL_GPL(ahci_qc_issue); | ||
| 1977 | 1978 | ||
| 1978 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc) | 1979 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc) |
| 1979 | { | 1980 | { |
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index a958a2b8fd93..28840a2f470f 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c | |||
| @@ -250,8 +250,13 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev) | |||
| 250 | if (IS_ERR(hpriv->phy)) { | 250 | if (IS_ERR(hpriv->phy)) { |
| 251 | rc = PTR_ERR(hpriv->phy); | 251 | rc = PTR_ERR(hpriv->phy); |
| 252 | switch (rc) { | 252 | switch (rc) { |
| 253 | case -ENODEV: | ||
| 254 | case -ENOSYS: | 253 | case -ENOSYS: |
| 254 | /* No PHY support. Check if PHY is required. */ | ||
| 255 | if (of_find_property(dev->of_node, "phys", NULL)) { | ||
| 256 | dev_err(dev, "couldn't get sata-phy: ENOSYS\n"); | ||
| 257 | goto err_out; | ||
| 258 | } | ||
| 259 | case -ENODEV: | ||
| 255 | /* continue normally */ | 260 | /* continue normally */ |
| 256 | hpriv->phy = NULL; | 261 | hpriv->phy = NULL; |
| 257 | break; | 262 | break; |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 18d97d5c7d90..677c0c1b03bd 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -4787,6 +4787,10 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
| 4787 | * ata_qc_new - Request an available ATA command, for queueing | 4787 | * ata_qc_new - Request an available ATA command, for queueing |
| 4788 | * @ap: target port | 4788 | * @ap: target port |
| 4789 | * | 4789 | * |
| 4790 | * Some ATA host controllers may implement a queue depth which is less | ||
| 4791 | * than ATA_MAX_QUEUE. So we shouldn't allocate a tag which is beyond | ||
| 4792 | * the hardware limitation. | ||
| 4793 | * | ||
| 4790 | * LOCKING: | 4794 | * LOCKING: |
| 4791 | * None. | 4795 | * None. |
| 4792 | */ | 4796 | */ |
| @@ -4794,14 +4798,15 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
| 4794 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) | 4798 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) |
| 4795 | { | 4799 | { |
| 4796 | struct ata_queued_cmd *qc = NULL; | 4800 | struct ata_queued_cmd *qc = NULL; |
| 4801 | unsigned int max_queue = ap->host->n_tags; | ||
| 4797 | unsigned int i, tag; | 4802 | unsigned int i, tag; |
| 4798 | 4803 | ||
| 4799 | /* no command while frozen */ | 4804 | /* no command while frozen */ |
| 4800 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) | 4805 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) |
| 4801 | return NULL; | 4806 | return NULL; |
| 4802 | 4807 | ||
| 4803 | for (i = 0; i < ATA_MAX_QUEUE; i++) { | 4808 | for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) { |
| 4804 | tag = (i + ap->last_tag + 1) % ATA_MAX_QUEUE; | 4809 | tag = tag < max_queue ? tag : 0; |
| 4805 | 4810 | ||
| 4806 | /* the last tag is reserved for internal command. */ | 4811 | /* the last tag is reserved for internal command. */ |
| 4807 | if (tag == ATA_TAG_INTERNAL) | 4812 | if (tag == ATA_TAG_INTERNAL) |
| @@ -6088,6 +6093,7 @@ void ata_host_init(struct ata_host *host, struct device *dev, | |||
| 6088 | { | 6093 | { |
| 6089 | spin_lock_init(&host->lock); | 6094 | spin_lock_init(&host->lock); |
| 6090 | mutex_init(&host->eh_mutex); | 6095 | mutex_init(&host->eh_mutex); |
| 6096 | host->n_tags = ATA_MAX_QUEUE - 1; | ||
| 6091 | host->dev = dev; | 6097 | host->dev = dev; |
| 6092 | host->ops = ops; | 6098 | host->ops = ops; |
| 6093 | } | 6099 | } |
| @@ -6169,6 +6175,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
| 6169 | { | 6175 | { |
| 6170 | int i, rc; | 6176 | int i, rc; |
| 6171 | 6177 | ||
| 6178 | host->n_tags = clamp(sht->can_queue, 1, ATA_MAX_QUEUE - 1); | ||
| 6179 | |||
| 6172 | /* host must have been started */ | 6180 | /* host must have been started */ |
| 6173 | if (!(host->flags & ATA_HOST_STARTED)) { | 6181 | if (!(host->flags & ATA_HOST_STARTED)) { |
| 6174 | dev_err(host->dev, "BUG: trying to register unstarted host\n"); | 6182 | dev_err(host->dev, "BUG: trying to register unstarted host\n"); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 6760fc4e85b8..dad83df555c4 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -1811,7 +1811,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, | |||
| 1811 | case ATA_DEV_ATA: | 1811 | case ATA_DEV_ATA: |
| 1812 | if (err & ATA_ICRC) | 1812 | if (err & ATA_ICRC) |
| 1813 | qc->err_mask |= AC_ERR_ATA_BUS; | 1813 | qc->err_mask |= AC_ERR_ATA_BUS; |
| 1814 | if (err & ATA_UNC) | 1814 | if (err & (ATA_UNC | ATA_AMNF)) |
| 1815 | qc->err_mask |= AC_ERR_MEDIA; | 1815 | qc->err_mask |= AC_ERR_MEDIA; |
| 1816 | if (err & ATA_IDNF) | 1816 | if (err & ATA_IDNF) |
| 1817 | qc->err_mask |= AC_ERR_INVALID; | 1817 | qc->err_mask |= AC_ERR_INVALID; |
| @@ -2556,11 +2556,12 @@ static void ata_eh_link_report(struct ata_link *link) | |||
| 2556 | } | 2556 | } |
| 2557 | 2557 | ||
| 2558 | if (cmd->command != ATA_CMD_PACKET && | 2558 | if (cmd->command != ATA_CMD_PACKET && |
| 2559 | (res->feature & (ATA_ICRC | ATA_UNC | ATA_IDNF | | 2559 | (res->feature & (ATA_ICRC | ATA_UNC | ATA_AMNF | |
| 2560 | ATA_ABORTED))) | 2560 | ATA_IDNF | ATA_ABORTED))) |
| 2561 | ata_dev_err(qc->dev, "error: { %s%s%s%s}\n", | 2561 | ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", |
| 2562 | res->feature & ATA_ICRC ? "ICRC " : "", | 2562 | res->feature & ATA_ICRC ? "ICRC " : "", |
| 2563 | res->feature & ATA_UNC ? "UNC " : "", | 2563 | res->feature & ATA_UNC ? "UNC " : "", |
| 2564 | res->feature & ATA_AMNF ? "AMNF " : "", | ||
| 2564 | res->feature & ATA_IDNF ? "IDNF " : "", | 2565 | res->feature & ATA_IDNF ? "IDNF " : "", |
| 2565 | res->feature & ATA_ABORTED ? "ABRT " : ""); | 2566 | res->feature & ATA_ABORTED ? "ABRT " : ""); |
| 2566 | #endif | 2567 | #endif |
diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c index 6ad5c072ce34..4d37c5415fc7 100644 --- a/drivers/ata/pata_ep93xx.c +++ b/drivers/ata/pata_ep93xx.c | |||
| @@ -915,7 +915,7 @@ static int ep93xx_pata_probe(struct platform_device *pdev) | |||
| 915 | struct ep93xx_pata_data *drv_data; | 915 | struct ep93xx_pata_data *drv_data; |
| 916 | struct ata_host *host; | 916 | struct ata_host *host; |
| 917 | struct ata_port *ap; | 917 | struct ata_port *ap; |
| 918 | unsigned int irq; | 918 | int irq; |
| 919 | struct resource *mem_res; | 919 | struct resource *mem_res; |
| 920 | void __iomem *ide_base; | 920 | void __iomem *ide_base; |
| 921 | int err; | 921 | int err; |
