From: Luke Kenneth Casson Leighton Date: Fri, 30 Mar 2018 09:10:15 +0000 (+0100) Subject: add mini spec for test purposes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=53366f9608dd4e993037e9d5694b4fab6aa9543c;p=pinmux.git add mini spec for test purposes --- diff --git a/src/spec/__init__.py b/src/spec/__init__.py index 4f2db3d..34f390c 100644 --- a/src/spec/__init__.py +++ b/src/spec/__init__.py @@ -1,7 +1,9 @@ from spec import m_class from spec import c_class +from spec import minitest from gen import specgen modules = {'m_class': m_class, - 'c_class': c_class + 'c_class': c_class, + 'minitest': minitest } diff --git a/src/spec/minitest.py b/src/spec/minitest.py new file mode 100644 index 0000000..6f569e0 --- /dev/null +++ b/src/spec/minitest.py @@ -0,0 +1,156 @@ +#!/usr/bin/env python + +from spec.interfaces import Pinouts + +from spec.ifaceprint import display, display_fns, check_functions +from spec.ifaceprint import display_fixed + + +def pinspec(): + pinbanks = { + 'B': 28, + } + bankspec = {} + pkeys = sorted(pinbanks.keys()) + offs = 0 + for kn in pkeys: + bankspec[kn] = offs + offs += pinbanks[kn] + + pinouts = Pinouts(bankspec) + + # Bank B, 16-47 + pinouts.gpio("", ('B', 0), "B", 0, 28, 0) + pinouts.rgbttl("0", ('B', 0), "B", 1) + pinouts.spi("1", ('B', 12), "B", 2) + pinouts.quadspi("", ('B', 4), "B", 2) + pinouts.uart("3", ('B', 16), "B", 2) + pinouts.i2c("3", ('B', 18), "B", 2) + #pinouts.pwm("", ('B', 9), "B", 0, 1, mux=2) + pinouts.pwm("", ('B', 20), "B", 1, 2, mux=2) + pinouts.sdmmc("1", ('B', 22), "B", 2) + pinouts.eint("", ('B', 0), "B", 0, 4, mux=3) + pinouts.flexbus2("", ('B', 4), "B", 3) + pinouts.i2c("1", ('B', 0), "B", 2) + pinouts.uart("2", ('B', 2), "B", 2) + pinouts.uart("4", ('B', 10), "B", 2) + + + print ("""# Pinouts (PinMux) +auto-generated by [[pinouts.py]] + +[[!toc ]] +""") + display(pinouts) + + print ("\n# Pinouts (Fixed function)\n") + + fixedpins = { + 'CTRL_SYS': [ + 'TEST', + 'JTAG_SEL', + 'UBOOT_SEL', + 'NMI#', + 'RESET#', + 'CLK24M_IN', + 'CLK24M_OUT', + 'PLLTEST', + 'PLLREGIO', + 'PLLVP25', + 'PLLDV', + 'PLLVREG', + 'PLLGND', + ], + 'POWER_GPIO': [ + 'VDD_GPIOB', + 'GND_GPIOB', + ]} + + fixedpins = display_fixed(fixedpins, len(pinouts)) + + print ("""# Functions (PinMux) + +auto-generated by [[pinouts.py]] +""") + + function_names = {'EINT': 'External Interrupt', + 'FB': 'MC68k FlexBus', + 'IIS': 'I2S Audio', + 'JTAG1': 'JTAG (same as JTAG2, JTAG_SEL=LOW)', + 'JTAG2': 'JTAG (same as JTAG1, JTAG_SEL=HIGH)', + 'LCD': '24-pin RGB/TTL LCD', + 'RG': 'RGMII Ethernet', + 'MMC': 'eMMC 1/2/4/8 pin', + 'PWM': 'PWM (pulse-width modulation)', + 'SD1': 'SD/MMC 1', + 'SD2': 'SD/MMC 2', + 'SD3': 'SD/MMC 3', + 'SPI1': 'SPI (Serial Peripheral Interface) 1', + 'SPI2': 'SPI (Serial Peripheral Interface) 2', + 'QSPI': 'Quad SPI (Serial Peripheral Interface) 1', + 'TWI1': 'I2C 1', + 'TWI2': 'I2C 2', + 'TWI3': 'I2C 3', + 'UARTQ0': 'UART (TX/RX/CTS/RTS) 0', + 'UARTQ1': 'UART (TX/RX/CTS/RTS) 1', + 'UART2': 'UART (TX/RX) 2', + 'UART3': 'UART (TX/RX) 3', + 'UART4': 'UART (TX/RX) 4', + 'ULPI1': 'ULPI (USB Low Pin-count) 1', + 'ULPI2': 'ULPI (USB Low Pin-count) 2', + 'ULPI3': 'ULPI (USB Low Pin-count) 3', + } + + fns = display_fns(bankspec, pinouts, function_names) + print + + # Scenarios below can be spec'd out as either "find first interface" + # by name/number e.g. SPI1, or as "find in bank/mux" which must be + # spec'd as "BM:Name" where B is bank (A-F), M is Mux (0-3) + # EINT and PWM are grouped together, specially, but may still be spec'd + # using "BM:Name". Pins are removed in-order as listed from + # lists (interfaces, EINTs, PWMs) from available pins. + + # EOMA68 scenario. not totally complete (some GPIO needed for PMIC) + # One interface to be connected to the MCU to give RTC and boot/dbg + # VBUS_EN, OTG_ID etc. are all not included below, there is plenty + # of spare GPIO. + + eoma68 = ['B1:LCD/22', 'ULPI1/8', 'ULPI2', 'MMC', 'SD1', 'UART3', + 'TWI3', 'SPI2', 'E2:SD2', ] + eoma68_eint = ['EINT_0', 'EINT_1', 'EINT_2', 'EINT_3'] + eoma68_pwm = ['D1:PWM_2'] + descriptions = { + 'MMC': 'internal (on Card)', + 'SD1': 'user-facing: internal (on Card), multiplexed with JTAG1\n' + 'and UART2, for debug purposes', + 'TWI3': 'EOMA68-compliance: must be entirely free of devices.\n' + 'Address 0x51 used (externally) for EOMA68 EEPROM Id', + 'E2:SD2': 'EOMA68-compliance', + 'SPI2': 'EOMA68-compliance', + 'UART3': 'EOMA68-compliance', + 'B1:LCD/22': 'EOMA68-compliance, 18-bit RGB/TTL LCD', + 'ULPI1/8': 'user-facing: internal (on Card), USB-OTG ULPI PHY', + 'ULPI2': 'EOMA68-compliance: dual USB2 Host ULPI PHY' + } + + unused_pins = check_functions("EOMA68", bankspec, fns, pinouts, + eoma68, eoma68_eint, eoma68_pwm, + descriptions) + + + print ("""# Reference Datasheets + +datasheets and pinout links +* +* +* +* p8 +* +* +* +* ULPI OTG PHY, ST +* ULPI OTG PHY, TI TUSB1210 +""") + + return pinouts, bankspec, pinbanks, fixedpins