All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trevor Woerner <twoerner@gmail.com>
To: Vladimir Zapolskiy <vz@mleia.com>
Cc: linux-spi@vger.kernel.org, linus.walleij@linaro.org,
	alexandre.belloni@bootlin.com
Subject: Re: spi-pl022 on lpc32xx
Date: Tue, 29 Mar 2022 18:34:06 -0400	[thread overview]
Message-ID: <20220329223406.GB22159@localhost> (raw)
In-Reply-To: <c796837e-7cd8-517f-dbd0-85ec3dbc4b86@mleia.com>

Hi Vladimir,

This is great: I've now heard from the driver's maintainer, and the 2 other
people (other than me) still using this SoC ;-)

On Tue 2022-03-29 @ 09:59:07 PM, Vladimir Zapolskiy wrote:
> FWIW on my board I do use both SSP0 and SSP1 at once, but I didn't rebase
> the dts/kernel for a long time, so the examples might be outdated:
> 
> &ssp0 {
> 	num-cs = <1>;
> 	cs-gpios = <&gpio 3 5 GPIO_ACTIVE_HIGH>; /* SSEL0 */
> 
> 	sc16is752@0 {
> 		compatible = "nxp,sc16is752";
> 		reg = <0>;
> 		spi-max-frequency = <4000000>;
> 
> 		/* 18.432 MHz external oscillator */
> 		clocks = <&xtal_18432k>;
> 
> 		/* Interrupt to GPI_07 */
> 		interrupt-parent = <&sic2>;
> 		interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
> 	};
> };
> 
> &ssp1 {
> 	num-cs = <1>;
> 	cs-gpios = <&gpio 3 4 GPIO_ACTIVE_HIGH>;

The chip selects of most SPI devices are active low (and the s25fl216k is
no exception), so *technically* this should probably be GPIO_ACTIVE_LOW.
Regardless, the spi-pl022 driver ignores this parameter anyway:
	https://elixir.bootlin.com/linux/v5.17.1/source/drivers/spi/spi-pl022.c#L458

> 	s25fl216k@0 {
> 		compatible = "s25fl216k", "jedec,spi-nor";
> 		reg = <0>;
> 		spi-max-frequency = <150000>;
> 		spi-cpol;
> 		spi-cpha;
> 	};
> };
> 
> Also SSP0 is enabled on PhyTec phy3250 board, there is an at25 eeprom on it,
> I've just briefly checked the device tree node, and apparently it contains
> some references/properties specific to the PL022 SPI driver.

Thanks for the report. Both you and Alexander are using SSP on this SoC
successfully, and it looks like your configurations are pretty much what I'm
using.

That means it's not the driver, and it's probably not my dts. I'm getting the
feeling that I'm being messed up by my 1st stage bootloader which is
configuring SPI and then leaving it running. I noticed that my SPI_CTRL
register is still setup with the SPI clocks running. Simply disabling the SPI
clocks on startup, however, doesn't seem to fix things. So then I started
looking at the various pinmuxing registers and noticed that nothing is setup
for SSP. The pins that are muxed for SSP are all left in their default
configurations on my device (which means they're all setup for SPI since SPI
is the default and SSP is the alternate).

Any chance either your or Alexander know what register 0x4002_8108 contains?
Maybe you have devmem2 available? Maybe you have bootloaders that are setting
up the pinmuxing for SSP mode for you?

The docs talk about how to configure SPI, and how to configure SSP. But they
don't talk about how to turn one off and enable the other (or if that's even
possible). If it's not possible for this SoC to switch between the two, then
my only option would be to write an SPI driver.

Best regards,
	Trevor

  reply	other threads:[~2022-03-29 22:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 19:01 spi-pl022 on lpc32xx Trevor Woerner
2022-03-28 20:09 ` Alexandre Belloni
2022-03-29 13:15   ` Trevor Woerner
2022-03-29 16:06 ` Linus Walleij
2022-03-29 18:31   ` Trevor Woerner
2022-03-29 21:33     ` Linus Walleij
2022-03-29 22:03       ` Trevor Woerner
2022-03-30 10:56       ` Vladimir Zapolskiy
2022-03-29 18:59 ` Vladimir Zapolskiy
2022-03-29 22:34   ` Trevor Woerner [this message]
     [not found] <e060912b-0a7d-9fd5-edde-c27a8da55569 () mleia ! com>
2023-11-01 16:20 ` Luke Morrison
2023-11-03 19:28   ` Luke Morrison

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=20220329223406.GB22159@localhost \
    --to=twoerner@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=vz@mleia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.