From: Mark Brown <broonie@kernel.org>
To: Harini Katakam <harinik@xilinx.com>
Cc: grant.likely@linaro.org, robh+dt@kernel.org, pawel.moll@arm.com,
mark.rutland@arm.com, ijc+devicetree@hellion.org.uk,
galak@codeaurora.org, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org, dwmw2@infradead.org,
computersforpeace@gmail.com, marex@denx.de,
artem.bityutskiy@linux.intel.com, geert+renesas@linux-m68k.org,
s.hauer@pengutronix.de, jg1.han@samsung.com,
sourav.poddar@ti.com, michals@xilinx.com, punnaia@xilinx.com,
harinikatakamlinux@gmail.com
Subject: Re: [RFC PATCH 1/2] spi: Add support for Zynq QSPI controller
Date: Fri, 11 Jul 2014 14:38:41 +0100 [thread overview]
Message-ID: <20140711133841.GU30458@sirena.org.uk> (raw)
In-Reply-To: <1404982207-4707-2-git-send-email-harinik@xilinx.com>
[-- Attachment #1: Type: text/plain, Size: 2348 bytes --]
On Thu, Jul 10, 2014 at 02:20:06PM +0530, Harini Katakam wrote:
> This patch adds support for QSPI controller used by Zynq.
The driver looks pretty clean but there are a couple of issues below,
including a little bit more of the flash specifics.
> +static void zynq_qspi_chipselect(struct spi_device *qspi, bool is_high)
> +{
> + struct zynq_qspi *xqspi = spi_master_get_devdata(qspi->master);
> + u32 config_reg;
> +
> + config_reg = zynq_qspi_read(xqspi, ZYNQ_QSPI_CONFIG_OFFSET);
> +
> + /* Select upper/lower page before asserting CS */
> + if (xqspi->is_stacked) {
> + u32 lqspi_cfg_reg;
Like with the dual and quad mode stuff this looks very much like it's
specific to flash rather than something that applies to a generic SPI
driver. However it does look like it's a generic SPI device which could
be used in other applications which makes things a bit tricky. We don't
have a really good answer for this right now unfortunately, probably we
need some sort of special interface between the SPI and flash subsystems
to allow flash to use the flash specific stuff.
For use as a generic SPI device what I'd suggest is stripping out the
flash specifics, merging the rest of the support and then considering
the flash specifics separately.
> +/**
> + * zynq_prepare_transfer_hardware - Prepares hardware for transfer.
> + * @master: Pointer to the spi_master structure which provides
> + * information about the controller.
> + *
> + * This function enables SPI master controller.
> + *
> + * Return: Always 0
> + */
> +static int zynq_prepare_transfer_hardware(struct spi_master *master)
> +{
> + struct zynq_qspi *xqspi = spi_master_get_devdata(master);
> +
> + zynq_qspi_config_clock_mode(master->cur_msg->spi);
The clock mode needs to be (and is) configured per transfer so I'd
expect it's possible to remove this call.
> + ret = clk_prepare_enable(xqspi->refclk);
> + if (ret) {
> + dev_err(dev, "Cannot enable device clock.\n");
It's better to display the error code.
> + clk_disable(xqspi->pclk);
This needs to be disable_unprepare().
> +static SIMPLE_DEV_PM_OPS(zynq_qspi_dev_pm_ops, zynq_qspi_suspend,
> + zynq_qspi_resume);
It would be better to also implement runtime PM support to disable the
clocks while the device is idle as well, that will save a small amount
of power while the device isn't doing anything.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-07-11 13:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-10 8:50 [RFC PATCH 0/2] Zynq QSPI RFC Harini Katakam
2014-07-10 8:50 ` [RFC PATCH 1/2] spi: Add support for Zynq QSPI controller Harini Katakam
2014-07-10 9:18 ` Geert Uytterhoeven
2014-07-10 9:31 ` Harini Katakam
2014-07-10 9:42 ` Geert Uytterhoeven
2014-07-10 10:33 ` Harini Katakam
2014-07-10 11:25 ` Geert Uytterhoeven
2014-07-10 11:55 ` Harini Katakam
2014-07-10 12:01 ` Mark Brown
2014-07-10 12:39 ` Harini Katakam
[not found] ` <20140710150713.GJ30458@sirena.org.uk>
[not found] ` <03CA77BA8AF6F1469AEDFBDA1322A7B748213306@XAP-PVEXMBX01.xlnx.xilinx.com>
2014-07-14 7:22 ` Harini Katakam
2014-07-14 18:07 ` Mark Brown
2014-07-10 9:44 ` Punnaiah Choudary Kalluri
2014-07-11 13:38 ` Mark Brown [this message]
2014-07-14 7:27 ` Harini Katakam
2014-07-10 8:50 ` [RFC PATCH 2/2] devicetree: Add devicetree bindings documentation for Zynq QSPI Harini Katakam
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=20140711133841.GU30458@sirena.org.uk \
--to=broonie@kernel.org \
--cc=artem.bityutskiy@linux.intel.com \
--cc=computersforpeace@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=galak@codeaurora.org \
--cc=geert+renesas@linux-m68k.org \
--cc=grant.likely@linaro.org \
--cc=harinik@xilinx.com \
--cc=harinikatakamlinux@gmail.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jg1.han@samsung.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=marex@denx.de \
--cc=mark.rutland@arm.com \
--cc=michals@xilinx.com \
--cc=pawel.moll@arm.com \
--cc=punnaia@xilinx.com \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sourav.poddar@ti.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
all inboxes | Powered by JetHome®