mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>
Cc: agross@kernel.org, andersson@kernel.org,
	konrad.dybcio@linaro.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, vkoul@kernel.org,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
	quic_msavaliy@quicinc.com, dianders@chromium.org,
	mka@chromium.org, swboyd@chromium.org, quic_vtanuku@quicinc.com
Subject: Re: [PATCH 2/2] spi: spi-qcom-qspi: Add DMA mode support
Date: Tue, 4 Apr 2023 19:17:08 +0100	[thread overview]
Message-ID: <d784dab7-a1a6-4db7-aa13-e39e9904f342@sirena.org.uk> (raw)
In-Reply-To: <1680631400-28865-3-git-send-email-quic_vnivarth@quicinc.com>

[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]

On Tue, Apr 04, 2023 at 11:33:20PM +0530, Vijaya Krishna Nivarthi wrote:

A few quick review comments, mostly coding style though.

> +struct qspi_cmd_desc {
> +	uint32_t data_address;
> +	uint32_t next_descriptor;
> +	uint32_t direction:1;
> +	uint32_t multi_io_mode:3;
> +	uint32_t reserved1:4;
> +	uint32_t fragment:1;
> +	uint32_t reserved2:7;
> +	uint32_t length:16;
> +	//------------------------//

What does this mean?

> +	uint8_t *bounce_src;
> +	uint8_t *bounce_dst;
> +	uint32_t bounce_length;
> +};

> +
> +#define QSPI_MAX_NUM_DESC 5
>  struct qspi_xfer {

Missing blank line after the define...

> +	for (ii = 0; ii < sgt->nents; ii++)
> +		sg_total_len += sg_dma_len(sgt->sgl + ii);

Why are we calling the iterator ii here?

> +	if (ctrl->xfer.dir == QSPI_READ)
> +		byte_ptr = (uint8_t *)xfer->rx_buf;
> +	else
> +		byte_ptr = (uint8_t *)xfer->tx_buf;

If we need to cast to or from void * there's some sort of problem.

> +/* Switch to DMA if transfer length exceeds this */
> +#define QSPI_MAX_BYTES_FIFO 64
> +#define NO_TX_DATA_DELAY_FOR_DMA 1
> +#define DMA_CONDITIONAL (xfer->len > QSPI_MAX_BYTES_FIFO)
> +

DMA_CONDITIONAL absolutely should not be a define, this just makes
things harder to read.  Just have everything call can_dma() when needed.

> +#if NO_TX_DATA_DELAY_FOR_DMA
> +		mstr_cfg &= ~(TX_DATA_OE_DELAY_MSK | TX_DATA_DELAY_MSK);
> +#endif

Why would we add extra delays if we don't need them, might someone set
this and if so when?

> +	if (ctrl->xfer_mode == QSPI_FIFO) {

> +	} else if (ctrl->xfer_mode == QSPI_DMA) {

>  	}

This should be a switch statement.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2023-04-04 18:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 18:03 [PATCH 0/2] spi: Add DMA mode support to spi-qcom-qspi Vijaya Krishna Nivarthi
2023-04-04 18:03 ` [PATCH 1/2] arm64: dts: qcom: sc7280: Add stream-id of qspi to iommus Vijaya Krishna Nivarthi
2023-04-04 18:19   ` Krzysztof Kozlowski
2023-04-12 15:28     ` Vijaya Krishna Nivarthi
2023-04-04 18:03 ` [PATCH 2/2] spi: spi-qcom-qspi: Add DMA mode support Vijaya Krishna Nivarthi
2023-04-04 18:17   ` Mark Brown [this message]
2023-04-06 14:53     ` Vijaya Krishna Nivarthi
2023-04-06 15:28       ` Mark Brown
2023-04-12 15:29         ` Vijaya Krishna Nivarthi
2023-04-12 16:12           ` Mark Brown
2023-04-12 17:27             ` Vijaya Krishna Nivarthi
2023-04-04 20:45   ` Stephen Boyd
2023-04-12 15:28     ` Vijaya Krishna Nivarthi
2023-04-04 22:05   ` kernel test robot
2023-04-04 20:30 ` [PATCH 0/2] spi: Add DMA mode support to spi-qcom-qspi Stephen Boyd
2023-04-12 15:28   ` Vijaya Krishna Nivarthi

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=d784dab7-a1a6-4db7-aa13-e39e9904f342@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=quic_msavaliy@quicinc.com \
    --cc=quic_vnivarth@quicinc.com \
    --cc=quic_vtanuku@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=swboyd@chromium.org \
    --cc=vkoul@kernel.org \
    /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

all inboxes | Powered by JetHome®