scripts/dts/extract: Add support for generating SPI GPIO CS defines
Add support to generation script to generate defines for GPIO CS [WIP], need to clarify some issues on how CS's look when we mix GPIO-CS and HW CS. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
4bd4185a2c
commit
f592c528f4
1 changed files with 21 additions and 0 deletions
|
@ -28,12 +28,33 @@ class DTReg(DTDirective):
|
|||
|
||||
node = reduced[node_address]
|
||||
node_compat = get_compat(node_address)
|
||||
binding = get_binding(node_address)
|
||||
|
||||
reg = reduced[node_address]['props']['reg']
|
||||
if type(reg) is not list: reg = [ reg, ]
|
||||
|
||||
(nr_address_cells, nr_size_cells) = get_addr_size_cells(node_address)
|
||||
|
||||
if 'parent' in binding:
|
||||
bus = binding['parent']['bus']
|
||||
if bus == 'spi':
|
||||
cs_gpios = None
|
||||
|
||||
try:
|
||||
cs_gpios = deepcopy(find_parent_prop(node_address, 'cs-gpios'))
|
||||
except:
|
||||
pass
|
||||
|
||||
if cs_gpios:
|
||||
# Newer versions of dtc might have the property look like
|
||||
# cs-gpios = <0x05 0x0d 0x00>, < 0x06 0x00 0x00>;
|
||||
# So we need to flatten the list in that case
|
||||
if isinstance(cs_gpios[0], list):
|
||||
cs_gpios = [item for sublist in cs_gpios for item in sublist]
|
||||
|
||||
extract_controller(node_address, "cs-gpios", cs_gpios, reg[0], def_label, "cs-gpio", True)
|
||||
extract_cells(node_address, "cs-gpios", cs_gpios, None, reg[0], def_label, "cs-gpio", True)
|
||||
|
||||
# generate defines
|
||||
l_base = def_label.split('/')
|
||||
l_addr = [convert_string_to_label("BASE_ADDRESS")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue