linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ata: ftide010: Add a quirk for SQ201
@ 2018-07-15 20:09 Linus Walleij
  2018-07-16 19:17 ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2018-07-15 20:09 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 drivers/ata/pata_ftide010.c | 27 +++++++++++++++++----------
 1 file 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 = {
 	.qc_issue	= ftide010_qc_issue,
 };
 
-static struct ata_port_info ftide010_port_info[] = {
-	{
-		.flags		= ATA_FLAG_SLAVE_POSS,
-		.mwdma_mask	= ATA_MWDMA2,
-		.udma_mask	= ATA_UDMA6,
-		.pio_mask	= ATA_PIO4,
-		.port_ops	= &pata_ftide010_port_ops,
-	},
+static struct ata_port_info ftide010_port_info = {
+	.flags		= ATA_FLAG_SLAVE_POSS,
+	.mwdma_mask	= ATA_MWDMA2,
+	.udma_mask	= ATA_UDMA6,
+	.pio_mask	= ATA_PIO4,
+	.port_ops	= &pata_ftide010_port_ops,
 };
 
 #if IS_ENABLED(CONFIG_SATA_GEMINI)
@@ -349,6 +347,7 @@ static int pata_ftide010_gemini_cable_detect(struct ata_port *ap)
 }
 
 static int pata_ftide010_gemini_init(struct ftide010 *ftide,
+				     struct ata_port_info *pi,
 				     bool is_ata1)
 {
 	struct device *dev = ftide->dev;
@@ -373,7 +372,13 @@ static int pata_ftide010_gemini_init(struct ftide010 *ftide,
 
 	/* Flag port as SATA-capable */
 	if (gemini_sata_bridge_enabled(sg, is_ata1))
-		ftide010_port_info[0].flags |= ATA_FLAG_SATA;
+		pi->flags |= ATA_FLAG_SATA;
+
+	/* This device has broken DMA, only PIO works */
+	if (of_machine_is_compatible("itian,sq201")) {
+		pi->mwdma_mask = 0;
+		pi->udma_mask = 0;
+	}
 
 	/*
 	 * 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,
 }
 #else
 static int pata_ftide010_gemini_init(struct ftide010 *ftide,
+				     struct ata_port_info *pi,
 				     bool is_ata1)
 {
 	return -ENOTSUPP;
@@ -446,7 +452,7 @@ static int pata_ftide010_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
-	const struct ata_port_info pi = ftide010_port_info[0];
+	struct ata_port_info pi = ftide010_port_info;
 	const struct ata_port_info *ppi[] = { &pi, NULL };
 	struct ftide010 *ftide;
 	struct resource *res;
@@ -490,6 +496,7 @@ static int pata_ftide010_probe(struct platform_device *pdev)
 		 * are ATA0. This will also set up the cable types.
 		 */
 		ret = pata_ftide010_gemini_init(ftide,
+				&pi,
 				(res->start == 0x63400000));
 		if (ret)
 			goto err_dis_clk;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ata: ftide010: Add a quirk for SQ201
  2018-07-15 20:09 [PATCH] ata: ftide010: Add a quirk for SQ201 Linus Walleij
@ 2018-07-16 19:17 ` Tejun Heo
  2018-08-27 20:22   ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2018-07-16 19:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Jul 15, 2018 at 10:09:29PM +0200, Linus Walleij wrote:
> 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>

Applied to libata/for-4.18-fixes.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ata: ftide010: Add a quirk for SQ201
  2018-07-16 19:17 ` Tejun Heo
@ 2018-08-27 20:22   ` Linus Walleij
  2018-08-27 20:26     ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2018-08-27 20:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 16, 2018 at 9:18 PM Tejun Heo <tj@kernel.org> wrote:
> On Sun, Jul 15, 2018 at 10:09:29PM +0200, Linus Walleij wrote:
> > 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>
>
> Applied to libata/for-4.18-fixes.

This never appeared in the tree, it's still not there in v4.19-rc1!

Jens can you apply it?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ata: ftide010: Add a quirk for SQ201
  2018-08-27 20:22   ` Linus Walleij
@ 2018-08-27 20:26     ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2018-08-27 20:26 UTC (permalink / raw)
  To: linux-arm-kernel

On 8/27/18 2:22 PM, Linus Walleij wrote:
> On Mon, Jul 16, 2018 at 9:18 PM Tejun Heo <tj@kernel.org> wrote:
>> On Sun, Jul 15, 2018 at 10:09:29PM +0200, Linus Walleij wrote:
>>> 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>
>>
>> Applied to libata/for-4.18-fixes.
> 
> This never appeared in the tree, it's still not there in v4.19-rc1!
> 
> Jens can you apply it?

Done, thanks.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-27 20:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-15 20:09 [PATCH] ata: ftide010: Add a quirk for SQ201 Linus Walleij
2018-07-16 19:17 ` Tejun Heo
2018-08-27 20:22   ` Linus Walleij
2018-08-27 20:26     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).