2020-10-13 22:45:52 +08:00
|
|
|
# SPDX-License_Identifier: GPL-2.0
|
|
|
|
|
|
|
|
menu "Enable LiteX SoC Builder specific drivers"
|
|
|
|
|
|
|
|
config LITEX
|
|
|
|
bool
|
|
|
|
|
|
|
|
config LITEX_SOC_CONTROLLER
|
|
|
|
tristate "Enable LiteX SoC Controller driver"
|
|
|
|
depends on OF || COMPILE_TEST
|
2021-01-27 11:36:04 +08:00
|
|
|
depends on HAS_IOMEM
|
2020-10-13 22:45:52 +08:00
|
|
|
select LITEX
|
|
|
|
help
|
|
|
|
This option enables the SoC Controller Driver which verifies
|
2021-01-13 01:31:44 +08:00
|
|
|
LiteX CSR access and provides common litex_[read|write]*
|
2020-10-13 22:45:52 +08:00
|
|
|
accessors.
|
|
|
|
All drivers that use functions from litex.h must depend on
|
|
|
|
LITEX.
|
|
|
|
|
drivers/soc/litex: support 32-bit subregisters, 64-bit CPUs
Upstream LiteX now defaults to using 32-bit CSR subregisters
(see https://github.com/enjoy-digital/litex/commit/a2b71fde).
This patch expands on commit 22447a99c97e ("drivers/soc/litex: add
LiteX SoC Controller driver"), adding support for handling both 8-
and 32-bit LiteX CSR (MMIO) subregisters, as determined by the
LITEX_SUBREG_SIZE Kconfig option.
NOTE that while LITEX_SUBREG_SIZE could theoretically be a device
tree property, defining it as a compile-time constant allows for
much better optimization of the resulting code. This is further
supported by the low expected usefulness of deploying the same
kernel across LiteX SoCs built with different CSR-Bus data widths.
Finally, the litex_[read|write][8|16|32|64]() accessors are
redefined in terms of litex_[get|set]_reg(), which, after compiler
optimization, will result in code as efficient as hardcoded shifts,
but with the added benefit of automatically matching the appropriate
LITEX_SUBREG_SIZE.
NOTE that litex_[get|set]_reg() nominally operate on 64-bit data,
but that will also be optimized by the compiler in situations where
narrower data is used from a call site.
Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
Signed-off-by: Stafford Horne <shorne@gmail.com>
2021-01-13 01:31:43 +08:00
|
|
|
config LITEX_SUBREG_SIZE
|
|
|
|
int "Size of a LiteX CSR subregister, in bytes"
|
|
|
|
depends on LITEX
|
|
|
|
range 1 4
|
|
|
|
default 4
|
|
|
|
help
|
|
|
|
LiteX MMIO registers (referred to as Configuration and Status
|
|
|
|
registers, or CSRs) are spread across adjacent 8- or 32-bit
|
|
|
|
subregisters, located at 32-bit aligned MMIO addresses. Use
|
|
|
|
this to select the appropriate size (1 or 4 bytes) matching
|
|
|
|
your particular LiteX build.
|
|
|
|
|
2020-10-13 22:45:52 +08:00
|
|
|
endmenu
|