linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trevor Woerner <twoerner@gmail.com>
To: linux-spi@vger.kernel.org
Cc: linus.walleij@linaro.org, vz@mleia.com, alexandre.belloni@bootlin.com
Subject: spi-pl022 on lpc32xx
Date: Mon, 28 Mar 2022 15:01:04 -0400	[thread overview]
Message-ID: <20220328190104.GA11946@localhost> (raw)

Hi,

I have a spi-nor chip (m25p16) connected to the SPI1 bus of an LPC32xx-based
machine that I can't get working.

The LPC32xx has both an SPI controller and an SSP controller, but only one can
be active at a time. The SSP is an ARM primecell component which is a "SPI on
steroids" device. The SSP can be run in several modes, one of which is "SPI"
mode.

The LPC32xx machine does not have a SPI driver in the kernel, but it does have
a driver for the SSP controller. Since there is no SPI driver, I'm using the
SSP driver in "SPI" mode, but not having much luck.

I can see the SPI subsystem sending the 0x9f command (READ ID), the spi-pl022
driver writes the command to the SSP data register, but the flag in the SSP
status register to say data has been received never goes up.

I'm wondering if anyone is successfully using the current spi-pl022 driver to
interact with an SPI device (preferably on a lpc32xx-based machine)?

I've spent the better part of the last week poking at this. I've tried many
combinations of device tree, but what I think should work is:

	&ssp0 {
		status = "okay";
		num-cs = <1>;
		cs-gpios = <&gpio 3 4 1>;

		m25p16@0 {
			compatible = "jedec,spi-nor";
			reg = <0>;
			spi-max-frequency = <500000>;

			pl022,interface = <0>;
			pl022,com-mode = <1>;
		};
	};

I've tried a couple other compatible strings ("micron,m25p16", "st,m25p16"),
I've tried a range of frequencies (from 0.5MHz to 33MHz). The 3 options for
interface are 0 (SPI), 1 (TI), or 2 (Microwire) and I've tried all of them. I
don't believe the DMA system works generically on the lpc32xx but I've tried
both interrupt <0> and polling <1> for the com-mode. I believe SPI1 and SSP0
are the same and SPI2 and SSP1 are the same (which is why I'm using SSP0
here).

The pl-022 driver is quite aggressive about shutting off the SSP and raising
the chip select after a message is sent, so I modified my driver to leave the
SSP enabled and keeping the (active-low) chip select low (in case those were
affecting the reply) but there's no change.

One thing that's curious is that the platform_info->bus_id is -1. This bus
number comes from the parent device (spi core). I wonder if this driver is not
registering itself correctly with the spi core?

Best regards,
 	Trevor

             reply	other threads:[~2022-03-28 19:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 19:01 Trevor Woerner [this message]
2022-03-28 20:09 ` spi-pl022 on lpc32xx 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
     [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=20220328190104.GA11946@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 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).