Skip to content

Commit 13aa7e0

Browse files
committed
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
2 parents c08acff + 9f961a5 commit 13aa7e0

12 files changed

Lines changed: 171 additions & 35 deletions

File tree

‎drivers/ata/ahci.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {
292292
{ PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */
293293
{ PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */
294294
{ 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 */
295299

296300
/* JMicron 360/1/3/5/6, match class to avoid IDE function */
297301
{ PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,

‎drivers/ata/ahci.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ extern struct device_attribute *ahci_sdev_attrs[];
339339
.sdev_attrs = ahci_sdev_attrs
340340

341341
extern struct ata_port_operations ahci_ops;
342+
extern struct ata_port_operations ahci_platform_ops;
342343
extern struct ata_port_operations ahci_pmp_retry_srst_ops;
343344

344345
unsigned int ahci_dev_classify(struct ata_port *ap);
@@ -368,6 +369,7 @@ irqreturn_t ahci_hw_interrupt(int irq, void *dev_instance);
368369
irqreturn_t ahci_thread_fn(int irq, void *dev_instance);
369370
void ahci_print_info(struct ata_host *host, const char *scc_s);
370371
int ahci_host_activate(struct ata_host *host, int irq, unsigned int n_msis);
372+
void ahci_error_handler(struct ata_port *ap);
371373

372374
static inline void __iomem *__ahci_port_base(struct ata_host *host,
373375
unsigned int port_no)

‎drivers/ata/ahci_imx.c‎

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2+
* copyright (c) 2013 Freescale Semiconductor, Inc.
23
* Freescale IMX AHCI SATA platform driver
3-
* Copyright 2013 Freescale Semiconductor, Inc.
44
*
55
* based on the AHCI SATA platform driver by Jeff Garzik and Anton Vorontsov
66
*
@@ -25,17 +25,70 @@
2525
#include <linux/of_device.h>
2626
#include <linux/mfd/syscon.h>
2727
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
28+
#include <linux/libata.h>
2829
#include "ahci.h"
2930

3031
enum {
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 */
3235
};
3336

3437
struct imx_ahci_priv {
3538
struct platform_device *ahci_pdev;
3639
struct clk *sata_ref_clk;
3740
struct clk *ahb_clk;
3841
struct regmap *gpr;
42+
bool no_device;
43+
bool first_time;
44+
};
45+
46+
static int ahci_imx_hotplug;
47+
module_param_named(hotplug, ahci_imx_hotplug, int, 0644);
48+
MODULE_PARM_DESC(hotplug, "AHCI IMX hot-plug support (0=Don't support, 1=support)");
49+
50+
static 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+
82+
static struct ata_port_operations ahci_imx_ops = {
83+
.inherits = &ahci_platform_ops,
84+
.error_handler = ahci_imx_error_handler,
85+
};
86+
87+
static 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,
3992
};
4093

4194
static int imx6q_sata_init(struct device *dev, void __iomem *mmio)
@@ -117,9 +170,51 @@ static void imx6q_sata_exit(struct device *dev)
117170
clk_disable_unprepare(imxpriv->sata_ref_clk);
118171
}
119172

173+
static 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+
191+
static 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+
120212
static struct ahci_platform_data imx6q_sata_pdata = {
121213
.init = imx6q_sata_init,
122214
.exit = imx6q_sata_exit,
215+
.ata_port_info = &ahci_imx_port_info,
216+
.suspend = imx_ahci_suspend,
217+
.resume = imx_ahci_resume,
123218
};
124219

125220
static const struct of_device_id imx_ahci_of_match[] = {
@@ -152,6 +247,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
152247
ahci_dev = &ahci_pdev->dev;
153248
ahci_dev->parent = dev;
154249

250+
imxpriv->no_device = false;
251+
imxpriv->first_time = true;
155252
imxpriv->ahb_clk = devm_clk_get(dev, "ahb");
156253
if (IS_ERR(imxpriv->ahb_clk)) {
157254
dev_err(dev, "can't get ahb clock.\n");

‎drivers/ata/ahci_platform.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ static struct platform_device_id ahci_devtype[] = {
4949
};
5050
MODULE_DEVICE_TABLE(platform, ahci_devtype);
5151

52-
static struct ata_port_operations ahci_platform_ops = {
52+
struct ata_port_operations ahci_platform_ops = {
5353
.inherits = &ahci_ops,
5454
.host_stop = ahci_host_stop,
5555
};
56+
EXPORT_SYMBOL_GPL(ahci_platform_ops);
5657

5758
static struct ata_port_operations ahci_platform_retry_srst_ops = {
5859
.inherits = &ahci_pmp_retry_srst_ops,

‎drivers/ata/ata_piix.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100

101101
enum {
102102
PIIX_IOCFG = 0x54, /* IDE I/O configuration register */
103-
ICH5_PMR = 0x90, /* port mapping register */
103+
ICH5_PMR = 0x90, /* address map register */
104104
ICH5_PCS = 0x92, /* port control and status */
105105
PIIX_SIDPR_BAR = 5,
106106
PIIX_SIDPR_LEN = 16,
@@ -233,7 +233,7 @@ static const struct pci_device_id piix_pci_tbl[] = {
233233
PCI_CLASS_STORAGE_IDE << 8, 0xffff00, ich6m_sata },
234234
/* 82801GB/GR/GH (ICH7, identical to ICH6) */
235235
{ 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) */
237237
{ 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6m_sata },
238238
/* Enterprise Southbridge 2 (631xESB/632xESB) */
239239
{ 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)
517517
const struct ich_laptop *lap = &ich_laptop[0];
518518
u8 mask;
519519

520-
/* Check for specials - Acer Aspire 5602WLMi */
520+
/* Check for specials */
521521
while (lap->device) {
522522
if (lap->device == pdev->device &&
523523
lap->subvendor == pdev->subsystem_vendor &&
@@ -1366,38 +1366,39 @@ static const int *piix_init_sata_map(struct pci_dev *pdev,
13661366
const int *map;
13671367
int i, invalid_map = 0;
13681368
u8 map_value;
1369+
char buf[32];
1370+
char *p = buf, *end = buf + sizeof(buf);
13691371

13701372
pci_read_config_byte(pdev, ICH5_PMR, &map_value);
13711373

13721374
map = map_db->map[map_value & map_db->mask];
13731375

1374-
dev_info(&pdev->dev, "MAP [");
13751376
for (i = 0; i < 4; i++) {
13761377
switch (map[i]) {
13771378
case RV:
13781379
invalid_map = 1;
1379-
pr_cont(" XX");
1380+
p += scnprintf(p, end - p, " XX");
13801381
break;
13811382

13821383
case NA:
1383-
pr_cont(" --");
1384+
p += scnprintf(p, end - p, " --");
13841385
break;
13851386

13861387
case IDE:
13871388
WARN_ON((i & 1) || map[i + 1] != IDE);
13881389
pinfo[i / 2] = piix_port_info[ich_pata_100];
13891390
i++;
1390-
pr_cont(" IDE IDE");
1391+
p += scnprintf(p, end - p, " IDE IDE");
13911392
break;
13921393

13931394
default:
1394-
pr_cont(" P%d", map[i]);
1395+
p += scnprintf(p, end - p, " P%d", map[i]);
13951396
if (i & 1)
13961397
pinfo[i / 2].flags |= ATA_FLAG_SLAVE_POSS;
13971398
break;
13981399
}
13991400
}
1400-
pr_cont(" ]\n");
1401+
dev_info(&pdev->dev, "MAP [%s ]\n", buf);
14011402

14021403
if (invalid_map)
14031404
dev_err(&pdev->dev, "invalid MAP value %u\n", map_value);

‎drivers/ata/libahci.c‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ static int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
8989
static int ahci_hardreset(struct ata_link *link, unsigned int *class,
9090
unsigned long deadline);
9191
static void ahci_postreset(struct ata_link *link, unsigned int *class);
92-
static void ahci_error_handler(struct ata_port *ap);
9392
static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
9493
static void ahci_dev_config(struct ata_device *dev);
9594
#ifdef CONFIG_PM
@@ -189,14 +188,15 @@ struct ata_port_operations ahci_pmp_retry_srst_ops = {
189188
};
190189
EXPORT_SYMBOL_GPL(ahci_pmp_retry_srst_ops);
191190

192-
int ahci_em_messages = 1;
191+
static bool ahci_em_messages __read_mostly = true;
193192
EXPORT_SYMBOL_GPL(ahci_em_messages);
194-
module_param(ahci_em_messages, int, 0444);
193+
module_param(ahci_em_messages, bool, 0444);
195194
/* add other LED protocol types when they become supported */
196195
MODULE_PARM_DESC(ahci_em_messages,
197196
"AHCI Enclosure Management Message control (0 = off, 1 = on)");
198197

199-
int devslp_idle_timeout = 1000; /* device sleep idle timeout in ms */
198+
/* device sleep idle timeout in ms */
199+
static int devslp_idle_timeout __read_mostly = 1000;
200200
module_param(devslp_idle_timeout, int, 0644);
201201
MODULE_PARM_DESC(devslp_idle_timeout, "device sleep idle timeout");
202202

@@ -1275,9 +1275,11 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
12751275
{
12761276
struct ata_port *ap = link->ap;
12771277
struct ahci_host_priv *hpriv = ap->host->private_data;
1278+
struct ahci_port_priv *pp = ap->private_data;
12781279
const char *reason = NULL;
12791280
unsigned long now, msecs;
12801281
struct ata_taskfile tf;
1282+
bool fbs_disabled = false;
12811283
int rc;
12821284

12831285
DPRINTK("ENTER\n");
@@ -1287,6 +1289,16 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
12871289
if (rc && rc != -EOPNOTSUPP)
12881290
ata_link_warn(link, "failed to reset engine (errno=%d)\n", rc);
12891291

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+
12901302
ata_tf_init(link->device, &tf);
12911303

12921304
/* issue the first D2H Register FIS */
@@ -1327,6 +1339,10 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
13271339
} else
13281340
*class = ahci_dev_classify(ap);
13291341

1342+
/* re-enable FBS if disabled before */
1343+
if (fbs_disabled)
1344+
ahci_enable_fbs(ap);
1345+
13301346
DPRINTK("EXIT, class=%u\n", *class);
13311347
return 0;
13321348

@@ -1989,7 +2005,7 @@ static void ahci_thaw(struct ata_port *ap)
19892005
writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
19902006
}
19912007

1992-
static void ahci_error_handler(struct ata_port *ap)
2008+
void ahci_error_handler(struct ata_port *ap)
19932009
{
19942010
if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
19952011
/* restart engine */
@@ -2002,6 +2018,7 @@ static void ahci_error_handler(struct ata_port *ap)
20022018
if (!ata_dev_enabled(ap->link.device))
20032019
ahci_stop_engine(ap);
20042020
}
2021+
EXPORT_SYMBOL_GPL(ahci_error_handler);
20052022

20062023
static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
20072024
{

‎drivers/ata/libata-core.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4126,6 +4126,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
41264126
{ "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 },
41274127
{ "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA },
41284128
{ "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 },
4129+
{ "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 },
41294130

41304131
/* Devices we expect to fail diagnostics */
41314132

‎drivers/ata/libata-eh.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2293,6 +2293,7 @@ const char *ata_get_cmd_descript(u8 command)
22932293
{ ATA_CMD_IDLE, "IDLE" },
22942294
{ ATA_CMD_EDD, "EXECUTE DEVICE DIAGNOSTIC" },
22952295
{ ATA_CMD_DOWNLOAD_MICRO, "DOWNLOAD MICROCODE" },
2296+
{ ATA_CMD_DOWNLOAD_MICRO_DMA, "DOWNLOAD MICROCODE DMA" },
22962297
{ ATA_CMD_NOP, "NOP" },
22972298
{ ATA_CMD_FLUSH, "FLUSH CACHE" },
22982299
{ ATA_CMD_FLUSH_EXT, "FLUSH CACHE EXT" },
@@ -2313,6 +2314,8 @@ const char *ata_get_cmd_descript(u8 command)
23132314
{ ATA_CMD_WRITE_QUEUED_FUA_EXT, "WRITE DMA QUEUED FUA EXT" },
23142315
{ ATA_CMD_FPDMA_READ, "READ FPDMA QUEUED" },
23152316
{ ATA_CMD_FPDMA_WRITE, "WRITE FPDMA QUEUED" },
2317+
{ ATA_CMD_FPDMA_SEND, "SEND FPDMA QUEUED" },
2318+
{ ATA_CMD_FPDMA_RECV, "RECEIVE FPDMA QUEUED" },
23162319
{ ATA_CMD_PIO_READ, "READ SECTOR(S)" },
23172320
{ ATA_CMD_PIO_READ_EXT, "READ SECTOR(S) EXT" },
23182321
{ ATA_CMD_PIO_WRITE, "WRITE SECTOR(S)" },
@@ -2339,12 +2342,15 @@ const char *ata_get_cmd_descript(u8 command)
23392342
{ ATA_CMD_WRITE_LOG_EXT, "WRITE LOG EXT" },
23402343
{ ATA_CMD_READ_LOG_DMA_EXT, "READ LOG DMA EXT" },
23412344
{ ATA_CMD_WRITE_LOG_DMA_EXT, "WRITE LOG DMA EXT" },
2345+
{ ATA_CMD_TRUSTED_NONDATA, "TRUSTED NON-DATA" },
23422346
{ ATA_CMD_TRUSTED_RCV, "TRUSTED RECEIVE" },
23432347
{ ATA_CMD_TRUSTED_RCV_DMA, "TRUSTED RECEIVE DMA" },
23442348
{ ATA_CMD_TRUSTED_SND, "TRUSTED SEND" },
23452349
{ ATA_CMD_TRUSTED_SND_DMA, "TRUSTED SEND DMA" },
23462350
{ ATA_CMD_PMP_READ, "READ BUFFER" },
2351+
{ ATA_CMD_PMP_READ_DMA, "READ BUFFER DMA" },
23472352
{ ATA_CMD_PMP_WRITE, "WRITE BUFFER" },
2353+
{ ATA_CMD_PMP_WRITE_DMA, "WRITE BUFFER DMA" },
23482354
{ ATA_CMD_CONF_OVERLAY, "DEVICE CONFIGURATION OVERLAY" },
23492355
{ ATA_CMD_SEC_SET_PASS, "SECURITY SET PASSWORD" },
23502356
{ ATA_CMD_SEC_UNLOCK, "SECURITY UNLOCK" },
@@ -2363,6 +2369,8 @@ const char *ata_get_cmd_descript(u8 command)
23632369
{ ATA_CMD_CFA_TRANS_SECT, "CFA TRANSLATE SECTOR" },
23642370
{ ATA_CMD_CFA_ERASE, "CFA ERASE SECTORS" },
23652371
{ 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" },
23662374
{ ATA_CMD_READ_LONG, "READ LONG (with retries)" },
23672375
{ ATA_CMD_READ_LONG_ONCE, "READ LONG (without retries)" },
23682376
{ ATA_CMD_WRITE_LONG, "WRITE LONG (with retries)" },

0 commit comments

Comments
 (0)