linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: "Ivan T. Ivanov" <iivanov@mm-sol.com>
Cc: Grant Likely <grant.likely@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	linux-spi@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Alok Chauhan <alokc@codeaurora.org>,
	Gilad Avidov <gavidov@codeaurora.org>,
	Kiran Gunda <kgunda@codeaurora.org>,
	Sagar Dharia <sdharia@codeaurora.org>,
	dsneddon@codeaurora.org
Subject: Re: [PATH v2 2/2] spi: Add Qualcomm QUP SPI controller support
Date: Thu, 20 Feb 2014 00:28:49 +0900	[thread overview]
Message-ID: <20140219152849.GI2669@sirena.org.uk> (raw)
In-Reply-To: <1392308498-30209-1-git-send-email-iivanov@mm-sol.com>

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

On Thu, Feb 13, 2014 at 06:21:38PM +0200, Ivan T. Ivanov wrote:

> Qualcomm Universal Peripheral (QUP) core is an AHB slave that
> provides a common data path (an output FIFO and an input FIFO)
> for serial peripheral interface (SPI) mini-core. SPI in master
> mode supports up to 50MHz, up to four chip selects, programmable
> data path from 4 bits to 32 bits and numerous protocol variants.

I've applied this since it mostly looks good but there's a few small
outstanding issues, please submit incremental patches fixing them.

> +#define SPI_CONFIG			0x0300
> +#define SPI_IO_CONTROL			0x0304
> +#define SPI_ERROR_FLAGS			0x0308
> +#define SPI_ERROR_FLAGS_EN		0x030c

You've got lots of defines that are just plain SPI_ which is looking for
namespace collisions - please prefix them.

> +	if (spi->chip_select >= spi->master->num_chipselect) {
> +		dev_err(controller->dev, "invalid chip_select %d\n",
> +			spi->chip_select);
> +		return -EINVAL;
> +	}

The core does this prior to allowing the slave to be registered at all.

> +
> +	if (spi->max_speed_hz > controller->max_speed_hz) {
> +		dev_err(controller->dev, "invalid max_speed_hz %d\n",
> +			spi->max_speed_hz);
> +		return -EINVAL;
> +	}

The core will check this for you if you set master->max_speed_hz.

> +#ifdef CONFIG_PM_RUNTIME
> +static int spi_qup_pm_suspend_runtime(struct device *device)
> +{
> +	struct spi_master *master = dev_get_drvdata(device);
> +	struct spi_qup *controller = spi_master_get_devdata(master);
> +	u32 config;
> +
> +	/* Enable clocks auto gaiting */
> +	config = readl(controller->base + QUP_CONFIG);
> +	config |= QUP_CLOCK_AUTO_GATE;
> +	writel_relaxed(config, controller->base + QUP_CONFIG);
> +	return 0;
> +}

Why not just enable this all the time?  I'd have expected some clock API
calls here similar to those in the main suspend and resume paths.

> +MODULE_VERSION("0.4");

Don't bother doing this, nobody will ever keep updating the version
number - the kernel version should be enough.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2014-02-19 15:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13 16:21 [PATH v2 2/2] spi: Add Qualcomm QUP SPI controller support Ivan T. Ivanov
2014-02-19 15:28 ` Mark Brown [this message]

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=20140219152849.GI2669@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alokc@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dsneddon@codeaurora.org \
    --cc=gavidov@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=iivanov@mm-sol.com \
    --cc=kgunda@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sdharia@codeaurora.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;
as well as URLs for NNTP newsgroup(s).