]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/iodelay-config.git/blobdiff - iodelay-autogen.py
script: Fix the gpio script for bit > 9
[glsdk/iodelay-config.git] / iodelay-autogen.py
index 1adaeb5912988efeeb46ce2dd87ce4c095218736..d6a8701f91a3a63ae3dd1b2be4c767ed6be36aba 100755 (executable)
@@ -16,18 +16,14 @@ import xml.etree.ElementTree as ET
 import re
 import argparse
 
-pad_data_xml = "XMLFiles/CTRL_MODULE_CORE.xml"
-iod_data_xml = "XMLFiles/IODELAYCONFIG.xml"
-model_data_xml = "XMLFiles/model_DRA75x_DRA74x_SR1.1_v1.0.7.xml"
-modehelp_file = "guidelines.txt"
-
-pad_file = "ctrl-core.dump"
-sel_file = "selected-modes.txt"
-
 # Handle the command line arguments
 parser = argparse.ArgumentParser(prog='iodelay-autogen.py',
-       description='Python script to generate the IOdelay data',
-       epilog='Generate the pad and delay data using pad regdump')
+       description='Python script to generate the IOdelay data.\n' \
+               'This script refers to the XML data and automatically generates\n' \
+               'PAD and DELAY data for the same use case.\n' \
+               'Note that only the PADs which are used in the dump are configured.',
+       epilog='Generate the pad and delay data using pad register dumps. For this,\n' \
+               'Run omapconf dump 0x4a003400 0x4a00380c and save the output')
 
 parser.add_argument('-d', '--debug', dest='debug',
        action='store', type=int, choices=[0, 1, 2], default=0,
@@ -41,10 +37,20 @@ parser.add_argument('-f', '--format', dest='format',
        action='store', type=str, choices=["linux", "uboot", "bios"], default="uboot",
        help='select the output format to be used')
 
+parser.add_argument('-r', '--revision', dest='revision',
+       action='store', type=str, choices=["1.1", "2.0"], default="1.1",
+       help='select the silicon revision')
+
 parser.add_argument('-m', '--module', dest='module',
        action='store', type=str, default="",
        help='generate only for this module')
 
+parser.add_argument('-s', '--strict', dest='strict',
+       action='store_true',
+       help='strict mode - ask for each pad of the group, do not save selection.\n' \
+               'For some peripherals, same delaymode cannot be used for all the pads.\n' \
+               'Use this mode to select different modes for each pad')
+
 parser.add_argument('-g', '--gpio', dest='gpio',
        action='store_true',
        help='generate script to read pad data from GPIO')
@@ -56,6 +62,15 @@ parser.add_argument('-c', '--check', dest='check_xml',
 args = parser.parse_args()
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
+PCT_VERSION = "v1.0.7"
+pad_data_xml = "XMLFiles/CTRL_MODULE_CORE.xml"
+iod_data_xml = "XMLFiles/IODELAYCONFIG.xml"
+model_data_xml = "XMLFiles/model_DRA75x_DRA74x_SR" + args.revision + "_" + PCT_VERSION + ".xml"
+
+modehelp_file = "guidelines.txt"
+pad_file = "ctrl-core.dump"
+sel_file = "selected-modes.txt"
+
 # Read the XML file database for pad and delay registers
 pad_xml = ET.parse(pad_data_xml).getroot()
 iod_xml = ET.parse(iod_data_xml).getroot()
@@ -302,8 +317,6 @@ def select_mode(pad, pin, module, virt, man, modehelp, sel):
        print "MENU: Selected mode is %s" % mode
        print ""
 
-       # Remember the selection for that module, for later reuse
-       sel[module] = mode
        return mode
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
@@ -323,7 +336,7 @@ def pad_dump_gpio(padconf, per_padconf):
 
                offset = addr - 0x4a002000
                gpio_name = xml_pad_get_pin(offset, 14)
-               matchlist = re.match("GPIO(.)_(.)", gpio_name)
+               matchlist = re.match("GPIO(.)_(.*)", gpio_name)
                if (matchlist == None):
                        print "ERR: No GPIO for pad %s" % pad_name
                        continue
@@ -416,15 +429,21 @@ def uboot_format_pad_regs(padconf, per_padconf):
        print "};\n"
 
 def uboot_format_delay_regs(delayconf, per_delayconf):
-       print "\nconst struct iodelay_cfg_entry dra742_iodelay_cfg_array[] = {"
+       manual_del = []
        for i in delayconf:
                (pad_name, pin_name, regname, del_offset, man_name, adel, gdel) = i
 
                if (re.match("MMC.*", pin_name) != None):
-                       print "WARN: Skipping MMC padconf in uboot"
+                       print "WARN: Skipping MMC delayconf in uboot"
                        continue
 
-               print "\t{ 0x%04X, %5d, %5d },\t/* %s */" % (del_offset, adel, gdel, regname)
+               entry = (del_offset, adel, gdel, regname, pin_name, man_name)
+               manual_del.append(entry)
+
+       es_rev = args.revision.replace('.', '_')
+       print "\nconst struct iodelay_cfg_entry dra742_es" + es_rev + "_iodelay_cfg_array[] = {"
+       for entry in sorted(manual_del):
+               print "\t{ 0x%04X, %5d, %5d },\t/* %s : %s - %s */" % entry
        print "};\n"
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -611,10 +630,14 @@ for i in range(0, 260):
 
        # Need to select one out of allowed modes
        mode = select_mode(pad_name, pin_name, module, virt, man, modehelp, sel)
+
+       # Remember the selection for that module, for later reuse
+       if (args.strict == False):
+               sel[module] = mode
+
        if (mode == "SKIP"):
                continue
-
-       if (mode == "LEGACY"):
+       elif (mode == "LEGACY"):
                delayinfo = ("LEGACY", "")
        elif (mode in virt):
                delayinfo = ("VIRTUAL", virt[mode])