Skip to content

Commit 5e30c08

Browse files
committed
Merge tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
Pull libata fixes from Jeff Garzik: "If you were going to shoot me for not sending these earlier, you would be right. -rc6 beat me by ~2 hours it seems, and they really should have gone out long before that. These have been in libata-dev.git for a day or so (unfortunately linux-next is on vacation). The main one is #1, with the others being minor bits. #1 has multiple tested-by, and can be considered a regression fix IMO. 1) Fix ACPI oops: https://bugzilla.kernel.org/show_bug.cgi?id=48211 2) Temporary WARN_ONCE() debugging patch for further ACPI debugging. The code already oopses here, and so this merely gives slightly better info. Related to https://bugzilla.kernel.org/show_bug.cgi?id=49151 which has been bisected down to a patch that _exposes_ a latest bug, but said bisection target does not actually appear to be the root cause itself. 3) sata_svw: fix longstanding error recovery bug, which was preventing kdump, by adding missing DMA-start bit check. Core code was already checking DMA-start, but ancillary, less-used routines were not. Fixed. 4) sata_highbank: fix minor __init/__devinit warning 5) Fix minor warning, if CONFIG_PM is set, but CONFIG_PM_SLEEP is not set 6) pata_arasan: proper functioning requires clock setting" * tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: [libata] PM callbacks should be conditionally compiled on CONFIG_PM_SLEEP sata_svw: check DMA start bit before reset libata debugging: Warn when unable to find timing descriptor based on xfer_mode sata_highbank: mark ahci_highbank_probe as __devinit pata_arasan: Initialize cf clock to 166MHz libata-acpi: Fix NULL ptr derference in ata_acpi_dev_handle
2 parents f4a75d2 + 29448ec commit 5e30c08

File tree

6 files changed

+57
-7
lines changed

6 files changed

+57
-7
lines changed

drivers/ata/ahci_platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static int __devexit ahci_remove(struct platform_device *pdev)
238238
return 0;
239239
}
240240

241-
#ifdef CONFIG_PM
241+
#ifdef CONFIG_PM_SLEEP
242242
static int ahci_suspend(struct device *dev)
243243
{
244244
struct ahci_platform_data *pdata = dev_get_platdata(dev);

drivers/ata/libata-acpi.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,10 +1105,15 @@ static int ata_acpi_bind_device(struct ata_port *ap, struct scsi_device *sdev,
11051105
struct acpi_device *acpi_dev;
11061106
struct acpi_device_power_state *states;
11071107

1108-
if (ap->flags & ATA_FLAG_ACPI_SATA)
1109-
ata_dev = &ap->link.device[sdev->channel];
1110-
else
1108+
if (ap->flags & ATA_FLAG_ACPI_SATA) {
1109+
if (!sata_pmp_attached(ap))
1110+
ata_dev = &ap->link.device[sdev->id];
1111+
else
1112+
ata_dev = &ap->pmp_link[sdev->channel].device[sdev->id];
1113+
}
1114+
else {
11111115
ata_dev = &ap->link.device[sdev->id];
1116+
}
11121117

11131118
*handle = ata_dev_acpi_handle(ata_dev);
11141119

drivers/ata/libata-core.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,6 +2942,10 @@ const struct ata_timing *ata_timing_find_mode(u8 xfer_mode)
29422942

29432943
if (xfer_mode == t->mode)
29442944
return t;
2945+
2946+
WARN_ONCE(true, "%s: unable to find timing for xfer_mode 0x%x\n",
2947+
__func__, xfer_mode);
2948+
29452949
return NULL;
29462950
}
29472951

drivers/ata/pata_arasan_cf.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ static int cf_init(struct arasan_cf_dev *acdev)
317317
return ret;
318318
}
319319

320+
ret = clk_set_rate(acdev->clk, 166000000);
321+
if (ret) {
322+
dev_warn(acdev->host->dev, "clock set rate failed");
323+
return ret;
324+
}
325+
320326
spin_lock_irqsave(&acdev->host->lock, flags);
321327
/* configure CF interface clock */
322328
writel((pdata->cf_if_clk <= CF_IF_CLK_200M) ? pdata->cf_if_clk :
@@ -908,7 +914,7 @@ static int __devexit arasan_cf_remove(struct platform_device *pdev)
908914
return 0;
909915
}
910916

911-
#ifdef CONFIG_PM
917+
#ifdef CONFIG_PM_SLEEP
912918
static int arasan_cf_suspend(struct device *dev)
913919
{
914920
struct ata_host *host = dev_get_drvdata(dev);

drivers/ata/sata_highbank.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ static const struct of_device_id ahci_of_match[] = {
260260
};
261261
MODULE_DEVICE_TABLE(of, ahci_of_match);
262262

263-
static int __init ahci_highbank_probe(struct platform_device *pdev)
263+
static int __devinit ahci_highbank_probe(struct platform_device *pdev)
264264
{
265265
struct device *dev = &pdev->dev;
266266
struct ahci_host_priv *hpriv;
@@ -378,7 +378,7 @@ static int __devexit ahci_highbank_remove(struct platform_device *pdev)
378378
return 0;
379379
}
380380

381-
#ifdef CONFIG_PM
381+
#ifdef CONFIG_PM_SLEEP
382382
static int ahci_highbank_suspend(struct device *dev)
383383
{
384384
struct ata_host *host = dev_get_drvdata(dev);

drivers/ata/sata_svw.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,39 @@ static int k2_sata_scr_write(struct ata_link *link,
142142
return 0;
143143
}
144144

145+
static int k2_sata_softreset(struct ata_link *link,
146+
unsigned int *class, unsigned long deadline)
147+
{
148+
u8 dmactl;
149+
void __iomem *mmio = link->ap->ioaddr.bmdma_addr;
150+
151+
dmactl = readb(mmio + ATA_DMA_CMD);
152+
153+
/* Clear the start bit */
154+
if (dmactl & ATA_DMA_START) {
155+
dmactl &= ~ATA_DMA_START;
156+
writeb(dmactl, mmio + ATA_DMA_CMD);
157+
}
158+
159+
return ata_sff_softreset(link, class, deadline);
160+
}
161+
162+
static int k2_sata_hardreset(struct ata_link *link,
163+
unsigned int *class, unsigned long deadline)
164+
{
165+
u8 dmactl;
166+
void __iomem *mmio = link->ap->ioaddr.bmdma_addr;
167+
168+
dmactl = readb(mmio + ATA_DMA_CMD);
169+
170+
/* Clear the start bit */
171+
if (dmactl & ATA_DMA_START) {
172+
dmactl &= ~ATA_DMA_START;
173+
writeb(dmactl, mmio + ATA_DMA_CMD);
174+
}
175+
176+
return sata_sff_hardreset(link, class, deadline);
177+
}
145178

146179
static void k2_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
147180
{
@@ -346,6 +379,8 @@ static struct scsi_host_template k2_sata_sht = {
346379

347380
static struct ata_port_operations k2_sata_ops = {
348381
.inherits = &ata_bmdma_port_ops,
382+
.softreset = k2_sata_softreset,
383+
.hardreset = k2_sata_hardreset,
349384
.sff_tf_load = k2_sata_tf_load,
350385
.sff_tf_read = k2_sata_tf_read,
351386
.sff_check_status = k2_stat_check_status,

0 commit comments

Comments
 (0)