aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:18:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:18:22 -0500
commit13aa7e0bc20f7f7e5ef45f0defc4ff4380802302 (patch)
tree6516c4a1dabd8dcf7c1856f1671b6e37dbca37c8 /drivers/ata
parentc08acff0544c5dadf892e3908799a5ca1d98e592 (diff)
parent9f961a5f6efc87a79571d7166257b36af28ffcfe (diff)
Merge branch 'for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata
Pull libata changes from Tejun Heo: "Nothing too interesting. Only two minor fixes in libata core. Most changes are specific to hardware which isn't too common" * 'for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: ahci: Add Device IDs for Intel Wildcat Point-LP sata_rcar: Convert to clk_prepare/unprepare drivers/libata: Set max sector to 65535 for Slimtype DVD A DS8A9SH drive libata: Add some missing command descriptions sata_highbank: clear whole array in highbank_initialize_phys() ahci: disabled FBS prior to issuing software reset libata: Fix display of sata speed ahci: imx: setup power saving methods ata_piix: minor typo and a printk fix ahci: Changing two module params with static and __read_mostly
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.c4
-rw-r--r--drivers/ata/ahci.h2
-rw-r--r--drivers/ata/ahci_imx.c101
-rw-r--r--drivers/ata/ahci_platform.c3
-rw-r--r--drivers/ata/ata_piix.c19
-rw-r--r--drivers/ata/libahci.c27
-rw-r--r--drivers/ata/libata-core.c1
-rw-r--r--drivers/ata/libata-eh.c8
-rw-r--r--drivers/ata/libata-transport.c16
-rw-r--r--drivers/ata/sata_highbank.c8
-rw-r--r--drivers/ata/sata_rcar.c10
11 files changed, 164 insertions, 35 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 8e28f923cf7f..e2903d03180e 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -292,6 +292,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {
292 { PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */ 292 { PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */
293 { PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */ 293 { PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */
294 { PCI_VDEVICE(INTEL, 0x23a3), board_ahci }, /* Coleto Creek AHCI */ 294 { PCI_VDEVICE(INTEL, 0x23a3), board_ahci }, /* Coleto Creek AHCI */
295 { PCI_VDEVICE(INTEL, 0x9c83), board_ahci }, /* Wildcat Point-LP AHCI */
296 { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */
297 { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */
298 { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */
295 299
296 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 300 /* JMicron 360/1/3/5/6, match class to avoid IDE function */
297 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 301 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 11456371f29b..2289efdf8203 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -339,6 +339,7 @@ extern struct device_attribute *ahci_sdev_attrs[];
339 .sdev_attrs = ahci_sdev_attrs 339 .sdev_attrs = ahci_sdev_attrs
340 340
341extern struct ata_port_operations ahci_ops; 341extern struct ata_port_operations ahci_ops;
342extern struct ata_port_operations ahci_platform_ops;
342extern struct ata_port_operations ahci_pmp_retry_srst_ops; 343extern struct ata_port_operations ahci_pmp_retry_srst_ops;
343 344
344unsigned int ahci_dev_classify(struct ata_port *ap); 345unsigned int ahci_dev_classify(struct ata_port *ap);
@@ -368,6 +369,7 @@ irqreturn_t ahci_hw_interrupt(int irq, void *dev_instance);
368irqreturn_t ahci_thread_fn(int irq, void *dev_instance); 369irqreturn_t ahci_thread_fn(int irq, void *dev_instance);
369void ahci_print_info(struct ata_host *host, const char *scc_s); 370void ahci_print_info(struct ata_host *host, const char *scc_s);
370int ahci_host_activate(struct ata_host *host, int irq, unsigned int n_msis); 371int ahci_host_activate(struct ata_host *host, int irq, unsigned int n_msis);
372void ahci_error_handler(struct ata_port *ap);
371 373
372static inline void __iomem *__ahci_port_base(struct ata_host *host, 374static inline void __iomem *__ahci_port_base(struct ata_host *host,
373 unsigned int port_no) 375 unsigned int port_no)
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index 58debb0acc3a..ae2d73fe321e 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * copyright (c) 2013 Freescale Semiconductor, Inc.
2 * Freescale IMX AHCI SATA platform driver 3 * Freescale IMX AHCI SATA platform driver
3 * Copyright 2013 Freescale Semiconductor, Inc.
4 * 4 *
5 * based on the AHCI SATA platform driver by Jeff Garzik and Anton Vorontsov 5 * based on the AHCI SATA platform driver by Jeff Garzik and Anton Vorontsov
6 * 6 *
@@ -25,10 +25,13 @@
25#include <linux/of_device.h> 25#include <linux/of_device.h>
26#include <linux/mfd/syscon.h> 26#include <linux/mfd/syscon.h>
27#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> 27#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
28#include <linux/libata.h>
28#include "ahci.h" 29#include "ahci.h"
29 30
30enum { 31enum {
31 HOST_TIMER1MS = 0xe0, /* Timer 1-ms */ 32 PORT_PHY_CTL = 0x178, /* Port0 PHY Control */
33 PORT_PHY_CTL_PDDQ_LOC = 0x100000, /* PORT_PHY_CTL bits */
34 HOST_TIMER1MS = 0xe0, /* Timer 1-ms */
32}; 35};
33 36
34struct imx_ahci_priv { 37struct imx_ahci_priv {
@@ -36,6 +39,56 @@ struct imx_ahci_priv {
36 struct clk *sata_ref_clk; 39 struct clk *sata_ref_clk;
37 struct clk *ahb_clk; 40 struct clk *ahb_clk;
38 struct regmap *gpr; 41 struct regmap *gpr;
42 bool no_device;
43 bool first_time;
44};
45
46static int ahci_imx_hotplug;
47module_param_named(hotplug, ahci_imx_hotplug, int, 0644);
48MODULE_PARM_DESC(hotplug, "AHCI IMX hot-plug support (0=Don't support, 1=support)");
49
50static void ahci_imx_error_handler(struct ata_port *ap)
51{
52 u32 reg_val;
53 struct ata_device *dev;
54 struct ata_host *host = dev_get_drvdata(ap->dev);
55 struct ahci_host_priv *hpriv = host->private_data;
56 void __iomem *mmio = hpriv->mmio;
57 struct imx_ahci_priv *imxpriv = dev_get_drvdata(ap->dev->parent);
58
59 ahci_error_handler(ap);
60
61 if (!(imxpriv->first_time) || ahci_imx_hotplug)
62 return;
63
64 imxpriv->first_time = false;
65
66 ata_for_each_dev(dev, &ap->link, ENABLED)
67 return;
68 /*
69 * Disable link to save power. An imx ahci port can't be recovered
70 * without full reset once the pddq mode is enabled making it
71 * impossible to use as part of libata LPM.
72 */
73 reg_val = readl(mmio + PORT_PHY_CTL);
74 writel(reg_val | PORT_PHY_CTL_PDDQ_LOC, mmio + PORT_PHY_CTL);
75 regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
76 IMX6Q_GPR13_SATA_MPLL_CLK_EN,
77 !IMX6Q_GPR13_SATA_MPLL_CLK_EN);
78 clk_disable_unprepare(imxpriv->sata_ref_clk);
79 imxpriv->no_device = true;
80}
81
82static struct ata_port_operations ahci_imx_ops = {
83 .inherits = &ahci_platform_ops,
84 .error_handler = ahci_imx_error_handler,
85};
86
87static const struct ata_port_info ahci_imx_port_info = {
88 .flags = AHCI_FLAG_COMMON,
89 .pio_mask = ATA_PIO4,
90 .udma_mask = ATA_UDMA6,
91 .port_ops = &ahci_imx_ops,
39}; 92};
40 93
41static int imx6q_sata_init(struct device *dev, void __iomem *mmio) 94static int imx6q_sata_init(struct device *dev, void __iomem *mmio)
@@ -117,9 +170,51 @@ static void imx6q_sata_exit(struct device *dev)
117 clk_disable_unprepare(imxpriv->sata_ref_clk); 170 clk_disable_unprepare(imxpriv->sata_ref_clk);
118} 171}
119 172
173static int imx_ahci_suspend(struct device *dev)
174{
175 struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent);
176
177 /*
178 * If no_device is set, The CLKs had been gated off in the
179 * initialization so don't do it again here.
180 */
181 if (!imxpriv->no_device) {
182 regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
183 IMX6Q_GPR13_SATA_MPLL_CLK_EN,
184 !IMX6Q_GPR13_SATA_MPLL_CLK_EN);
185 clk_disable_unprepare(imxpriv->sata_ref_clk);
186 }
187
188 return 0;
189}
190
191static int imx_ahci_resume(struct device *dev)
192{
193 struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent);
194 int ret;
195
196 if (!imxpriv->no_device) {
197 ret = clk_prepare_enable(imxpriv->sata_ref_clk);
198 if (ret < 0) {
199 dev_err(dev, "pre-enable sata_ref clock err:%d\n", ret);
200 return ret;
201 }
202
203 regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
204 IMX6Q_GPR13_SATA_MPLL_CLK_EN,
205 IMX6Q_GPR13_SATA_MPLL_CLK_EN);
206 usleep_range(1000, 2000);
207 }
208
209 return 0;
210}
211
120static struct ahci_platform_data imx6q_sata_pdata = { 212static struct ahci_platform_data imx6q_sata_pdata = {
121 .init = imx6q_sata_init, 213 .init = imx6q_sata_init,
122 .exit = imx6q_sata_exit, 214 .exit = imx6q_sata_exit,
215 .ata_port_info = &ahci_imx_port_info,
216 .suspend = imx_ahci_suspend,
217 .resume = imx_ahci_resume,
123}; 218};
124 219
125static const struct of_device_id imx_ahci_of_match[] = { 220static const struct of_device_id imx_ahci_of_match[] = {
@@ -152,6 +247,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
152 ahci_dev = &ahci_pdev->dev; 247 ahci_dev = &ahci_pdev->dev;
153 ahci_dev->parent = dev; 248 ahci_dev->parent = dev;
154 249
250 imxpriv->no_device = false;
251 imxpriv->first_time = true;
155 imxpriv->ahb_clk = devm_clk_get(dev, "ahb"); 252 imxpriv->ahb_clk = devm_clk_get(dev, "ahb");
156 if (IS_ERR(imxpriv->ahb_clk)) { 253 if (IS_ERR(imxpriv->ahb_clk)) {
157 dev_err(dev, "can't get ahb clock.\n"); 254 dev_err(dev, "can't get ahb clock.\n");
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 7d3b85385bfc..f9554318504f 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -49,10 +49,11 @@ static struct platform_device_id ahci_devtype[] = {
49}; 49};
50MODULE_DEVICE_TABLE(platform, ahci_devtype); 50MODULE_DEVICE_TABLE(platform, ahci_devtype);
51 51
52static struct ata_port_operations ahci_platform_ops = { 52struct ata_port_operations ahci_platform_ops = {
53 .inherits = &ahci_ops, 53 .inherits = &ahci_ops,
54 .host_stop = ahci_host_stop, 54 .host_stop = ahci_host_stop,
55}; 55};
56EXPORT_SYMBOL_GPL(ahci_platform_ops);
56 57
57static struct ata_port_operations ahci_platform_retry_srst_ops = { 58static struct ata_port_operations ahci_platform_retry_srst_ops = {
58 .inherits = &ahci_pmp_retry_srst_ops, 59 .inherits = &ahci_pmp_retry_srst_ops,
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 513ad7ed0c99..6334c8d7c3f1 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -100,7 +100,7 @@
100 100
101enum { 101enum {
102 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ 102 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */
103 ICH5_PMR = 0x90, /* port mapping register */ 103 ICH5_PMR = 0x90, /* address map register */
104 ICH5_PCS = 0x92, /* port control and status */ 104 ICH5_PCS = 0x92, /* port control and status */
105 PIIX_SIDPR_BAR = 5, 105 PIIX_SIDPR_BAR = 5,
106 PIIX_SIDPR_LEN = 16, 106 PIIX_SIDPR_LEN = 16,
@@ -233,7 +233,7 @@ static const struct pci_device_id piix_pci_tbl[] = {
233 PCI_CLASS_STORAGE_IDE << 8, 0xffff00, ich6m_sata }, 233 PCI_CLASS_STORAGE_IDE << 8, 0xffff00, ich6m_sata },
234 /* 82801GB/GR/GH (ICH7, identical to ICH6) */ 234 /* 82801GB/GR/GH (ICH7, identical to ICH6) */
235 { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata }, 235 { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata },
236 /* 2801GBM/GHM (ICH7M, identical to ICH6M) */ 236 /* 82801GBM/GHM (ICH7M, identical to ICH6M) */
237 { 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6m_sata }, 237 { 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6m_sata },
238 /* Enterprise Southbridge 2 (631xESB/632xESB) */ 238 /* Enterprise Southbridge 2 (631xESB/632xESB) */
239 { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata }, 239 { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata },
@@ -517,7 +517,7 @@ static int ich_pata_cable_detect(struct ata_port *ap)
517 const struct ich_laptop *lap = &ich_laptop[0]; 517 const struct ich_laptop *lap = &ich_laptop[0];
518 u8 mask; 518 u8 mask;
519 519
520 /* Check for specials - Acer Aspire 5602WLMi */ 520 /* Check for specials */
521 while (lap->device) { 521 while (lap->device) {
522 if (lap->device == pdev->device && 522 if (lap->device == pdev->device &&
523 lap->subvendor == pdev->subsystem_vendor && 523 lap->subvendor == pdev->subsystem_vendor &&
@@ -1366,38 +1366,39 @@ static const int *piix_init_sata_map(struct pci_dev *pdev,
1366 const int *map; 1366 const int *map;
1367 int i, invalid_map = 0; 1367 int i, invalid_map = 0;
1368 u8 map_value; 1368 u8 map_value;
1369 char buf[32];
1370 char *p = buf, *end = buf + sizeof(buf);
1369 1371
1370 pci_read_config_byte(pdev, ICH5_PMR, &map_value); 1372 pci_read_config_byte(pdev, ICH5_PMR, &map_value);
1371 1373
1372 map = map_db->map[map_value & map_db->mask]; 1374 map = map_db->map[map_value & map_db->mask];
1373 1375
1374 dev_info(&pdev->dev, "MAP [");
1375 for (i = 0; i < 4; i++) { 1376 for (i = 0; i < 4; i++) {
1376 switch (map[i]) { 1377 switch (map[i]) {
1377 case RV: 1378 case RV:
1378 invalid_map = 1; 1379 invalid_map = 1;
1379 pr_cont(" XX"); 1380 p += scnprintf(p, end - p, " XX");
1380 break; 1381 break;
1381 1382
1382 case NA: 1383 case NA:
1383 pr_cont(" --"); 1384 p += scnprintf(p, end - p, " --");
1384 break; 1385 break;
1385 1386
1386 case IDE: 1387 case IDE:
1387 WARN_ON((i & 1) || map[i + 1] != IDE); 1388 WARN_ON((i & 1) || map[i + 1] != IDE);
1388 pinfo[i / 2] = piix_port_info[ich_pata_100]; 1389 pinfo[i / 2] = piix_port_info[ich_pata_100];
1389 i++; 1390 i++;
1390 pr_cont(" IDE IDE"); 1391 p += scnprintf(p, end - p, " IDE IDE");
1391 break; 1392 break;
1392 1393
1393 default: 1394 default:
1394 pr_cont(" P%d", map[i]); 1395 p += scnprintf(p, end - p, " P%d", map[i]);
1395 if (i & 1) 1396 if (i & 1)
1396 pinfo[i / 2].flags |= ATA_FLAG_SLAVE_POSS; 1397 pinfo[i / 2].flags |= ATA_FLAG_SLAVE_POSS;
1397 break; 1398 break;
1398 } 1399 }
1399 } 1400 }
1400 pr_cont(" ]\n"); 1401 dev_info(&pdev->dev, "MAP [%s ]\n", buf);
1401 1402
1402 if (invalid_map) 1403 if (invalid_map)
1403 dev_err(&pdev->dev, "invalid MAP value %u\n", map_value); 1404 dev_err(&pdev->dev, "invalid MAP value %u\n", map_value);
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index aaac4fb0d564..c482f8cadd7a 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -89,7 +89,6 @@ static int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
89static int ahci_hardreset(struct ata_link *link, unsigned int *class, 89static int ahci_hardreset(struct ata_link *link, unsigned int *class,
90 unsigned long deadline); 90 unsigned long deadline);
91static void ahci_postreset(struct ata_link *link, unsigned int *class); 91static void ahci_postreset(struct ata_link *link, unsigned int *class);
92static void ahci_error_handler(struct ata_port *ap);
93static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); 92static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
94static void ahci_dev_config(struct ata_device *dev); 93static void ahci_dev_config(struct ata_device *dev);
95#ifdef CONFIG_PM 94#ifdef CONFIG_PM
@@ -189,14 +188,15 @@ struct ata_port_operations ahci_pmp_retry_srst_ops = {
189}; 188};
190EXPORT_SYMBOL_GPL(ahci_pmp_retry_srst_ops); 189EXPORT_SYMBOL_GPL(ahci_pmp_retry_srst_ops);
191 190
192int ahci_em_messages = 1; 191static bool ahci_em_messages __read_mostly = true;
193EXPORT_SYMBOL_GPL(ahci_em_messages); 192EXPORT_SYMBOL_GPL(ahci_em_messages);
194module_param(ahci_em_messages, int, 0444); 193module_param(ahci_em_messages, bool, 0444);
195/* add other LED protocol types when they become supported */ 194/* add other LED protocol types when they become supported */
196MODULE_PARM_DESC(ahci_em_messages, 195MODULE_PARM_DESC(ahci_em_messages,
197 "AHCI Enclosure Management Message control (0 = off, 1 = on)"); 196 "AHCI Enclosure Management Message control (0 = off, 1 = on)");
198 197
199int devslp_idle_timeout = 1000; /* device sleep idle timeout in ms */ 198/* device sleep idle timeout in ms */
199static int devslp_idle_timeout __read_mostly = 1000;
200module_param(devslp_idle_timeout, int, 0644); 200module_param(devslp_idle_timeout, int, 0644);
201MODULE_PARM_DESC(devslp_idle_timeout, "device sleep idle timeout"); 201MODULE_PARM_DESC(devslp_idle_timeout, "device sleep idle timeout");
202 202
@@ -1275,9 +1275,11 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1275{ 1275{
1276 struct ata_port *ap = link->ap; 1276 struct ata_port *ap = link->ap;
1277 struct ahci_host_priv *hpriv = ap->host->private_data; 1277 struct ahci_host_priv *hpriv = ap->host->private_data;
1278 struct ahci_port_priv *pp = ap->private_data;
1278 const char *reason = NULL; 1279 const char *reason = NULL;
1279 unsigned long now, msecs; 1280 unsigned long now, msecs;
1280 struct ata_taskfile tf; 1281 struct ata_taskfile tf;
1282 bool fbs_disabled = false;
1281 int rc; 1283 int rc;
1282 1284
1283 DPRINTK("ENTER\n"); 1285 DPRINTK("ENTER\n");
@@ -1287,6 +1289,16 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1287 if (rc && rc != -EOPNOTSUPP) 1289 if (rc && rc != -EOPNOTSUPP)
1288 ata_link_warn(link, "failed to reset engine (errno=%d)\n", rc); 1290 ata_link_warn(link, "failed to reset engine (errno=%d)\n", rc);
1289 1291
1292 /*
1293 * According to AHCI-1.2 9.3.9: if FBS is enable, software shall
1294 * clear PxFBS.EN to '0' prior to issuing software reset to devices
1295 * that is attached to port multiplier.
1296 */
1297 if (!ata_is_host_link(link) && pp->fbs_enabled) {
1298 ahci_disable_fbs(ap);
1299 fbs_disabled = true;
1300 }
1301
1290 ata_tf_init(link->device, &tf); 1302 ata_tf_init(link->device, &tf);
1291 1303
1292 /* issue the first D2H Register FIS */ 1304 /* issue the first D2H Register FIS */
@@ -1327,6 +1339,10 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1327 } else 1339 } else
1328 *class = ahci_dev_classify(ap); 1340 *class = ahci_dev_classify(ap);
1329 1341
1342 /* re-enable FBS if disabled before */
1343 if (fbs_disabled)
1344 ahci_enable_fbs(ap);
1345
1330 DPRINTK("EXIT, class=%u\n", *class); 1346 DPRINTK("EXIT, class=%u\n", *class);
1331 return 0; 1347 return 0;
1332 1348
@@ -1989,7 +2005,7 @@ static void ahci_thaw(struct ata_port *ap)
1989 writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); 2005 writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
1990} 2006}
1991 2007
1992static void ahci_error_handler(struct ata_port *ap) 2008void ahci_error_handler(struct ata_port *ap)
1993{ 2009{
1994 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { 2010 if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
1995 /* restart engine */ 2011 /* restart engine */
@@ -2002,6 +2018,7 @@ static void ahci_error_handler(struct ata_port *ap)
2002 if (!ata_dev_enabled(ap->link.device)) 2018 if (!ata_dev_enabled(ap->link.device))
2003 ahci_stop_engine(ap); 2019 ahci_stop_engine(ap);
2004} 2020}
2021EXPORT_SYMBOL_GPL(ahci_error_handler);
2005 2022
2006static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) 2023static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
2007{ 2024{
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 83b1a9fb2d44..81a94a3919db 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4126,6 +4126,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4126 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, 4126 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 },
4127 { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA }, 4127 { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA },
4128 { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 }, 4128 { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 },
4129 { "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 },
4129 4130
4130 /* Devices we expect to fail diagnostics */ 4131 /* Devices we expect to fail diagnostics */
4131 4132
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 370462fa8e01..77bbc8266883 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2293,6 +2293,7 @@ const char *ata_get_cmd_descript(u8 command)
2293 { ATA_CMD_IDLE, "IDLE" }, 2293 { ATA_CMD_IDLE, "IDLE" },
2294 { ATA_CMD_EDD, "EXECUTE DEVICE DIAGNOSTIC" }, 2294 { ATA_CMD_EDD, "EXECUTE DEVICE DIAGNOSTIC" },
2295 { ATA_CMD_DOWNLOAD_MICRO, "DOWNLOAD MICROCODE" }, 2295 { ATA_CMD_DOWNLOAD_MICRO, "DOWNLOAD MICROCODE" },
2296 { ATA_CMD_DOWNLOAD_MICRO_DMA, "DOWNLOAD MICROCODE DMA" },
2296 { ATA_CMD_NOP, "NOP" }, 2297 { ATA_CMD_NOP, "NOP" },
2297 { ATA_CMD_FLUSH, "FLUSH CACHE" }, 2298 { ATA_CMD_FLUSH, "FLUSH CACHE" },
2298 { ATA_CMD_FLUSH_EXT, "FLUSH CACHE EXT" }, 2299 { ATA_CMD_FLUSH_EXT, "FLUSH CACHE EXT" },
@@ -2313,6 +2314,8 @@ const char *ata_get_cmd_descript(u8 command)
2313 { ATA_CMD_WRITE_QUEUED_FUA_EXT, "WRITE DMA QUEUED FUA EXT" }, 2314 { ATA_CMD_WRITE_QUEUED_FUA_EXT, "WRITE DMA QUEUED FUA EXT" },
2314 { ATA_CMD_FPDMA_READ, "READ FPDMA QUEUED" }, 2315 { ATA_CMD_FPDMA_READ, "READ FPDMA QUEUED" },
2315 { ATA_CMD_FPDMA_WRITE, "WRITE FPDMA QUEUED" }, 2316 { ATA_CMD_FPDMA_WRITE, "WRITE FPDMA QUEUED" },
2317 { ATA_CMD_FPDMA_SEND, "SEND FPDMA QUEUED" },
2318 { ATA_CMD_FPDMA_RECV, "RECEIVE FPDMA QUEUED" },
2316 { ATA_CMD_PIO_READ, "READ SECTOR(S)" }, 2319 { ATA_CMD_PIO_READ, "READ SECTOR(S)" },
2317 { ATA_CMD_PIO_READ_EXT, "READ SECTOR(S) EXT" }, 2320 { ATA_CMD_PIO_READ_EXT, "READ SECTOR(S) EXT" },
2318 { ATA_CMD_PIO_WRITE, "WRITE SECTOR(S)" }, 2321 { ATA_CMD_PIO_WRITE, "WRITE SECTOR(S)" },
@@ -2339,12 +2342,15 @@ const char *ata_get_cmd_descript(u8 command)
2339 { ATA_CMD_WRITE_LOG_EXT, "WRITE LOG EXT" }, 2342 { ATA_CMD_WRITE_LOG_EXT, "WRITE LOG EXT" },
2340 { ATA_CMD_READ_LOG_DMA_EXT, "READ LOG DMA EXT" }, 2343 { ATA_CMD_READ_LOG_DMA_EXT, "READ LOG DMA EXT" },
2341 { ATA_CMD_WRITE_LOG_DMA_EXT, "WRITE LOG DMA EXT" }, 2344 { ATA_CMD_WRITE_LOG_DMA_EXT, "WRITE LOG DMA EXT" },
2345 { ATA_CMD_TRUSTED_NONDATA, "TRUSTED NON-DATA" },
2342 { ATA_CMD_TRUSTED_RCV, "TRUSTED RECEIVE" }, 2346 { ATA_CMD_TRUSTED_RCV, "TRUSTED RECEIVE" },
2343 { ATA_CMD_TRUSTED_RCV_DMA, "TRUSTED RECEIVE DMA" }, 2347 { ATA_CMD_TRUSTED_RCV_DMA, "TRUSTED RECEIVE DMA" },
2344 { ATA_CMD_TRUSTED_SND, "TRUSTED SEND" }, 2348 { ATA_CMD_TRUSTED_SND, "TRUSTED SEND" },
2345 { ATA_CMD_TRUSTED_SND_DMA, "TRUSTED SEND DMA" }, 2349 { ATA_CMD_TRUSTED_SND_DMA, "TRUSTED SEND DMA" },
2346 { ATA_CMD_PMP_READ, "READ BUFFER" }, 2350 { ATA_CMD_PMP_READ, "READ BUFFER" },
2351 { ATA_CMD_PMP_READ_DMA, "READ BUFFER DMA" },
2347 { ATA_CMD_PMP_WRITE, "WRITE BUFFER" }, 2352 { ATA_CMD_PMP_WRITE, "WRITE BUFFER" },
2353 { ATA_CMD_PMP_WRITE_DMA, "WRITE BUFFER DMA" },
2348 { ATA_CMD_CONF_OVERLAY, "DEVICE CONFIGURATION OVERLAY" }, 2354 { ATA_CMD_CONF_OVERLAY, "DEVICE CONFIGURATION OVERLAY" },
2349 { ATA_CMD_SEC_SET_PASS, "SECURITY SET PASSWORD" }, 2355 { ATA_CMD_SEC_SET_PASS, "SECURITY SET PASSWORD" },
2350 { ATA_CMD_SEC_UNLOCK, "SECURITY UNLOCK" }, 2356 { ATA_CMD_SEC_UNLOCK, "SECURITY UNLOCK" },
@@ -2363,6 +2369,8 @@ const char *ata_get_cmd_descript(u8 command)
2363 { ATA_CMD_CFA_TRANS_SECT, "CFA TRANSLATE SECTOR" }, 2369 { ATA_CMD_CFA_TRANS_SECT, "CFA TRANSLATE SECTOR" },
2364 { ATA_CMD_CFA_ERASE, "CFA ERASE SECTORS" }, 2370 { ATA_CMD_CFA_ERASE, "CFA ERASE SECTORS" },
2365 { ATA_CMD_CFA_WRITE_MULT_NE, "CFA WRITE MULTIPLE WITHOUT ERASE" }, 2371 { ATA_CMD_CFA_WRITE_MULT_NE, "CFA WRITE MULTIPLE WITHOUT ERASE" },
2372 { ATA_CMD_REQ_SENSE_DATA, "REQUEST SENSE DATA EXT" },
2373 { ATA_CMD_SANITIZE_DEVICE, "SANITIZE DEVICE" },
2366 { ATA_CMD_READ_LONG, "READ LONG (with retries)" }, 2374 { ATA_CMD_READ_LONG, "READ LONG (with retries)" },
2367 { ATA_CMD_READ_LONG_ONCE, "READ LONG (without retries)" }, 2375 { ATA_CMD_READ_LONG_ONCE, "READ LONG (without retries)" },
2368 { ATA_CMD_WRITE_LONG, "WRITE LONG (with retries)" }, 2376 { ATA_CMD_WRITE_LONG, "WRITE LONG (with retries)" },
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index 150a917f0c3c..e37413228228 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -321,25 +321,25 @@ int ata_tport_add(struct device *parent,
321/* 321/*
322 * ATA link attributes 322 * ATA link attributes
323 */ 323 */
324static int noop(int x) { return x; }
324 325
325 326#define ata_link_show_linkspeed(field, format) \
326#define ata_link_show_linkspeed(field) \
327static ssize_t \ 327static ssize_t \
328show_ata_link_##field(struct device *dev, \ 328show_ata_link_##field(struct device *dev, \
329 struct device_attribute *attr, char *buf) \ 329 struct device_attribute *attr, char *buf) \
330{ \ 330{ \
331 struct ata_link *link = transport_class_to_link(dev); \ 331 struct ata_link *link = transport_class_to_link(dev); \
332 \ 332 \
333 return sprintf(buf,"%s\n", sata_spd_string(fls(link->field))); \ 333 return sprintf(buf, "%s\n", sata_spd_string(format(link->field))); \
334} 334}
335 335
336#define ata_link_linkspeed_attr(field) \ 336#define ata_link_linkspeed_attr(field, format) \
337 ata_link_show_linkspeed(field) \ 337 ata_link_show_linkspeed(field, format) \
338static DEVICE_ATTR(field, S_IRUGO, show_ata_link_##field, NULL) 338static DEVICE_ATTR(field, S_IRUGO, show_ata_link_##field, NULL)
339 339
340ata_link_linkspeed_attr(hw_sata_spd_limit); 340ata_link_linkspeed_attr(hw_sata_spd_limit, fls);
341ata_link_linkspeed_attr(sata_spd_limit); 341ata_link_linkspeed_attr(sata_spd_limit, fls);
342ata_link_linkspeed_attr(sata_spd); 342ata_link_linkspeed_attr(sata_spd, noop);
343 343
344 344
345static DECLARE_TRANSPORT_CLASS(ata_link_class, 345static DECLARE_TRANSPORT_CLASS(ata_link_class,
diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index 7f5e5d96327f..ea3b3dc10f33 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -343,13 +343,11 @@ static int highbank_initialize_phys(struct device *dev, void __iomem *addr)
343{ 343{
344 struct device_node *sata_node = dev->of_node; 344 struct device_node *sata_node = dev->of_node;
345 int phy_count = 0, phy, port = 0, i; 345 int phy_count = 0, phy, port = 0, i;
346 void __iomem *cphy_base[CPHY_PHY_COUNT]; 346 void __iomem *cphy_base[CPHY_PHY_COUNT] = {};
347 struct device_node *phy_nodes[CPHY_PHY_COUNT]; 347 struct device_node *phy_nodes[CPHY_PHY_COUNT] = {};
348 u32 tx_atten[CPHY_PORT_COUNT]; 348 u32 tx_atten[CPHY_PORT_COUNT] = {};
349 349
350 memset(port_data, 0, sizeof(struct phy_lane_info) * CPHY_PORT_COUNT); 350 memset(port_data, 0, sizeof(struct phy_lane_info) * CPHY_PORT_COUNT);
351 memset(phy_nodes, 0, sizeof(struct device_node*) * CPHY_PHY_COUNT);
352 memset(tx_atten, 0xff, CPHY_PORT_COUNT);
353 351
354 do { 352 do {
355 u32 tmp; 353 u32 tmp;
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index c2d95e9fb971..1dae9a9009f7 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -792,7 +792,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
792 dev_err(&pdev->dev, "failed to get access to sata clock\n"); 792 dev_err(&pdev->dev, "failed to get access to sata clock\n");
793 return PTR_ERR(priv->clk); 793 return PTR_ERR(priv->clk);
794 } 794 }
795 clk_enable(priv->clk); 795 clk_prepare_enable(priv->clk);
796 796
797 host = ata_host_alloc(&pdev->dev, 1); 797 host = ata_host_alloc(&pdev->dev, 1);
798 if (!host) { 798 if (!host) {
@@ -822,7 +822,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
822 return 0; 822 return 0;
823 823
824cleanup: 824cleanup:
825 clk_disable(priv->clk); 825 clk_disable_unprepare(priv->clk);
826 826
827 return ret; 827 return ret;
828} 828}
@@ -841,7 +841,7 @@ static int sata_rcar_remove(struct platform_device *pdev)
841 iowrite32(0, base + SATAINTSTAT_REG); 841 iowrite32(0, base + SATAINTSTAT_REG);
842 iowrite32(0x7ff, base + SATAINTMASK_REG); 842 iowrite32(0x7ff, base + SATAINTMASK_REG);
843 843
844 clk_disable(priv->clk); 844 clk_disable_unprepare(priv->clk);
845 845
846 return 0; 846 return 0;
847} 847}
@@ -861,7 +861,7 @@ static int sata_rcar_suspend(struct device *dev)
861 /* mask */ 861 /* mask */
862 iowrite32(0x7ff, base + SATAINTMASK_REG); 862 iowrite32(0x7ff, base + SATAINTMASK_REG);
863 863
864 clk_disable(priv->clk); 864 clk_disable_unprepare(priv->clk);
865 } 865 }
866 866
867 return ret; 867 return ret;
@@ -873,7 +873,7 @@ static int sata_rcar_resume(struct device *dev)
873 struct sata_rcar_priv *priv = host->private_data; 873 struct sata_rcar_priv *priv = host->private_data;
874 void __iomem *base = priv->base; 874 void __iomem *base = priv->base;
875 875
876 clk_enable(priv->clk); 876 clk_prepare_enable(priv->clk);
877 877
878 /* ack and mask */ 878 /* ack and mask */
879 iowrite32(0, base + SATAINTSTAT_REG); 879 iowrite32(0, base + SATAINTSTAT_REG);