2 * Copyright (C) 2015 Czech Technical University in Prague
5 * - Michal Sojka <sojkam1@fel.cvut.cz>
7 * Permission is hereby granted, free of charge, to any person
8 * obtaining a copy of this software and associated documentation
9 * files (the "Software"), to deal in the Software without
10 * restriction, including without limitation the rights to use,
11 * copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
31 #include "drv/gio_names.h"
32 #include "drv/gio_tab.h"
34 #include "drv/spi_tms570.h"
37 // Lists of pins assigned to the ports
38 static enum pin_name pins_gioa[] = {
39 PIN_GIOA0, PIN_GIOA1, PIN_GIOA2, PIN_GIOA3,
40 PIN_GIOA4, PIN_GIOA5, PIN_GIOA6, PIN_GIOA7
42 static enum pin_name pins_giob[] = {
43 PIN_GIOB0, PIN_GIOB1, PIN_GIOB2, PIN_GIOB3,
44 PIN_GIOB4, PIN_GIOB5, PIN_GIOB6, PIN_GIOB7
46 static enum pin_name pins_nhet1[] = {
47 PIN_NHET10, PIN_NHET11, PIN_NHET12,
48 PIN_NHET13, PIN_NHET14, PIN_NHET15,
49 PIN_NHET17, PIN_NHET18, PIN_NHET19,
50 PIN_NHET110, PIN_NHET111, PIN_NHET112,
51 PIN_NHET114, PIN_NHET115, PIN_NHET116,
52 PIN_NHET117, PIN_NHET118, PIN_NHET119,
53 PIN_NHET120, PIN_NHET121, PIN_NHET122,
54 PIN_NHET123, PIN_NHET124, PIN_NHET125,
55 PIN_NHET126, PIN_NHET127, PIN_NHET128,
56 PIN_NHET129, PIN_NHET130, PIN_NHET131
59 static enum pin_name pins_spi5[] = {
60 PIN_SPI5CS0, PIN_SPI5CS1, PIN_SPI5CS2, PIN_SPI5CS3,
61 PIN_SPI5ENA, PIN_SPI5CLK,
62 PIN_SPI5SIMO0, PIN_SPI5SIMO1, PIN_MCU_ENDRV, PIN_TEMP_ALERT,
63 PIN_SPI5SOMI0, PIN_SLEEP, PIN_SPI5SOMI2, PIN_SPI5SOMI3,
67 const struct port_desc port_desc[] = {
70 .cfg = { .gioset = { .pins = pins_gioa } },
71 .numchn = ARRAY_SIZE(pins_gioa),
73 .get = port_gioset_get,
74 .set = port_gioset_set,
78 .cfg = { .gioset = { .pins = pins_giob } },
79 .numchn = ARRAY_SIZE(pins_giob),
81 .get = port_gioset_get,
82 .set = port_gioset_set,
86 .cfg = { .gioset = { .pins = pins_nhet1 } },
87 .numchn = ARRAY_SIZE(pins_nhet1),
89 .get = port_gioset_get,
90 .set = port_gioset_set,
94 .cfg = { .adc = { .reg = adcREG1, .group = adcGROUP1 } },
95 .numchn = PORT_ADC_CHANNELS,
100 [PORT_ID_THERMISTOR1] = {
106 .cfg = { .spi = { .dev = SPIDEV_MCP6S93_TH1, .chip = "MCP6S93" }, },
108 [PORT_ID_THERMISTOR2] = {
114 .cfg = { .spi = { .dev = SPIDEV_MCP6S93_TH2, .chip = "MCP6S93" }, },
116 [PORT_ID_ADC_COND] = {
119 .bpch = 16, /* 6 ICs in daisy chain */
122 .cfg = { .spi = { .dev = SPIDEV_MCP6S93_6ADC, .chip = "MCP6S93" }, },
124 [PORT_ID_POWER_SUPPLY] = {
130 .cfg = { .spi = { .dev = SPIDEV_TPS65381_PWR, .chip = "TPS65381" }, },
132 [PORT_ID_SENSOR_SUPPLY] = {
138 .cfg = { .spi = { .dev = SPIDEV_MCP6S93_SENSUP, .chip = "MCP6S93" }, },
140 [PORT_ID_DAC_ADC_LOOPBACK] = {
146 .cfg = { .spi = { .dev = SPIDEV_MCP6S93_DAC, .chip = "MCP6S93" }, },
148 [PORT_ID_GIO_SPI5] = {
150 .cfg = { .gioset = { .pins = pins_spi5 } },
151 .numchn = ARRAY_SIZE(pins_spi5),
153 .get = port_gioset_get,
154 .set = port_gioset_set,