All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luke Morrison <lmorrison@nautel.com>
To: Luke Morrison <lmorrison@nautel.com>,
	"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	"vz@mleia.com" <vz@mleia.com>
Subject: RE: spi-pl022 on lpc32xx
Date: Fri, 3 Nov 2023 19:28:22 +0000	[thread overview]
Message-ID: <YT3PR01MB6339DFC8B6304D22DFD276F1C7A5A@YT3PR01MB6339.CANPRD01.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <YT3PR01MB6339A54903A0DFDD3D1C1598C7A7A@YT3PR01MB6339.CANPRD01.PROD.OUTLOOK.COM>

On 11/1/23, Luke Morrison wrote:
> Hello,
> 
> I'm with a team that's working on picking up this work where Trevor had to
> leave it behind. We've worked around the issue up until now with a hack
> using a userspace program that talks to the SPI peripheral registers through
> /dev/mem. This won't be viable over the longer term, and we're revisiting the
> task of getting the pl022 driver up and running.
> 
> On 3/30/22 10:56, Vladimir Zapolskiy wrote:
> > years ago you've asked the same question, and the answer is that there
> > is no pinctrl IP or controls on the SoC. This sounds weird, but that's how it
> goes.
> >
> > There are just a few multiplexed pins, and a pin function selection is
> > done on basis of powering up a corresponding particular IP while
> > keeping conflicting ones disabled. Such implicit pin multiplexing is
> > inconvenient, but working, fortunately the SoC is simple to have such a
> model supported.
> >
> > The newer LPC18xx/LPC43xx has a pin control IP, and it makes
> > everything much more transparent and comprehensible, but it's not
> > transferable to LPC32xx.
> >
> I am really curious about that statement. The LPC32xx reference manual does
> document a number of registers related to selecting which peripheral gets to
> control which shared pins. It's described in chapter 33. Specifically, the
> P_MUX_*, P0_MUX_*, P1_MUX_*, P2_MUX_*, and P3_MUX_* registers.
> 
> I note that these registers are defined in the kernel, but it doesn't appear
> that any drivers are written to actually make use of them. I think this might
> be part of the problem that Trevor was hitting when he was working on this.
> Since neither the kernel nor U-Boot ever attempt to set the bits that would
> need to be set in order to give the SCU control of these pins, and we know
> that our stage1 bootloader was previously also leaving these bits cleared, it's
> reasonable to conclude that the SCU wouldn't be able to access them.
> 
> We are working on a change that directly set the P*_MUX_* registers to
> appropriate values for use by the SCU, but I think the more appropriate
> approach would be to figure out a way to map these registers into a proper
> pinmux driver.
> 
> > Best wishes,
> > Vladimir
> 
> Regards,
> Luke

I have a follow-up. We have experimentally confirmed that it is not
enough to shut off the SPI1 peripheral and power on the SSC0
peripheral; you also need to reconfigure the P*_MUX_* registers to
take away control of the clock and data pins from the SPI and give it
to the SSC. Trevor was on the verge of discovering that last year when
he reached out here, but other obligations stopped him from being
able to finish that work.

In general, it appears that some LPC32xx peripherals will unconditionally
take over control of pins simply by turning them on. Examples include
the LCD controller, motor controller, and SD card controller. But equally,
other peripherals which share pins will defer to pinmux registers instead.
I can see how that could add complication to a properly implemented
pinctrl driver.

Maybe that is a good enough reason to stick with configuring the pins
statically the way we need within the stage1 bootloader and let both
U-Boot and Linux pretend that none of these complexities exist?

Regards,
Luke

  reply	other threads:[~2023-11-03 19:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e060912b-0a7d-9fd5-edde-c27a8da55569 () mleia ! com>
2023-11-01 16:20 ` spi-pl022 on lpc32xx Luke Morrison
2023-11-03 19:28   ` Luke Morrison [this message]
2022-03-28 19:01 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

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=YT3PR01MB6339DFC8B6304D22DFD276F1C7A5A@YT3PR01MB6339.CANPRD01.PROD.OUTLOOK.COM \
    --to=lmorrison@nautel.com \
    --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.