devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomasz Figa <tomasz.figa@gmail.com>
To: Naveen Krishna Chatradhi <ch.naveen@samsung.com>,
	linux-arm-kernel@lists.infradead.org,
	spi-devel-general@lists.sourceforge.net,
	linux-samsung-soc@vger.kernel.org
Cc: naveenkrishna.ch@gmail.com, broonie@kernel.org,
	grant.likely@secretlab.ca, jaswinder.singh@linaro.org,
	kgene.kim@samsung.com, cpgs@samsung.com,
	devicetree@vger.kernel.org,
	Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
	Doug Anderson <dianders@chromium.org>
Subject: Re: [PATCH 1/2 v2] spi: s3c64xx: use "cs-gpios" from spi node instead of "cs-gpio"
Date: Tue, 10 Jun 2014 21:49:40 +0200	[thread overview]
Message-ID: <53976154.60308@gmail.com> (raw)
In-Reply-To: <1402394881-31564-2-git-send-email-ch.naveen@samsung.com>

Hi Naveen,

On 10.06.2014 12:08, Naveen Krishna Chatradhi wrote:
> Currently, spi-s3c64xx.c needs "cs-gpio" chip select GPIO to be
> defined under "controller-data" node under each slave node.

[snip]

> @@ -85,6 +83,7 @@ Example:
>  		#size-cells = <0>;
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&spi0_bus>;
> +		cs-gpios = <&gpa2 5 1 0 3>;

While at it, you might also update the example to something more
appropriate on Samsung platforms, e.g. <&gpa2 5 0>;

>  
>  		w25q80bw@0 {
>  			#address-cells = <1>;

[snip]

> +static struct s3c64xx_spi_csinfo *s3c64xx_get_cs_gpios(struct spi_device *spi)
> +{
> +	struct device_node *parent_np = NULL;
> +	struct s3c64xx_spi_driver_data *sdd;
> +	struct s3c64xx_spi_csinfo *cs;
> +
> +	parent_np = of_get_parent(spi->dev.of_node);
> +	if (!parent_np) {
> +		dev_err(&spi->dev, "Parent node not found\n");
>  		return ERR_PTR(-EINVAL);
>  	}
>  
> +	sdd = spi_master_get_devdata(spi->master);
> +
>  	cs = kzalloc(sizeof(*cs), GFP_KERNEL);
>  	if (!cs) {
> -		of_node_put(data_np);
> +		of_node_put(parent_np);
>  		return ERR_PTR(-ENOMEM);
>  	}
>  
>  	/* The CS line is asserted/deasserted by the gpio pin */
>  	if (sdd->cs_gpio)
> -		cs->line = of_get_named_gpio(data_np, "cs-gpio", 0);
> +		cs->line = of_get_named_gpio(parent_np, "cs-gpios", 0);

This is wrong. The "cs-gpios" property is supposed to be an array,
indexed by chip select number of SPI devices (indicated by their "reg"
properties).

Moreover, is there a need to parse this manually in this driver? I can
see respective parsing code in of_spi_register_master().

Best regards,
Tomasz

  parent reply	other threads:[~2014-06-10 19:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 10:07 [PATCH 0/2 v2] spi: s3c64xx: use "cs-gpios" in spi node instead of "cs-gpio" Naveen Krishna Chatradhi
2014-06-10 10:08 ` [PATCH 1/2 v2] spi: s3c64xx: use "cs-gpios" from " Naveen Krishna Chatradhi
2014-06-10 10:39   ` Sylwester Nawrocki
2014-06-10 11:00     ` Naveen Krishna Ch
2014-06-10 18:09       ` Doug Anderson
2014-06-10 19:43         ` Tomasz Figa
2014-06-10 20:32         ` Rob Herring
2014-06-11 12:22           ` Sylwester Nawrocki
2014-06-10 18:26   ` Doug Anderson
2014-06-10 19:25     ` Tomasz Figa
     [not found]     ` <CAD=FV=WgvyF-P+69SdmCGX0jxJ3FVxpa+AcgQKg-Emya_W-w3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-11  6:10       ` Naveen Krishna Ch
2014-06-10 19:49   ` Tomasz Figa [this message]
2014-06-10 19:58     ` Doug Anderson
2014-06-10 19:59       ` Tomasz Figa
2014-06-10 20:21         ` Doug Anderson
2014-06-11  6:16     ` Naveen Krishna Ch
2014-06-10 10:08 ` [PATCH 2/2 v2] ARM: DTS: move "cs-gpio" from "controller-data" to under spi node Naveen Krishna Chatradhi

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=53976154.60308@gmail.com \
    --to=tomasz.figa@gmail.com \
    --cc=broonie@kernel.org \
    --cc=ch.naveen@samsung.com \
    --cc=cpgs@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jaswinder.singh@linaro.org \
    --cc=javier.martinez@collabora.co.uk \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=naveenkrishna.ch@gmail.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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).