aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2018-07-15 16:09:29 -0400
committerJens Axboe <axboe@kernel.dk>2018-08-27 16:25:54 -0400
commit46cb52ad414ac829680d0bb8cc7090ac2b577ca7 (patch)
treea98945569eadd0436c5792f0edb8a61cc6fb1fdf
parentb0a84beb2e35536839ea289182684528f379b860 (diff)
ata: ftide010: Add a quirk for SQ201
The DMA is broken on this specific device for some unknown reason (probably badly designed or plain broken interface electronics) and will only work with PIO. Other users of the same hardware does not have this problem. Add a specific quirk so that this Gemini device gets DMA turned off. Also fix up some code around passing the port information around in probe while we're at it. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/ata/pata_ftide010.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/ata/pata_ftide010.c b/drivers/ata/pata_ftide010.c
index 5d4b72e21161..569a4a662dcd 100644
--- a/drivers/ata/pata_ftide010.c
+++ b/drivers/ata/pata_ftide010.c
@@ -256,14 +256,12 @@ static struct ata_port_operations pata_ftide010_port_ops = {
256 .qc_issue = ftide010_qc_issue, 256 .qc_issue = ftide010_qc_issue,
257}; 257};
258 258
259static struct ata_port_info ftide010_port_info[] = { 259static struct ata_port_info ftide010_port_info = {
260 { 260 .flags = ATA_FLAG_SLAVE_POSS,
261 .flags = ATA_FLAG_SLAVE_POSS, 261 .mwdma_mask = ATA_MWDMA2,
262 .mwdma_mask = ATA_MWDMA2, 262 .udma_mask = ATA_UDMA6,
263 .udma_mask = ATA_UDMA6, 263 .pio_mask = ATA_PIO4,
264 .pio_mask = ATA_PIO4, 264 .port_ops = &pata_ftide010_port_ops,
265 .port_ops = &pata_ftide010_port_ops,
266 },
267}; 265};
268 266
269#if IS_ENABLED(CONFIG_SATA_GEMINI) 267#if IS_ENABLED(CONFIG_SATA_GEMINI)
@@ -349,6 +347,7 @@ static int pata_ftide010_gemini_cable_detect(struct ata_port *ap)
349} 347}
350 348
351static int pata_ftide010_gemini_init(struct ftide010 *ftide, 349static int pata_ftide010_gemini_init(struct ftide010 *ftide,
350 struct ata_port_info *pi,
352 bool is_ata1) 351 bool is_ata1)
353{ 352{
354 struct device *dev = ftide->dev; 353 struct device *dev = ftide->dev;
@@ -373,7 +372,13 @@ static int pata_ftide010_gemini_init(struct ftide010 *ftide,
373 372
374 /* Flag port as SATA-capable */ 373 /* Flag port as SATA-capable */
375 if (gemini_sata_bridge_enabled(sg, is_ata1)) 374 if (gemini_sata_bridge_enabled(sg, is_ata1))
376 ftide010_port_info[0].flags |= ATA_FLAG_SATA; 375 pi->flags |= ATA_FLAG_SATA;
376
377 /* This device has broken DMA, only PIO works */
378 if (of_machine_is_compatible("itian,sq201")) {
379 pi->mwdma_mask = 0;
380 pi->udma_mask = 0;
381 }
377 382
378 /* 383 /*
379 * We assume that a simple 40-wire cable is used in the PATA mode. 384 * We assume that a simple 40-wire cable is used in the PATA mode.
@@ -435,6 +440,7 @@ static int pata_ftide010_gemini_init(struct ftide010 *ftide,
435} 440}
436#else 441#else
437static int pata_ftide010_gemini_init(struct ftide010 *ftide, 442static int pata_ftide010_gemini_init(struct ftide010 *ftide,
443 struct ata_port_info *pi,
438 bool is_ata1) 444 bool is_ata1)
439{ 445{
440 return -ENOTSUPP; 446 return -ENOTSUPP;
@@ -446,7 +452,7 @@ static int pata_ftide010_probe(struct platform_device *pdev)
446{ 452{
447 struct device *dev = &pdev->dev; 453 struct device *dev = &pdev->dev;
448 struct device_node *np = dev->of_node; 454 struct device_node *np = dev->of_node;
449 const struct ata_port_info pi = ftide010_port_info[0]; 455 struct ata_port_info pi = ftide010_port_info;
450 const struct ata_port_info *ppi[] = { &pi, NULL }; 456 const struct ata_port_info *ppi[] = { &pi, NULL };
451 struct ftide010 *ftide; 457 struct ftide010 *ftide;
452 struct resource *res; 458 struct resource *res;
@@ -490,6 +496,7 @@ static int pata_ftide010_probe(struct platform_device *pdev)
490 * are ATA0. This will also set up the cable types. 496 * are ATA0. This will also set up the cable types.
491 */ 497 */
492 ret = pata_ftide010_gemini_init(ftide, 498 ret = pata_ftide010_gemini_init(ftide,
499 &pi,
493 (res->start == 0x63400000)); 500 (res->start == 0x63400000));
494 if (ret) 501 if (ret)
495 goto err_dis_clk; 502 goto err_dis_clk;