summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 361e9c8)
raw | patch | inline | side by side (parent: 361e9c8)
author | Nikhil Devshatwar <nikhil.nd@ti.com> | |
Wed, 12 Aug 2015 16:28:48 +0000 (21:58 +0530) | ||
committer | Nikhil Devshatwar <nikhil.nd@ti.com> | |
Wed, 12 Aug 2015 17:17:30 +0000 (22:47 +0530) |
Add another --module / -m option to generate values only
While iterating over all the pads, skip all the pads which
are not configured for the module specified.
Also, add the checks to avoid MMC configuration in uboot and
restrict the non MMC configuration in kernel.
For debugging purposes, some of the pads (input pads) can be
sampled using the GPIO DATA-IN registers even if the pad is
configured in non GPIO mux mode.
Add a command line option --gpio / -g to dump the script
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
While iterating over all the pads, skip all the pads which
are not configured for the module specified.
Also, add the checks to avoid MMC configuration in uboot and
restrict the non MMC configuration in kernel.
For debugging purposes, some of the pads (input pads) can be
sampled using the GPIO DATA-IN registers even if the pad is
configured in non GPIO mux mode.
Add a command line option --gpio / -g to dump the script
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
iodelay-autogen.py | patch | blob | history |
diff --git a/iodelay-autogen.py b/iodelay-autogen.py
index 24f2330691d2a0a0128cfecac344672542ee4724..51c19acb41da0bd6458c62b3234fe23991d140ac 100755 (executable)
--- a/iodelay-autogen.py
+++ b/iodelay-autogen.py
action='store', type=str, choices=["linux", "uboot"], default="uboot",
help='select the output format to be used')
+parser.add_argument('-m', '--module', dest='module',
+ action='store', type=str, default="",
+ help='generate only for this module')
+
+parser.add_argument('-g', '--gpio', dest='gpio',
+ action='store_true',
+ help='generate script to read pad data from GPIO')
+
args = parser.parse_args()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# As each pad is muxed with a SoC gpio (for most of the pads)
# It's possible to read the pad data using gpio datain registers
# Dump the linux commands to read the gpio registers and read the pad data
-def pad_dump_gpio(addr, offset, pin_name):
- # Dump the script to read this pad using the gpio data register
- gpio_data_addrs = (0, 0x4ae10138, 0x48055138, 0x48057138, 0x48059138, 0x4805b138, 0x4805d138, 0x48051138, 0x48053138)
- gpio_name = xml_pad_get_pin(offset, 14)
- matchlist = re.match("GPIO(.)_(.)", gpio_name)
- if (matchlist == None):
+def pad_dump_gpio(padconf, per_padconf):
+ if(args.gpio == False):
return
- inst = int(matchlist.groups(0)[0])
- bit = int(matchlist.groups(0)[1])
- gpio_addr = gpio_data_addrs[inst]
- print "echo %d > /sys/class/gpio/export 2>/dev/null;" % (inst - 1) * 32
- print "val=`omapconf read 0x%x 2>&1 | grep -v \"support\"`;" % gpio_addr
- print "status=$((0x$val >> %d & 0x1));" % bit
- print "echo -e \"%s (%s)\t = $status\";" % (pin_name, gpio_name)
+
+ print "# Read pad signals using GPIO DATA-IN registers"
+ print "# Works only for the input signals"
+ gpio_data_addrs = (0, 0x4ae10138, 0x48055138, 0x48057138, 0x48059138, 0x4805b138, 0x4805d138, 0x48051138, 0x48053138)
+ for i in padconf:
+ (pad_name, pin_name, addr, val, delayinfo) = i
+
+ offset = addr - 0x4a002000
+ gpio_name = xml_pad_get_pin(offset, 14)
+ matchlist = re.match("GPIO(.)_(.)", gpio_name)
+ if (matchlist == None):
+ print "ERR: No GPIO for pad %s" % pad_name
+ continue
+
+ inst = int(matchlist.groups(0)[0])
+ bit = int(matchlist.groups(0)[1])
+ gpio_addr = gpio_data_addrs[inst]
+
+ print "#Read GPIO%d_%d to sample %s" % (inst, bit, pin_name)
+ print " echo %d > /sys/class/gpio/export 2>/dev/null;" % ((inst - 1) * 32)
+ print " val=`omapconf read 0x%x 2>&1 | grep -v \"support\"`;" % gpio_addr
+ print " status=$((0x$val >> %d & 0x1));" % bit
+ print " echo -e \"%s (%s)\t = $status\";" % (pin_name, gpio_name)
+ print ""
+ print ""
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Generate the final pad and delay data in the required format
linux_format_pad_regs(padconf, per_padconf)
else:
print "ERR: Format %s not suppported" % args.format
- print "###########################################"
def format_delay_regs(delayconf, per_delayconf):
print "#########################################"
linux_format_delay_regs(delayconf, per_delayconf)
else:
print "ERR: Format %s not suppported" % args.format
- print "###########################################"
def get_pin_info(val):
inp_en = (val >> 18) & 0x1
print "\nconst struct pad_conf_entry dra74x_core_padconf_array[] = {"
for i in padconf:
(pad_name, pin_name, addr, val, delayinfo) = i
+
+ if (re.match("MMC.*", pin_name) != None):
+ print "WARN: Skipping MMC padconf in uboot"
+ continue
+
muxmode = val & 0xf
(method, data) = delayinfo
if (method == "LEGACY"):
pin_info = get_pin_info(val) + extramode
pad_short = re.sub("CTRL_CORE_PAD_", "", pad_name)
comment = (pad_short + "." + pin_name).lower()
+
print "\t{ %s, (M%d | %s) },\t/* %s */" % (pad_short, muxmode, pin_info, comment)
print "};\n"
print "\nconst struct iodelay_cfg_entry dra742_iodelay_cfg_array[] = {"
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"
+ continue
+
print "\t{ 0x%04X, %5d, %5d },\t/* %s */" % (del_offset, adel, gdel, regname)
print "};\n"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
print "\t\tpinctrl-single,pins = <"
for i in per_padconf[per]:
(pad_name, pin_name, addr, val, delayinfo) = i
+
muxmode = val & 0xf
(method, data) = delayinfo
if (method == "LEGACY"):
pad_short = re.sub("CTRL_CORE_PAD_", "", pad_name)
offset = addr - 0x4a003400
comment = (pad_short + "." + pin_name).lower()
+
print "\t\t\t0x%03X\t(%s | MUM_MODE%d)\t/* %s */" % (offset, pin_info, muxmode, comment)
print "\t\t>;"
print "\t};"
# Get the mode from the first entry
(pad_name, pin_name, regname, del_offset, mode, adel, gdel) = per_delayconf[per][0]
+
dtsnode = ("%s_iodelay_%s_conf" % (per, mode)).lower()
print "\t%s: %s {" % (dtsnode, dtsnode)
print "\t\tpinctrl-single,pins = <"
for i in per_delayconf[per]:
(pad_name, pin_name, regname, del_offset, mode, adel, gdel) = i
+
print "\t\t\t0x%03X A_DELAY(%d) | G_DELAY(%d)\t/* %s */" % (del_offset, adel, gdel, regname)
print "\t\t>;"
print "\t};"
# Find out if the delaymode for this module is already selected
module = re.match("([^_]+)_.*", pin_name).groups(0)[0]
+ if (args.module != "" and args.module != module):
+ continue
+
if (args.debug >= 1):
print "\nPAD: %s: Addr= 0x%08X Value = 0x%08X \"%s\"" \
% (pad_name, addr, val, pin_name)
format_pad_regs(padconf, per_padconf)
format_delay_regs(delayconf, per_delayconf)
+pad_dump_gpio(padconf, per_padconf)
# Dump the final selection for reuse
print "Selected modes for each peripheral module\n"