summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-09-12 09:24:39 +0200
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-09-12 09:24:39 +0200
commit1f6b753e0681a634ce3e9395141af27bd8917fb8 (patch)
treed734e4bfd01fddfedf850d4b48c9fadb995dd091
downloadimx-iop2v-master.tar.gz
imx-iop2v-master.tar.xz
import iop2v scriptHEADmaster
This scripts checks that the function used for io mapping for the i.MX family of SoCs as used by Linux doesn't yield any conflicts and dumps out a list for use in arch/arm/plat-mxc/include/mach/hardware.h Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rwxr-xr-xiop2v90
1 files changed, 90 insertions, 0 deletions
diff --git a/iop2v b/iop2v
new file mode 100755
index 0000000..ad5bb50
--- /dev/null
+++ b/iop2v
@@ -0,0 +1,90 @@
+#! /usr/bin/env python
+# vim: set fileencoding=utf-8
+# Copyright (C) 2010-2011 Uwe Kleine-König for Pengutronix
+# GPLv2
+
+def iop2v(x):
+ return 0xf4000000 + (((x) & 0x50000000) >> 6) + (((x) & 0x0b000000) >> 4) + (((x) & 0x000fffff))
+
+if __name__ == '__main__':
+ import sys
+
+ if sys.argv[1:]:
+ for a in sys.argv[1:]:
+ a = int(a, 0)
+ print '%08x -> %08x' % (a, iop2v(a))
+ else:
+ socmappings = [
+ ('mx1', [
+ ('IO', 0x00200000, 0x100000)]),
+ ('mx21', [
+ ('AIPI', 0x10000000, 0x100000),
+ ('SAHB1', 0x80000000, 0x100000),
+ ('X_MEMC', 0xdf000000, 0x04000)]),
+ ('mx25', [
+ ('AIPS1', 0x43f00000, 0x100000),
+ ('AIPS2', 0x53f00000, 0x100000),
+ ('AVIC', 0x68000000, 0x100000)]),
+ ('mx27', [
+ ('AIPI', 0x10000000, 0x100000),
+ ('SAHB1', 0x80000000, 0x100000),
+ ('X_MEMC', 0xd8000000, 0x100000)]),
+ ('mx31', [
+ ('AIPS1', 0x43f00000, 0x100000),
+ ('AIPS2', 0x53f00000, 0x100000),
+ ('AVIC', 0x68000000, 0x100000),
+ ('X_MEMC', 0xb8000000, 0x010000),
+ ('SPBA0', 0x50000000, 0x100000)]),
+ ('mx35', [
+ ('AIPS1', 0x43f00000, 0x100000),
+ ('AIPS2', 0x53f00000, 0x100000),
+ ('AVIC', 0x68000000, 0x100000),
+ ('X_MEMC', 0xb8000000, 0x010000),
+ ('SPBA0', 0x50000000, 0x100000)]),
+ ('mx50', [
+ ('TZIC', 0x0fffc000, 0x4000),
+ ('AIPS1', 0x53f00000, 0x100000),
+ ('SPBA0', 0x50000000, 0x100000),
+ ('AIPS2', 0x63f00000, 0x100000)]),
+ ('mx51', [
+ ('IRAM', 0x1ffe0000, 0x020000),
+ ('DEBUG', 0x60000000, 0x100000),
+ ('SPBA0', 0x70000000, 0x100000),
+ ('AIPS1', 0x73f00000, 0x100000),
+ ('AIPS2', 0x83f00000, 0x100000)]),
+ ('mx53', [
+ ('TZIC', 0x0fffc000, 0x4000),
+ ('DEBUG', 0x40000000, 0x100000),
+ ('SPBA0', 0x50000000, 0x100000),
+ ('AIPS1', 0x53f00000, 0x100000),
+ ('AIPS2', 0x63f00000, 0x100000)]),
+ ('mx6q', [
+ ('SCU', 0x00a00000, 0x4000),
+ ('CCM', 0x020c4000, 0x4000),
+ ('ANATOP', 0x020c8000, 0x4000),
+ ('UART4', 0x021f0000, 0x4000)]),
+ ('mxc91231', [
+ ('L2CC', 0x30000000, 0x010000),
+ ('X_MEMC', 0xB8000000, 0x010000),
+ ('ROMP', 0x60000000, 0x010000),
+ ('AVIC', 0x68000000, 0x010000),
+ ('AIPS1', 0x43F00000, 0x100000),
+ ('SPBA0', 0x50000000, 0x100000),
+ ('SPBA1', 0x52000000, 0x100000),
+ ('AIPS2', 0x53F00000, 0x100000)])]
+ for soc, maplist in socmappings:
+ print ' * %s:' % soc
+ socvbases = set()
+ for name, base, size in maplist:
+ end = base + size - 1
+ vbase = iop2v(base)
+ vend = iop2v(end)
+ socvbases.add(vbase)
+ if vend - vbase != size - 1:
+ print 'broken mapping (%s)' % name
+ sys.exit(1)
+ print ' *\t%s\t0x%08x+0x%06x\t->\t0x%08x+0x%06x' % (name, base, size, vbase, size)
+
+ if len(socvbases) != len(maplist):
+ print 'conflict'
+ sys.exit(1)