Page MenuHomeFreeBSD

Add support for spi flash on SiFive Unmatched.
ClosedPublic

Authored by skibo on Aug 16 2021, 4:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 26, 3:04 PM
Unknown Object (File)
Tue, Nov 26, 3:04 PM
Unknown Object (File)
Tue, Nov 26, 3:03 PM
Unknown Object (File)
Tue, Nov 26, 3:03 PM
Unknown Object (File)
Tue, Nov 26, 3:02 PM
Unknown Object (File)
Tue, Nov 26, 2:37 PM
Unknown Object (File)
Nov 20 2024, 6:43 AM
Unknown Object (File)
Nov 20 2024, 6:31 AM

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

skibo requested review of this revision.Aug 16 2021, 4:25 PM
  • Enable 4-byte addressing for is25wp256 flash.
sys/riscv/conf/GENERIC
156 ↗(On Diff #93762)

I'm thinking maybe this should not be in GENERIC and we can use a module.

sys/dev/flash/mx25l.c
157 ↗(On Diff #93762)

Maybe belongs in a separate commit? Not overly fussed though.

sys/riscv/conf/GENERIC
156 ↗(On Diff #93762)

Yeah, and with proper PNP info for mx25l you could even autoload it, though it might be better to *not* do that and force people to load it when they want to use it, safer against people accidentally trashing their flash... definitely doesn't need to be in GENERIC though.

sys/riscv/sifive/sifive_spi.c
234

Ah is this missing case why kldload mx25l was giving 0xff for everything? I tried it and put it on the backburner behind getting the existing patches upstreamed when I saw that, didn't dig any further.

235

Return EINVAL?

sys/riscv/conf/GENERIC
156 ↗(On Diff #93762)

I'm not sure why it doesn't autoload but I'm happy to just manually load it or put a line loader.conf when I need it.

sys/riscv/sifive/sifive_spi.c
234

Yes. I was getting ff ffff for the device ID. It's dumb luck that I figured it out. I printf'ed everything and the uninitialized value of sckmode happened to be 2 which is a valid value for the mode register. Only later did I notice that mode was 0.

  • Address revision feedback.

EDIT: Backed out mx25l from GENERIC kernel. Return EINVAL for invalid values of mode.

This revision is now accepted and ready to land.Aug 24 2021, 2:07 PM

Please elaborate on "Fix a bug in sifive_spi.c." when committing, and please mark for MFC (I have yet to do the big batch of MFCs for the other commits to stable/13 but will get round to it soon).

Please elaborate on "Fix a bug in sifive_spi.c." when committing, and please mark for MFC (I have yet to do the big batch of MFCs for the other commits to stable/13 but will get round to it soon).

How about "Add missing case for SPIBUS_MODE_NONE to sifive_spi.c" and "Add support for IS25WP256D flash memory to mx25l.c" in separate commits if you wish? I am not a committer so I can't do it. Thanks.