From: Luke Kenneth Casson Leighton Date: Wed, 28 Mar 2018 15:12:35 +0000 (+0100) Subject: fix pinmerge issue, merge pingroup X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f27ac8fbf373b1dc818f3eda9898d01512798df5;p=pinmux.git fix pinmerge issue, merge pingroup --- diff --git a/src/spec/gen.py b/src/spec/gen.py index d398384..eff692e 100644 --- a/src/spec/gen.py +++ b/src/spec/gen.py @@ -21,7 +21,7 @@ def specgen(pth, pinouts, bankspec, fixedpins): if len(s0.pingroup) == 1: # only one function, grouped higher for ks in s.keys(): # grouped by interface fntype = 'inout' # XXX TODO - k = "%s_%s" % (s[ks].fname, s[ks].suffix) + k = s[ks].suffix k_ = k.lower() g.write("%s\t%s\n" % (k_, fntype)) else: @@ -48,6 +48,5 @@ def specgen(pth, pinouts, bankspec, fixedpins): fname = pinouts[k][midx][0] else: fname = '' - print k, midx, fname res.append(fname.lower()) g.write('\t'.join(res) + '\n') diff --git a/src/spec/interfaces.py b/src/spec/interfaces.py index 891a123..64cd229 100644 --- a/src/spec/interfaces.py +++ b/src/spec/interfaces.py @@ -1,5 +1,8 @@ #!/usr/bin/env python +from copy import deepcopy + + class Pinouts(object): def __init__(self): self.pins = {} @@ -301,8 +304,19 @@ def pinmerge(pins, fn): specname = fname + suffix else: specname = fname + bank - pins.fnspec[fname][specname] = fn - + if pins.fnspec[fname].has_key(specname): + # ok so some declarations may bring in different + # names at different stages (EINT, PWM, flexbus1/2) + # so we have to merge the names in. main thing is + # the pingroup + tomerge = pins.fnspec[fname][specname] + for p in fn.pingroup: + if p not in tomerge.pingroup: + tomerge.pingroup.append(p) + tomerge.pins.update(fn.pins) + tomerge.fntype.update(fn.fntype) + else: + pins.fnspec[fname][specname] = deepcopy(fn) # merge actual pins for (pinidx, v) in fn.pins.items():