adjust minitest layout
[pinmux.git] / src / spec / minitest.py
1 #!/usr/bin/env python
2
3 from spec.interfaces import Pinouts
4
5 from spec.ifaceprint import display, display_fns, check_functions
6 from spec.ifaceprint import display_fixed
7
8
9 def pinspec():
10 pinbanks = {
11 'B': 28,
12 }
13 bankspec = {}
14 pkeys = sorted(pinbanks.keys())
15 offs = 0
16 for kn in pkeys:
17 bankspec[kn] = offs
18 offs += pinbanks[kn]
19
20 pinouts = Pinouts(bankspec)
21
22 # Bank B, 16-47
23 pinouts.gpio("", ('B', 0), "B", 0, 28, 0)
24 pinouts.rgbttl("", ('B', 0), "B", 1, limit=23)
25 pinouts.spi("1", ('B', 10), "B", 2)
26 pinouts.quadspi("", ('B', 4), "B", 2)
27 pinouts.uart("3", ('B', 16), "B", 2)
28 pinouts.i2c("3", ('B', 18), "B", 2)
29 pinouts.pwm("", ('B', 21), "B", 0, 3, mux=2)
30 pinouts.sdmmc("1", ('B', 22), "B", 3)
31 pinouts.eint("", ('B', 0), "B", 0, 4, mux=3)
32 pinouts.eint("", ('B', 20), "B", 4, 1, mux=2)
33 pinouts.eint("", ('B', 23), "B", 5, 1, mux=1)
34 pinouts.sdmmc("2", ('B', 4), "B", 3)
35 pinouts.jtag("2", ('B', 10), "B", 3)
36 pinouts.uartfull("0", ('B', 14), "B", 3)
37 pinouts.uartfull("1", ('B', 18), "B", 3)
38 pinouts.jtag("1", ('B', 24), "B", 2)
39 pinouts.spi("2", ('B', 24), "B", 1)
40 pinouts.i2c("1", ('B', 0), "B", 2)
41 pinouts.uart("2", ('B', 2), "B", 2)
42 pinouts.uart("4", ('B', 14), "B", 2)
43
44
45 print ("""# Pinouts (PinMux)
46 auto-generated by [[pinouts.py]]
47
48 [[!toc ]]
49 """)
50 display(pinouts)
51
52 print ("\n# Pinouts (Fixed function)\n")
53
54 fixedpins = {
55 'CTRL_SYS': [
56 'TEST',
57 'JTAG_SEL',
58 'UBOOT_SEL',
59 'NMI#',
60 'RESET#',
61 'CLK24M_IN',
62 'CLK24M_OUT',
63 'PLLTEST',
64 'PLLREGIO',
65 'PLLVP25',
66 'PLLDV',
67 'PLLVREG',
68 'PLLGND',
69 ],
70 'POWER_GPIO': [
71 'VDD_GPIOB',
72 'GND_GPIOB',
73 ]}
74
75 fixedpins = display_fixed(fixedpins, len(pinouts))
76
77 print ("""# Functions (PinMux)
78
79 auto-generated by [[pinouts.py]]
80 """)
81
82 function_names = {'EINT': 'External Interrupt',
83 'FB': 'MC68k FlexBus',
84 'IIS': 'I2S Audio',
85 'JTAG1': 'JTAG (same as JTAG2, JTAG_SEL=LOW)',
86 'JTAG2': 'JTAG (same as JTAG1, JTAG_SEL=HIGH)',
87 'LCD': '24-pin RGB/TTL LCD',
88 'RG': 'RGMII Ethernet',
89 'MMC': 'eMMC 1/2/4/8 pin',
90 'PWM': 'PWM (pulse-width modulation)',
91 'SD1': 'SD/MMC 1',
92 'SD2': 'SD/MMC 2',
93 'SD3': 'SD/MMC 3',
94 'SPI1': 'SPI (Serial Peripheral Interface) 1',
95 'SPI2': 'SPI (Serial Peripheral Interface) 2',
96 'QSPI': 'Quad SPI (Serial Peripheral Interface) 1',
97 'TWI1': 'I2C 1',
98 'TWI2': 'I2C 2',
99 'TWI3': 'I2C 3',
100 'UARTQ0': 'UART (TX/RX/CTS/RTS) 0',
101 'UARTQ1': 'UART (TX/RX/CTS/RTS) 1',
102 'UART2': 'UART (TX/RX) 2',
103 'UART3': 'UART (TX/RX) 3',
104 'UART4': 'UART (TX/RX) 4',
105 'ULPI1': 'ULPI (USB Low Pin-count) 1',
106 'ULPI2': 'ULPI (USB Low Pin-count) 2',
107 'ULPI3': 'ULPI (USB Low Pin-count) 3',
108 }
109
110 fns = display_fns(bankspec, pinouts, function_names)
111 print
112
113 # Scenarios below can be spec'd out as either "find first interface"
114 # by name/number e.g. SPI1, or as "find in bank/mux" which must be
115 # spec'd as "BM:Name" where B is bank (A-F), M is Mux (0-3)
116 # EINT and PWM are grouped together, specially, but may still be spec'd
117 # using "BM:Name". Pins are removed in-order as listed from
118 # lists (interfaces, EINTs, PWMs) from available pins.
119
120 minitest = ['B1:LCD/22', 'ULPI1/8', 'ULPI2', 'MMC', 'SD1', 'UART3',
121 'TWI3', 'SPI2', 'E2:SD2', ]
122 minitest_eint = ['EINT_0', 'EINT_1', 'EINT_2', 'EINT_3']
123 minitest_pwm = ['D1:PWM_2']
124 descriptions = {
125 'MMC': 'internal (on Card)',
126 'SD1': 'user-facing: internal (on Card), multiplexed with JTAG1\n'
127 'and UART2, for debug purposes',
128 'TWI3': 'EOMA68-compliance: must be entirely free of devices.\n'
129 'Address 0x51 used (externally) for EOMA68 EEPROM Id',
130 'E2:SD2': 'EOMA68-compliance',
131 'SPI2': 'EOMA68-compliance',
132 'UART3': 'EOMA68-compliance',
133 'B1:LCD/22': 'EOMA68-compliance, 18-bit RGB/TTL LCD',
134 'ULPI1/8': 'user-facing: internal (on Card), USB-OTG ULPI PHY',
135 'ULPI2': 'EOMA68-compliance: dual USB2 Host ULPI PHY'
136 }
137
138 unused_pins = check_functions("MiniTest", bankspec, fns, pinouts,
139 minitest, minitest_eint, minitest_pwm,
140 descriptions)
141
142
143 print ("""# Reference Datasheets
144
145 datasheets and pinout links
146 * <http://datasheets.chipdb.org/AMD/8018x/80186/amd-80186.pdf>
147 * <http://hands.com/~lkcl/eoma/shenzen/frida/FRD144A2701.pdf>
148 * <http://pinouts.ru/Memory/sdcard_pinout.shtml>
149 * p8 <http://www.onfi.org/~/media/onfi/specs/onfi_2_0_gold.pdf?la=en>
150 * <https://www.heyrick.co.uk/blog/files/datasheets/dm9000aep.pdf>
151 * <http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4393.pdf>
152 * <https://www.nxp.com/docs/en/data-sheet/MCF54418.pdf>
153 * ULPI OTG PHY, ST <http://www.st.com/en/interfaces-and-transceivers/stulpi01a.html>
154 * ULPI OTG PHY, TI TUSB1210 <http://ti.com/product/TUSB1210/>
155 """)
156
157 return pinouts, bankspec, pinbanks, fixedpins