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