script: Add support for bios output format
authorNikhil Devshatwar <nikhil.nd@ti.com>
Thu, 13 Aug 2015 15:45:12 +0000 (21:15 +0530)
committerNikhil Devshatwar <nikhil.nd@ti.com>
Thu, 13 Aug 2015 15:45:18 +0000 (21:15 +0530)
Add support for pad/delay generation in bios output format.
Currently, the MMC check is not added, so all the pads/delays
are configured, irrespective.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
iodelay-autogen.py

index 304b9061026128b7031b375a1ef7a5e4864dd014..1adaeb5912988efeeb46ce2dd87ce4c095218736 100755 (executable)
@@ -38,7 +38,7 @@ parser.add_argument('-i', '--interactive', dest='interactive',
        help='run interactively with menus for resolving conflicts')
 
 parser.add_argument('-f', '--format', dest='format',
-       action='store', type=str, choices=["linux", "uboot"], default="uboot",
+       action='store', type=str, choices=["linux", "uboot", "bios"], default="uboot",
        help='select the output format to be used')
 
 parser.add_argument('-m', '--module', dest='module',
@@ -344,23 +344,27 @@ def pad_dump_gpio(padconf, per_padconf):
 # Generate the final pad and delay data in the required format
 def format_pad_regs(padconf, per_padconf):
        print "###########################################"
-       print "Pad data for u-boot (with the delay modes):"
+       print "Pad data output (with the delay modes)"
        print "###########################################"
        if (args.format == "uboot"):
                uboot_format_pad_regs(padconf, per_padconf)
        elif (args.format == "linux"):
                linux_format_pad_regs(padconf, per_padconf)
+       elif (args.format == "bios"):
+               bios_format_pad_regs(padconf, per_padconf)
        else:
                print "ERR: Format %s not suppported" % args.format
 
 def format_delay_regs(delayconf, per_delayconf):
        print "#########################################"
-       print "Delay data for u-boot (for manual modes):"
+       print "Delay data output (for manual modes)"
        print "#########################################"
        if (args.format == "uboot"):
                uboot_format_delay_regs(delayconf, per_delayconf)
        elif (args.format == "linux"):
                linux_format_delay_regs(delayconf, per_delayconf)
+       elif (args.format == "bios"):
+               bios_format_delay_regs(delayconf, per_delayconf)
        else:
                print "ERR: Format %s not suppported" % args.format
 
@@ -422,6 +426,7 @@ def uboot_format_delay_regs(delayconf, per_delayconf):
 
                print "\t{ 0x%04X, %5d, %5d },\t/* %s */" % (del_offset, adel, gdel, regname)
        print "};\n"
+
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
 # Generate output in linux format
@@ -487,6 +492,53 @@ def linux_format_delay_regs(delayconf, per_delayconf):
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
+# Generate output in bios format
+def bios_format_pad_regs(padconf, per_padconf):
+       for i in padconf:
+               (pad_name, pin_name, addr, val, delayinfo) = i
+
+               delaylist = []
+               (method, data) = delayinfo
+               if (method == "VIRTUAL"):
+                       virt_mode = data
+                       val = val | ( virt_mode<< 4)
+                       val = val | (1 << 8)
+               elif (method == "MANUAL"):
+                       delaylist = data
+                       val = val | (1 << 8)
+
+               offset = addr - 0x4a003400
+               out_delreg = out_adel = out_gdel = 0
+               in_delreg  = in_adel  = in_gdel  = 0
+               oen_delreg = oen_adel = oen_gdel = 0
+
+               for j in delaylist:
+                       (regname, adel, gdel) = j
+                       if (re.match(".*_IN", regname) != None):
+                               in_delreg = xml_iodelay_get_reg(regname)
+                               in_adel = adel
+                               in_gdel = gdel
+                       elif (re.match(".*_OEN", regname) != None):
+                               oen_delreg = xml_iodelay_get_reg(regname)
+                               oen_adel = adel
+                               oen_gdel = gdel
+                       elif (re.match(".*_OUT", regname) != None):
+                               out_delreg = xml_iodelay_get_reg(regname)
+                               out_adel = adel
+                               out_gdel = gdel
+               indel  = "{ 0x%04X, %4d, %4d }" % (in_delreg,  in_adel,  in_gdel)
+               oendel = "{ 0x%04X, %4d, %4d }" % (oen_delreg, oen_adel, oen_gdel)
+               outdel = "{ 0x%04X, %4d, %4d }" % (out_delreg, out_adel, out_gdel)
+               pin_info = get_pin_info(val)
+               print "\t/* %s -> %s (%s) %s delaymode */" % (pad_name, pin_name, pin_info, method)
+               print "\t{ 0x%03X, 0x%08X, %s, %s, %s }" % (offset, val, indel, oendel, outdel)
+
+def bios_format_delay_regs(delayconf, per_delayconf):
+       print "Manual delays are not configured separately"
+       print "Delays are configured as part of the padconf step only"
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
 # Main execution starts here
 # * Parse all the XML files - Get the pad data and IOdelay data
 # * Iterate over the pad register dumps