litex_json2dts_zephyr.py: add custon handler for spiflash
add custon handler for spiflash. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit is contained in:
parent
44b6fb5a28
commit
bb155b5a90
|
@ -201,6 +201,31 @@ def spimaster_handler(name, parm, csr):
|
|||
return dtsi
|
||||
|
||||
|
||||
def spiflash_handler(name, parm, csr):
|
||||
registers = get_registers_of(name, csr)
|
||||
if len(registers) == 0:
|
||||
raise KeyError
|
||||
|
||||
# Add memory mapped region for spiflash, the linker script in zephyr expects this region to be
|
||||
# the entry with the name flash_mmap in the reg property of the spi controller.
|
||||
try:
|
||||
registers.append({
|
||||
'addr': csr['memories'][name]['base'],
|
||||
'size': csr['memories'][name]['size'],
|
||||
'name': 'flash_mmap',
|
||||
})
|
||||
except KeyError as e:
|
||||
print('memory mapped', e, 'not found')
|
||||
|
||||
dtsi = dts_reg(registers)
|
||||
dtsi += dts_reg_names(registers)
|
||||
|
||||
dtsi += indent("clock-frequency = <{}>;\n".format(
|
||||
csr['constants'][name + '_phy_frequency']))
|
||||
|
||||
return dtsi
|
||||
|
||||
|
||||
def peripheral_handler(name, parm, csr):
|
||||
registers = get_registers_of(name, csr)
|
||||
if len(registers) == 0:
|
||||
|
@ -244,7 +269,7 @@ overlay_handlers = {
|
|||
'alias': 'spi0',
|
||||
},
|
||||
'spiflash': {
|
||||
'handler': peripheral_handler,
|
||||
'handler': spiflash_handler,
|
||||
'alias': 'spi1',
|
||||
},
|
||||
'sdcard_block2mem': {
|
||||
|
|
Loading…
Reference in New Issue