linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-spi <linux-spi@vger.kernel.org>,
	Mark Brown <broonie@kernel.org>,
	Fabio Estevam <festevam@gmail.com>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: Boot failure with 5.4-rc5, bisected to 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors")
Date: Wed, 27 Nov 2019 09:57:44 +0100	[thread overview]
Message-ID: <2a65f209-0e69-aaf5-d664-97d7c0c2678e@c-s.fr> (raw)
In-Reply-To: <CACRpkdbOzM3X2_BMnf5eSqCt_UsnXo4eXD2fUbTLk6=Uo3gB2g@mail.gmail.com>



Le 27/11/2019 à 09:26, Linus Walleij a écrit :
> On Tue, Nov 26, 2019 at 8:14 PM Christophe Leroy
> <christophe.leroy@c-s.fr> wrote:
> 
>>> Digging a bit further, I see that devm_spi_register_master() fails in
>>> spi_register_controler() because ctlr->num_chipselect is 0
> 
> Aha, I see what the problem is I think. The old code for mpc8xxx had this:
> 
>         ngpios = of_gpio_count(np);
>         ngpios = max(ngpios, 0);
>         if (ngpios == 0 && !spisel_boot) {
>                 /*
>                  * SPI w/o chip-select line. One SPI device is still permitted
>                  * though.
>                  */
>                 pdata->max_chipselect = 1;
>                 return 0;
>         }
> (...)
>        master->num_chipselect = pdata->max_chipselect;
> 
> But the new code in the core has this:
> 
>      nb = gpiod_count(dev, "cs");
>      ctlr->num_chipselect = max_t(int, nb, ctlr->num_chipselect);
> 
> So it relied on inspecting the device tree and set  this to 1
> if it didn't find anything.
> 
> I will send a patch to test!
> 

I don't think that's the problem. In my device tree I have several gpios 
defined for the node:

spi: spi@a80 {
	#address-cells = <1>;
	#size-cells = <0>;
	cell-index = <0>;
	compatible = "fsl,spi", "fsl,cpm1-spi";
	reg = <0xa80 0x30 0x3d80 0x30>;
	interrupts = <5>;
	interrupt-parent = <&CPM_PIC>;
	mode = "cpu";
	gpios = <&CPM1_PIO_C 4 1	/* SICOFI 1 */
		 &CPM1_PIO_B 23 1	/* TEMP MCR */
		 &CPM1_PIO_C 8 1	/* SICOFI 2 */
		 &CPM1_PIO_C 12 1	/* EEPROM MIAE */
		 &CPM1_PIO_D 6 1	/* SICOFI 3 */
		 &CPM1_PIO_B 14 1	/* TEMP MPC885 */
		 &CPM1_PIO_B 21 1	/* EEPROM CMPC885 */
		 &FAV_CS_SPI 0 1	/* FAV SPI */
		 &FAV_CS_SPI 2 1>;	/* FAV POSTE FPGA */

	};

	sicofi@0 {
		compatible = "infineon,sicofi";
		spi-max-frequency = <1000000>;
		reg = <0>;
		spi-cs-high;
		spi-cpha;
	};

	lm74@1 {
		compatible = "ns,lm74";
		spi-max-frequency = <1000000>;
		reg = <1>;
		spi-cs-high;
	};

	sicofi@2 {
		compatible = "infineon,sicofi";
		spi-max-frequency = <1000000>;
		reg = <2>;
		spi-cs-high;
		spi-cpha;
	};

	eeprom@3 {
		compatible = "atmel,at25";
		spi-max-frequency = <1000000>;
		reg = <3>;
		spi-cs-high;
		at25,byte-len = <1024>;
		at25,addr-mode = <2>;
		at25,page-size = <32>;
	};

	sicofi@4 {
		compatible = "infineon,sicofi";
		spi-max-frequency = <1000000>;
		reg = <4>;
		spi-cs-high;
		spi-cpha;
	};

	lm74@5 {
		compatible = "ns,lm74";
		spi-max-frequency = <1000000>;
		reg = <5>;
		spi-cs-high;
	};

	eeprom@6 {
		compatible = "atmel,at25";
		spi-max-frequency = <1000000>;
		reg = <6>;
		spi-cs-high;
		at25,byte-len = <1024>;
		at25,addr-mode = <2>;
		at25,page-size = <32>;
	};

	iio: csfav@7 {
		compatible = "iio,ad7923";
		spi-max-frequency = <1000000>;
		reg = <7>;
		spi-cs-high;
		spi-cpol;
		#io-channel-cells = <1>;
	};

	csfavfpga@8 {
		compatible = "cs,fpga-poste";
		spi-max-frequency = <1000000>;
		reg = <8>;
		spi-cs-high;
	};
};

Christophe

  reply	other threads:[~2019-11-27  8:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08 12:33 Boot failure with 5.4-rc5, bisected to 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors") Christophe Leroy
2019-11-08 13:09 ` Linus Walleij
2019-11-08 13:34   ` Christophe Leroy
2019-11-26 15:01     ` Christophe Leroy
2019-11-26 15:35       ` Fabio Estevam
2019-11-26 16:16         ` Christophe Leroy
2019-11-26 16:23         ` Mark Brown
2019-11-26 15:48     ` Linus Walleij
2019-11-26 19:08       ` Christophe Leroy
2019-11-26 19:14         ` Christophe Leroy
2019-11-27  8:26           ` Linus Walleij
2019-11-27  8:57             ` Christophe Leroy [this message]
2019-11-27  9:07             ` Christophe Leroy
2019-11-27  9:11               ` Linus Walleij
2019-11-27  9:34                 ` Christophe Leroy
2019-11-27 10:02                   ` Linus Walleij
2019-11-27 10:39                     ` Christophe Leroy
2019-11-27 10:55                       ` Linus Walleij
2019-11-27 12:04                         ` Christophe Leroy
2019-11-27 13:00                           ` Linus Walleij
2019-11-27 13:44                             ` Christophe Leroy
2019-11-27 13:52                               ` Linus Walleij
2019-11-27 13:54                                 ` Christophe Leroy
2019-11-27 13:56                                   ` Linus Walleij
2019-11-27 14:29                                     ` Christophe Leroy
2019-11-28  8:42                                       ` Linus Walleij

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=2a65f209-0e69-aaf5-d664-97d7c0c2678e@c-s.fr \
    --to=christophe.leroy@c-s.fr \
    --cc=broonie@kernel.org \
    --cc=festevam@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-spi@vger.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;
as well as URLs for NNTP newsgroup(s).