-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow multiple chip selects in crossbar #56
base: master
Are you sure you want to change the base?
Conversation
self.user_cs = [] | ||
self.user_request = [] | ||
|
||
def get_port(self, cs, request = None): | ||
def add_output_cs(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, perhaps this should be get_output_cs
to match get_port
?
I think a little more work is needed to forward the chipselects thru to the hardware. This raises the question of how to do this ergonomically. The platform description could have multiple chipselect lines, such that This idea makes it difficult to name chipselects by Each additional chipselect could be presented in the platform as its own GPIO. However then it's unclear exactly why Additional ideas are welcome! |
Allow clients of the crossbar to provide multiple chip select lines. This array will be forwarded to the indicated output lines, and the default logic is modified so that a request is pending if any of the chip select lines are high.
6650c9c
to
8304428
Compare
This PR adds support for forwarding one or more chip selects from a client out to multiple output CS lines, while still arbitrating use of the shared MOSI/MISO/CLK lines and PHY.
Since each client may care about a different physical CS line or set of CS lines, these are passed in to
get_port()
:(The default is to continue to use
self.cs
to preserve existing behavior.)My use case is that I will have an autonomous (edge triggered) SPI master that reflects status signals from RTL onto GPIOs on a SPI expander, and a memory-mapped SPI flash. If this approach is good, I'm open to how you think this could be cleanly extended up into the chipselect register exposed by SPIMaster.
I also added unit tests for the existing behavior of the crossbar and master. Feedback is desired here because I don't feel like they're super idiomatic, but I wanted something in place before I really started making changes.