[genpinmap] Fix PinMap_USB_OTG_HS

If USE_USB_HS_IN_FS is defined only those pins have
to be defined

Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
This commit is contained in:
Frederic.Pillon 2019-01-25 09:05:32 +01:00
parent a7ee669994
commit 2453a90ac1

View file

@ -79,10 +79,15 @@ def get_gpio_af_num(pintofind, iptofind):
if myc.nodeType == Node.ELEMENT_NODE: if myc.nodeType == Node.ELEMENT_NODE:
# myc = node of ALTERNATE # myc = node of ALTERNATE
for mygpioaflist in myc.childNodes: for mygpioaflist in myc.childNodes:
if mygpioaflist.data not in mygpioaf: if (
mygpioaflist.data
not in mygpioaf
):
if mygpioaf != "": if mygpioaf != "":
mygpioaf += " " mygpioaf += " "
mygpioaf += mygpioaflist.data mygpioaf += (
mygpioaflist.data
)
# print (mygpioaf) # print (mygpioaf)
if mygpioaf == "": if mygpioaf == "":
mygpioaf = "GPIO_AF_NONE" mygpioaf = "GPIO_AF_NONE"
@ -650,21 +655,30 @@ def print_syswkup_h():
def print_usb(lst): def print_usb(lst):
use_hs_in_fs = False use_hs_in_fs = False
nb_loop = 1
inst = "USB" inst = "USB"
if lst == usb_otgfs_list: if lst == usb_otgfs_list:
inst = "USB_OTG_FS" inst = "USB_OTG_FS"
elif lst == usb_otghs_list: elif lst == usb_otghs_list:
inst = "USB_OTG_HS" inst = "USB_OTG_HS"
nb_loop = 2
for nb in range(nb_loop):
for p in lst: for p in lst:
result = get_gpio_af_num(p[1], p[2]) result = get_gpio_af_num(p[1], p[2])
s1 = "%-10s" % (" {" + p[0] + ",") s1 = "%-10s" % (" {" + p[0] + ",")
if lst == usb_otghs_list: if lst == usb_otghs_list:
if "ULPI" not in p[2] and not use_hs_in_fs: if nb == 0:
if "ULPI" in p[2]:
continue
elif not use_hs_in_fs:
out_c_file.write("#ifdef USE_USB_HS_IN_FS\n") out_c_file.write("#ifdef USE_USB_HS_IN_FS\n")
use_hs_in_fs = True use_hs_in_fs = True
if "ULPI" in p[2] and use_hs_in_fs: else:
out_c_file.write("#endif /* USE_USB_HS_IN_FS */\n") if "ULPI" not in p[2]:
continue
elif use_hs_in_fs:
out_c_file.write("#else\n")
use_hs_in_fs = False use_hs_in_fs = False
# 2nd element is the USB_XXXX signal # 2nd element is the USB_XXXX signal
@ -685,8 +699,9 @@ def print_usb(lst):
s1 += af + ")}," s1 += af + ")},"
s1 += " // " + p[2] + "\n" s1 += " // " + p[2] + "\n"
out_c_file.write(s1) out_c_file.write(s1)
if lst: if lst:
if use_hs_in_fs: if lst == usb_otghs_list:
out_c_file.write("#endif /* USE_USB_HS_IN_FS */\n") out_c_file.write("#endif /* USE_USB_HS_IN_FS */\n")
out_c_file.write( out_c_file.write(
""" {NC, NP, 0} """ {NC, NP, 0}