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
Add optional support for fixed CSR mapping. #1467
Conversation
By default, location is still automatically determined but it's now possible to specific locations: The following module: class MyModule(Module, AutoCSR): def __init__(self): self.csr0 = CSRStorage() self.csr1 = CSRStorage(n=0) self.csr2 = CSRStorage(n=2) built on a SoC with 32-bit CSR data-width will have the following CSR mapping: - 0x00 : csr1 - 0x04 : csr0 - 0x08 : reserved - 0x0c : csr2
After this PR was applied I'm getting an error building litex-rocket with the following command line:
The error is:
|
@enjoy-digital -- while the individual base addresses are the same as before, this change shuffled the registers within the
This breaks the LiteETH linux driver authored by @shenki . Most linux drivers for LiteX peripherals can tolerate the base address changing (via dts/dtb), but a shuffle of the registers within a set like the above breaks the driver, which until now has relied on hard-coding the register offsets and sizes, see https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/litex/litex_liteeth.c#L16-L32 Unless we can try to keep the registers within a given peripheral in a constant and predictable order, we should brainstorm ways to pass individual offsets into Linux somehow (not sure DTS/DTB is designed for such levels of granularity, though). Interestingly enough, it's only LiteETH that's affected at this time, all other devices' registers remain unshuffled for now... |
Hi @gsomlo, sorry for this, ironically the aim of these changes is to do the opposite and allow fixed CSR mapping :) That's just that LiteETH CSR collection is done differently (through a custom I'll fix this. |
With 88d8977 I now get the same mapping with your command. |
By default, location is still automatically determined but it's now possible to
specific locations:
The following module:
built on a SoC with 32-bit CSR data-width will have the following CSR mapping: