public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Hannes Schmelzer <hannes@schmelzer.or.at>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 01/16] spi: Add zynq qspi controller driver
Date: Tue, 13 Oct 2015 14:22:39 +0200	[thread overview]
Message-ID: <561CF78F.9080000@schmelzer.or.at> (raw)
In-Reply-To: <1441087907-25993-2-git-send-email-jteki@openedev.com>

Hi there,

i am currently debugging on my zynq zc702 board and therefore i have to 
study the qspi-driver :-)

i've some questions about the implementation details.

On 01.09.2015 08:11, Jagan Teki wrote:
> Added zynq qspi controller driver for Xilinx Zynq APSOC,
> this driver is driver-model driven with devicetree support.
(....)
> +static void zynq_qspi_fill_tx_fifo(struct zynq_qspi_priv *priv, u32 size)
> +{
> +	u32 data = 0;
> +	u32 fifocount = 0;
> +	unsigned len, offset;
> +	struct zynq_qspi_regs *regs = priv->regs;
> +	static const unsigned offsets[4] = {
> +		ZYNQ_QSPI_TXD_00_00_OFFSET, ZYNQ_QSPI_TXD_00_01_OFFSET,
> +		ZYNQ_QSPI_TXD_00_10_OFFSET, ZYNQ_QSPI_TXD_00_11_OFFSET };
> +
> +	while ((fifocount < size) &&
> +			(priv->bytes_to_transfer > 0)) {
> +		if (priv->bytes_to_transfer >= 4) {
> +			if (priv->tx_buf) {
> +				memcpy(&data, priv->tx_buf, 4);
> +				priv->tx_buf += 4;
> +			} else {
> +				data = 0;
> +			}
> +			writel(data, &regs->txd0r);
> +			priv->bytes_to_transfer -= 4;
> +			fifocount++;
> +		} else {
> +			/* Write TXD1, TXD2, TXD3 only if TxFIFO is empty. */
> +			if (!(readl(&regs->isr)
> +					& ZYNQ_QSPI_IXR_TXOW_MASK) &&
> +					!priv->rx_buf)
> +				return;
> +			len = priv->bytes_to_transfer;
> +			zynq_qspi_write_data(priv, &data, len);
> +			offset = (priv->rx_buf) ? offsets[0] : offsets[len];
> +			writel(data, &regs->cr + (offset / 4));
I do not understand "offset / 4", if priv->rx_buf == NULL we have an 
offset of 0x1C / 4 --> 7, this end in a write to an unaligned register 
address.
What is the purpose of this ?
> +		}
> +	}
> +}
> +
best regards,
Hannes

  parent reply	other threads:[~2015-10-13 12:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01  6:11 [U-Boot] [PATCH v4 00/16] spi: zynq qspi support Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 01/16] spi: Add zynq qspi controller driver Jagan Teki
2015-09-03  7:26   ` Siva Durga Prasad Paladugu
2015-09-03  8:07     ` Jagan Teki
2015-09-03  8:38       ` Siva Durga Prasad Paladugu
2015-09-03  9:47         ` Jagan Teki
2015-09-04 11:38       ` Siva Durga Prasad Paladugu
2015-10-13 12:22   ` Hannes Schmelzer [this message]
2015-10-15  8:39   ` Hannes Schmelzer
2015-11-05  7:33     ` Hannes Schmelzer
2015-11-05  7:56       ` Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 02/16] dts: zynq: Add zynq qspi controller nodes Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 03/16] doc: device-tree-bindings: spi: Add zynq qspi info Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 04/16] dts: microzed: Enable zynq qspi controller node Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 05/16] dts: zc702: " Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 06/16] dts: zc706: " Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 07/16] dts: zc770-xm010: " Jagan Teki
2015-09-01  8:22   ` Michal Simek
2015-09-01  8:43     ` Jagan Teki
2015-09-01  9:00       ` Michal Simek
2015-09-01  6:11 ` [U-Boot] [PATCH v4 08/16] dts: zed: " Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 09/16] configs: Enable legacy SPI flash interface support Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 10/16] zynq-common: Enable zynq qspi controller support Jagan Teki
2015-09-01  8:19   ` Michal Simek
2015-09-01  6:11 ` [U-Boot] [PATCH v4 11/16] zynq-common: Enable Bank/Extended address register support Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 12/16] configs: zynq: Enable zynq qspi controller Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 13/16] spi: Kconfig: Add Zynq QSPI controller entry Jagan Teki
2015-09-01  8:18   ` Michal Simek
2015-09-01  6:11 ` [U-Boot] [PATCH v4 14/16] spi: zynq_spi: Add config reg shift named macros Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 15/16] spi: zynq_spi: Rename baudrate divisor mask name Jagan Teki
2015-09-01  6:11 ` [U-Boot] [PATCH v4 16/16] spi: zynq_spi: Store cs value into private data Jagan Teki
2015-09-01  6:14 ` [U-Boot] [PATCH v4 00/16] spi: zynq qspi support Jagan Teki
2015-09-01  8:23   ` Michal Simek
2015-09-04 12:33     ` Jagan Teki

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=561CF78F.9080000@schmelzer.or.at \
    --to=hannes@schmelzer.or.at \
    --cc=u-boot@lists.denx.de \
    /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