Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Tejun Heo <tj@kernel.org>, linux-ide@vger.kernel.org
Cc: vladimir.barinov@cogentembedded.com
Subject: Re: [PATCH v3 1/4] libata: add R-Car SATA driver
Date: Sat, 25 May 2013 03:12:22 +0400	[thread overview]
Message-ID: <519FF3D6.2090202@cogentembedded.com> (raw)
In-Reply-To: <201302202310.30443.sergei.shtylyov@cogentembedded.com>

Hello.

On 02/20/2013 11:10 PM, Sergei Shtylyov wrote:

     Tejun, a question for you... see below.

> From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
>
> Add Renesas R-Car on-chip 3Gbps SATA controller driver.
>
> Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
> [Sergei: few bugs fixed, significant cleanup]

     Not all bugs turned out to be fixed... :-/

> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
[...]
> Index: renesas/drivers/ata/sata_rcar.c
> ===================================================================
> --- /dev/null
> +++ renesas/drivers/ata/sata_rcar.c
> @@ -0,0 +1,910 @@
[...]
> +static void sata_rcar_bmdma_fill_sg(struct ata_queued_cmd *qc)
> +{
> +	struct ata_port *ap = qc->ap;
> +	struct ata_bmdma_prd *prd = ap->bmdma_prd;
> +	struct scatterlist *sg;
> +	unsigned int si, pi;
> +
> +	pi = 0;
> +	for_each_sg(qc->sg, sg, qc->n_elem, si) {
> +		u32 addr, sg_len, len;
> +
> +		/*
> +		 * Note: h/w doesn't support 64-bit, so we unconditionally
> +		 * truncate dma_addr_t to u32.
> +		 */
> +		addr = (u32)sg_dma_address(sg);
> +		sg_len = sg_dma_len(sg);
> +
> +		/* H/w transfer count is only 29 bits long, let's be careful */
> +		while (sg_len) {
> +			len = sg_len;
> +			if (len > 0x1ffffffe)

    This value should have been put into the 'dma_boundary' field of the
'struct scsi_host_template', IIUC. Tejun, if I do it, do I need this 
check at all?

> +				len = 0x1ffffffe;
> +
> +			prd[pi].addr = cpu_to_le32(addr);
> +			prd[pi].flags_len = cpu_to_le32(len);
> +			VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len);
> +
> +			pi++;
> +			sg_len -= len;
> +			addr += len;
> +		}
> +	}
> +
> +	/* end-of-table flag */
> +	prd[pi - 1].addr |= cpu_to_le32(SATA_RCAR_DTEND);
> +}
[...]
> +static struct scsi_host_template sata_rcar_sht = {
> +	ATA_BMDMA_SHT(DRV_NAME),
> +};

     This should have been ATA_BASE_SHT() and the proepr values 
specified for
the 'sg_tablesize' and 'dma_boundary' fields. R-Car SATA descriptors are not
the same as SFF-8038i, they allow up to 512 megs of data to be specified in
one descriptor and don't care about 64KiB boundaries.

WBR, Sergei


  reply	other threads:[~2013-05-24 23:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20 20:10 [PATCH v3 1/4] libata: add R-Car SATA driver Sergei Shtylyov
2013-05-24 23:12 ` Sergei Shtylyov [this message]
2013-05-25 23:16   ` Sergei Shtylyov
2013-05-25 23:20     ` Tejun Heo
2013-05-25 23:23       ` Tejun Heo
2013-05-25 23:34         ` Sergei Shtylyov
2013-05-26  0:23           ` Tejun Heo
2013-05-27 20:32             ` Sergei Shtylyov
2013-05-28  0:09               ` Tejun Heo
2013-05-28 12:19                 ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=519FF3D6.2090202@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=vladimir.barinov@cogentembedded.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox